pkg installer fails if installation path contains spaces in mingw32
Benjamin Lindner
lindnerben at gmx.net
Sat Jun 6 09:22:41 CDT 2009
Hello,
There have been two reports on the forge-list that using pkg.m to
install packages in the mingw32 binary of octave 3.0.5 fails.
The installation fails, if octave is installed into a path that contains
spaces. The workaround is simle: Install it into a path *without*
spaces. Unfortunately, window's default installation locations often
contain spaces (e.g. "c:\program files"), so this might pop up very often.
I'll see to alter the installer for 3.2.x to offer a default
installation path without spaces and issue a warning if the user choses
otherwise.
The reason the installation fails is, that passing options to the
configure script is broken if these options contain spaces, because the
quoting does not work.
I don't see an easy fix right now.
Currently the situation is this:
1) pkg.m passes the option --prefix="a\path\that\might\contain\spaces"
2) for the mingw32 binary I also must pass
CPPFLAGS=-I"path\to\octave\include" and LDFLAGS=-L"path\to\octave\lib"
because some configure scripts as of now do not call mkoctfile to
retrieve compiler and linker settings and thus configure stage fails due
not missing headers or libraries, whereas compilation would work perfectly.
3) the actual cofigure command is again quoted as
sh.exe -c "the-configure-command"
This leads to problems if the configure command itself contains quoted
arguments.
4) Now even if the configure command is corrently interpreted by sh.exe
the prameters lose the quotes in further application, which leads to
errors at compile time.
Now the problem is that in windows you cannot use single quotes, since
cmd.exe does not understand them. And you can also not use
backslash-space (the posix way) since cmd.exe also does not understand
it and all backslashes are converted to forward slashes in pkg.m.
I see the following solutions
1) fix the quoting mess
2) avoid passing any arguments to configure
For 1) I don't see a straightforward solution. The parameters must
survive their quoted-ness not only as arguments to the configure script
but also in-use within the script. E.g. passing
CPPFLAGS=-I"c:/test path/include"
should result in exactly
g++ -I"c:/test path/include" ...
on the command line, because
g++ -Ic:/test path/include ...
will fail.
2) is twofold. First: do we really need to pass --prefix? The
installation is not done by "make install" anyway but done manually in pkg.m
Second: the additional CPPFLAGS and LDFLAGS could be avoided if the
configure scripts in all forge-packages would use the values provided by
mkoctfile.
BUT as there may be additional parameters not apparent at the current
time, this is not really a solution, just a workaround that delays the
problem.
So what I'll try for the 3.2.x binaries, is to have the installer
provide a defaut path without spaces and issue a respective warning if
the user choses otherwise.
Maybe this fact yould also be mentioned on the wiki page somewhere.
benjamin
More information about the Bug-octave
mailing list