On 08.07.2015 01:34 Greg Ercolano wrote:
> On 07/07/15 06:25, Albrecht Schlosser wrote:
>>> /bin/sh: -c: line 0: syntax error near unexpected token '('
>>> /bin/sh: -c: line 0: '/c/Program Files (x86)/CodeBlocks/minGW/bin/ar ....
>>> [..]
>>
>> Short answer: install codeblocks and/or mingw in a path(name) without
>> spaces and other "special" characters like '(' and ')'.
>>
>> Your command above chokes because the pathname '/c/Program Files
>> (x86)/CodeBlocks/' contains spaces and '(' and ')'. The shell does not
>> recognize the full string correctly as the path.
>
> Hmm, I have a question about this.
>
> Are we (as part of configure) using absolute paths to invoke tools
> like "/absolute/path/to/ar" and "/absolute/path/to/g++"
> instead of just depending on the current PATH and invoking "ar" and "g++"?
We use whatever configure gives us. Look at your makeinclude file -
there are some command definitions that are to be used in the Makefiles,
and some or all are with complete paths. See below for more (cross
compiling).
Particularly 'ar' is defined in LIBCOMMAND. In my case on Linux this is:
LIBCOMMAND = /usr/bin/ar cr
Note there is a complete path.
> Certainly spaces and special characters are challenging to get into
> command lines, esp. in DOS where the rules are really kooky.
>
> But I think everything works OK as long as the spaces and special
> characters are in the PATH.
Maybe. I never thought about that.
> Anyway, just thinking aloud.. We probably use absolute paths
> for a reason, perhaps so that compiles will work even if the
> user's PATH has changed..
There is another reason. Configure can be used for cross compiling, and
although the cross compiler toolchain is /not/ in the user's path the
tools must be found by make etc.. Hence such commands are defined by
configure and included in makeinclude.
Here is an example for cross-compiling for Windows (64-bit) on Linux:
$ ./configure --host=x86_64-w64-mingw32
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-w64-mingw32
checking for x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-w64-mingw32-gcc accepts -g... yes
checking for x86_64-w64-mingw32-gcc option to accept ISO C89... none needed
checking for x86_64-w64-mingw32-g++... x86_64-w64-mingw32-g++
checking whether we are using the GNU C++ compiler... yes
checking whether x86_64-w64-mingw32-g++ accepts -g... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for nroff... /usr/bin/nroff
checking for doxygen... /usr/bin/doxygen
checking for x86_64-w64-mingw32-ranlib... x86_64-w64-mingw32-ranlib
checking for x86_64-w64-mingw32-ar... /usr/bin/x86_64-w64-mingw32-ar
checking for x86_64-w64-mingw32-windres...
/usr/bin/x86_64-w64-mingw32-windres
checking how to run the C preprocessor... x86_64-w64-mingw32-gcc -E
...
This results in the following definitions in makeinclude:
$ grep x86 makeinclude
CXX = x86_64-w64-mingw32-g++
CC = x86_64-w64-mingw32-gcc
RC = /usr/bin/x86_64-w64-mingw32-windres
LIBCOMMAND = /usr/bin/x86_64-w64-mingw32-ar cr
RANLIB = x86_64-w64-mingw32-ranlib
I don't know the rules, but there are some commands with full paths (RC,
LIBCOMMAND) and others w/o the path (CXX, CC, RANLIB).