Code::Blocks Forums
Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: thomas on July 30, 2007, 05:03:39 pm
-
I looked into the well-known space-in-path problem encountered with windres today. As it happens, the workaround is quite easy.
First, it does not seem to make sense why it should not work, using the same runtime as all the gnu tools (which all work fine). Looking at the documentation reveals: "When windres reads an rc file, it runs it through the C preprocessor first."
Aha! It seems that windres correctly removes any quotes and then calls gcc with the unquoted filename to preprocess the .rc file.
So what does the workaround look like? Easy:
windres.exe -i "\"D:\foo bar baz\many spaces\project.rc\"" -J rc -o obj\project.res -O coff
runs without any problems.
Sure enough, this doesn't work with any other tool, the compiler will complain about the double quotes if you feed them to it. So, what needs to be done is simply a small piece of extra code in the compiler plugin, checking for windres, and either adding the extra quotes manually or giving an extra flag to QuoteStringIfNeeded.
-
So, what needs to be done is simply a small piece of extra code in the compiler plugin, checking for windres
Hmm, as far as I recall there is no such problem for quite some time. We had solved it by using the short path version of the filename (e.g. C:\SOMEPA~1\file.rc)...
-
Revision 4182:
-------------- Build: default in foo ---------------
windres.exe -i "D:\foo bar baz\many spaces\project.rc" -J rc -o obj\project.res -O coff -IC:\MinGW\include
gcc: D:\foo: No such file or directory
gcc: bar: No such file or directory
gcc: baz\many: No such file or directory
gcc: spaces\project.rc: No such file or directory
gcc: warning: `-x c' after last input file has no effect
gcc: no input files
windres.exe: no resources
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 1 warnings
-
Hmm, as far as I recall there is no such problem for quite some time. We had solved it by using the short path version of the filename (e.g. C:\SOMEPA~1\file.rc)...
Notice there are systems that have short path functionality disabled (can be done in NTFS). So this isn't a very good solution anyway. (I know from other projects...)
With regards, Morten.
-
Well, you both may very well be right. I haven't used windows for quite some time anyway :).
-
was there no update in the binutils , specifally fixing this issue for windres ??
-
The description to the latest "snapshot" says that, yes... but I had not seen that one. The description of that package is a bit vague, too.
The fix mentioned here was more meant to make it work with the "current" and "candidate" releases that 99% of the people probably use.
Now what to do...? If that snapshot works, it'll probably be best for us to just ignore the issue and tell people "use the latest snapshot if it bothers you". Would save one hack in our code, at least, what do you think?
Edit: downloaded, tested, failed.
-------------- Build: default in foo ---------------
Running target pre-build steps
windres --version
GNU windres 2.17.50 20060824
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License. This program has absolutely no warranty.
windres.exe -i "D:\foo bar baz\many spaces\project.rc" -J rc -o obj\project.res -O coff -IC:\MinGW\include
gcc: D:\foo: No such file or directory
gcc: bar: No such file or directory
gcc: baz\many: No such file or directory
gcc: spaces\project.rc: No such file or directory
gcc: warning: `-x c' after last input file has no effect
gcc: no input files
windres.exe: no resources
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 1 warnings
-
I believe Lieven meant the following Binutils snapshot.
http://downloads.sourceforge.net/mingw/binutils-2.17.50-20070129-1.tar.gz?modtime=1170688894&big_mirror=1
This can handle path with spaces.
But I agree with you. We should fix it. :)
-
If it indeed now works out of the box, I would not put any hacks in our code. Maybe we can create a sticky post in the help forum, so we can reference to it (and also in the wiki), where we explain what to download from MinGW.
release note for the above mentioned link :
I have uploaded an update of binutils (2.17.50-200700129-1)
to MinGW's Sourceforge File Release page. You can download it
from Snapshots section at:
https://sourceforge.net/project/showfiles.php?group_id=2435
The 2.17.50-200700129-1 snapshot incorporates modifications to official
binutils CVS since last update. In addition it patches windres to allow
use of spaces in filenames, Please refer ChangeLog entries in src for
specific changes
For more info on binutils, follow this:
http://sources.redhat.com/binutils/
Danny
-
I believe Lieven meant the following Binutils snapshot.
Though that one is immensely painful to find on the download page, it indeed seems to work out of the box.
-
If I remember correctly, binutils-2.17.50-20070129-1 fails to compile wxWidgets; I've stuck with 20060824.