Skip to content

Build of GCC fails when . is in PATH #2

@caltry

Description

@caltry

When cross compiling GCC while the current directory is in the PATH variable, compilation fails with the error message:

checking for i686-pc-linux-gnu-gcc... (cached) gcc
checking for C compiler default output file name... 
configure: error: in `/tmp/dcl9934/cross-tools/build-gcc/gcc':
configure: error: C compiler cannot create executables
See `config.log' for more details.

If you go to compile gcc manually, you'll see a more useful message:

$ rm -rf build-gcc && mkdir build-gcc
$ cd build-gcc
$ ../gcc-4.7.2/configure --target=arm-none-eabi --prefix=/tmp/dcl9934/cross-tools/local-prefix --enable-languages=c --without-headers
$ make
gcc -c   -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat   -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I../../gcc-4.7.2/gcc -I../../gcc-4.7.2/gcc/build -I../../gcc-4.7.2/gcc/../include -I../../gcc-4.7.2/gcc/../libcpp/include  -I../../gcc-4.7.2/gcc/../libdecnumber -I../../gcc-4.7.2/gcc/../libdecnumber/dpd -I../libdecnumber    \
            -o build/genconstants.o ../../gcc-4.7.2/gcc/genconstants.c
/tmp/dcl9934/cross-tools/local-prefix/arm-none-eabi/bin/as: unrecognized option '--32'

This problem here is that GCC creates a symlink to the 'as' for the target platform, and puts it in the build-gcc/gcc directory. So, when we try to compile something for the host, we end up using the target's 'as' instead!

gcc$ which as
./as
gcc$ as --verbose
GNU assembler version 2.23.1 (arm-none-eabi) using BFD version (GNU Binutils) 2.23.1

Either the user need to remove '.' from their path, or we should remove it from the environment when we build GCC by submake.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions