Why can't my cross-compiler g++ find header files?
Posted: Tue Oct 20, 2015 11:53 am
I have configured GCC as follows:
I built and installed GCC and the C++ standard library, using:
The C++ headers were installed in "/glidix/usr/x86_64-glidix/include/c++/4.9.0". However, when attempting to compile the trivial "hello world" in C++, I get:
So I decided to pass the "-v" flag to see what is happening:
It is pretty clear that it is not looking for the C++ library where it should be. If I add that directory to the include path explicitly with "-I", I get errors about other headers not being found. My native linux g++ has all the linux C++ headers in its path, so why does the cross-compiler to glidix not have them?
Code: Select all
../glidix-gcc/configure --target=x86_64-glidix --prefix=/glidix/usr --with-sysroot=/glidix --enable-languages=c,c++ --exec-prefix=/usr --disable-nls
Code: Select all
make all-gcc all-target-libgcc
make install-gcc install-target-libgcc
make all-target-libstdc++-v3
make install-target-libstdc++-v3
Code: Select all
$ x86_64-glidix-g++ hello.cpp -o hello
hello.cpp:1:20: fatal error: iostream: No such file or directory
#include <iostream>
^
compilation terminated.
Code: Select all
$ x86_64-glidix-g++ hello.cpp -o hello -v
Using built-in specs.
COLLECT_GCC=x86_64-glidix-g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-glidix/4.9.0/lto-wrapper
Target: x86_64-glidix
Configured with: ../glidix-gcc/configure --target=x86_64-glidix --prefix=/glidix/usr --with-sysroot=/glidix --enable-languages=c,c++ --exec-prefix=/usr --disable-nls
Thread model: single
gcc version 4.9.0 (GCC)
COLLECT_GCC_OPTIONS='-o' 'hello' '-v' '-mtune=generic' '-march=x86-64'
/usr/libexec/gcc/x86_64-glidix/4.9.0/cc1plus -quiet -v hello.cpp -quiet -dumpbase hello.cpp -mtune=generic -march=x86-64 -auxbase hello -version -o /tmp/ccaFVvJA.s
GNU C++ (GCC) version 4.9.0 (x86_64-glidix)
compiled by GNU C version 4.8.4, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-glidix/4.9.0/../../../../../x86_64-glidix/include/c++/4.9.0"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-glidix/4.9.0/../../../../../x86_64-glidix/include/c++/4.9.0/x86_64-glidix"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-glidix/4.9.0/../../../../../x86_64-glidix/include/c++/4.9.0/backward"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-glidix/4.9.0/../../../../../x86_64-glidix/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-glidix/4.9.0/include
/glidix/usr/local/include
/usr/lib/gcc/x86_64-glidix/4.9.0/include-fixed
/glidix/usr/include
End of search list.
GNU C++ (GCC) version 4.9.0 (x86_64-glidix)
compiled by GNU C version 4.8.4, GMP version 5.1.3, MPFR version 3.1.2-p3, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 1308ca13ef78229dce86638bb09addb3
hello.cpp:1:20: fatal error: iostream: No such file or directory
#include <iostream>
^
compilation terminated.