by admin on May 18, 2006 10:30am


Mysteries of Cygwin...

Question:

-----Original Message-----
From: steffen
Sent: Saturday, April 29, 2006 8:32 AM
To: Port 25
Subject: (Port25) : You guys should look into _____
Importance: High

cygwin and its mysteries to bring Linux software to Windows

I am using my wife's XP machine a lot after work and hope to compile kdissert (a mindmap tool) for cygwin. It works on coLinux for me already (which you should also discuss) but I felt like not booting something extra.

My effort ended before it really started .... a file aux.h could not be untared. Google told me that this was a special problem with Windows as aux.[ch] are reserved names. This is hillarious.

Pleeze ... fix this behaviour and ... give me kdissert.

Cheers,

Steffen

Answer:

This is a common problem when porting applications to a Win32 as AUX is one of the few reserved filenames. Other reserved files, regardless of extension, are AUX, LCOMn, CON, LPTn, NUL, and PRN. (a lower case n represents a digit, so LPT1 or LCOM2 would be reserved names) The only good workaround is to rename the reserved filenames.

I took a quick look at the kdissert source and found aux.h is only included in 22 files. I would suggest renaming aux.h to something else like kdissert_aux.h and either manually editing the source files or use sed (or enter your stream editor of choice) to make it a little less painful.

Great you say, buy how do you rename or extract a file from an archive if Windows won't let you create it in the first place? Tar just hangs when it gets to the aux.h file from kdissert-1.0.6pre3.bz2. The easiest solution would be to rename and modify the source on a separate Linux machine or VPC. However, if all you have access to is a Windows machine with Cygwin, you can still work around this problem.

Extract out the contents of aux.h to another file using tar.

$ tar jxvf kdissert-1.0.6pre3.tar.bz2 --to-stdout \ kdissert-1.0.6pre3/src/kdissert/datastruct/aux.h > kdissert_aux.h

Make sure to exclude aux.h when un-tarring so tar doesn't err out

$ tar -jxvf kdissert-1.0.6pre3.tar.bz2 --exclude \ kdissert-1.0.6pre3/src/kdissert/datastruct/aux.h

Copy kdissert_aux.h to the correct place

$ cp kdissert_aux.h kdissert1.0.6pre3/src/kdissert/datastruct/kdissert_aux.h

Modify the source files to use the newly named kdissert_aux.h.

This should at least get you started towards porting kdissert to Win32/Cygwin. You also might want to check out and keep an eye on KDE's native Windows development, since further development of KDE on Cygwin has stopped.

Also see:
http://www.microsoft.com/technet/interopmigration/unix/sfu/portappc.mspx

KDE on Cygwin
http://kde-cygwin.sourceforge.net/
http://mail.kde.org/pipermail/kde-cygwin/2005-September/003009.html

Development of native KDE on Windows
http://sourceforge.net/forum/forum.php?forum_id=507276