Mysteries of Cygwin... - Port 25: The Open Source Community at Microsoft
< Back to Blogs
Mysteries of Cygwin... 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


 

Comments RSS
  1. Run the following command to edit all the source files (I haven't tested this well, btw):

    cd /path/to/kdissert
    find . -type f -exec sed -i 's/aux\.h\([>,\"]\)$/kdissert_aux.h\1/g' {} \;

    What does this do, you may ask? Here it is explained piece by piece:

    find . -type f  - This part lists all files (we exclude dirs by 'type f')

    -exec sed -i    - We tell find we want to run sed on all the files; we also tell sed we want to edit the file in-place (-i)

    's/aux\.h\([>,\"]\)$'       - Start a substitute expression and look for aux.h followed by either '>' or '"' then the end of the line ($). The \( and \) tell sed we want it to store what's between the parens as a variable

    $/kdissert_aux.h\1/g'     - Replace what was found with kdissert_aux.h; the \1 gets replaced with whatever was in our previous \( \)'s. The '/g' at the end tells it to replace as many as found in one line (which isn't really necessary here, but that's ok)

    ' {} \;       - Wherever the {} is, find will substitute the file name it's currently processing. The \; tells find to no longer treat parameters as part of the sed command.

    Hope that helps, kdissert is a great program!

    posted at 05:35PM 05/18/2006
  2. thardie said:

    Cygwin plays very nice on windows these days. We even got Linux building under Visual studio 2005 with cygwin and gcc :)

    It's funny to right click on a project in VS, click build, and menuconfig pops up in a window :)

    posted at 12:47PM 11/03/2006
Post a Comment
*
*