I am trying to build a cross compiling gcc for ARM. This will be to update an existing gcc ARM cross compiler. The build runs fine until it gets to building libstdc++, after libgcc1 builds successfully.

The error is:

<gcc-object-path>/./gcc/xgcc -shared-libgcc -B<gcc-object-path>/./gcc -nostdinc++ -L<gcc-object-path>/<target>/libstdc++-v3/src -L<gcc-object-path>/<target>/libstdc++-v3/src/.libs -L<gcc-object-path>/<target>/libstdc++-v3/libsupc++/.libs -B<sysroot>/<target>/bin/ -B<sysroot>/<target>/lib/ -isystem <sysroot>/<target>/include -isystem <sysroot>/<target>/sys-include --sysroot=<boot-strap-xgcc-sysroot>   -x c++-header -nostdinc++ -g -Os  -I<gcc-object-path>/<target>/libstdc++-v3/include/<target> -I<gcc-object-path>/<target>/libstdc++-v3/include -I<gcc-source-path>/libstdc++-v3/libsupc++ -O2 -g -std=gnu++0x <gcc-source-path>/libstdc++-v3/include/precompiled/stdc++.h \
        -o <target>/bits/stdc++.h.gch/O2ggnu++0x.gch
<gcc-source-path>/libstdc++-v3/include/precompiled/stdc++.h:52:20: fatal error: ccomplex: No such file or directory
 #include <ccomplex>
compilation terminated.

find gcc-object-path -name ccomplex -print shows:


The compile command has


on it.


is a symbolic link to


But that file does not exist in the source at that location, so it is a broken symlink and the compile fails. The file ccomplex does exist in the source tree in three other locations, though. There are 6 other such symlinks that are also similarly broken.

Looking at the libstdc++-v3/include/Makefile that generates these symlinks, it expects to find all of the c_base_headers files in the same location in the source tree, but they are not. How is this supposed to work?

The gcc configure options are:

gcc-${GCC_VERSION}/configure --target=$CONF_TARGET --prefix=${PREFIX} --exec_prefix=${PREFIX} --bindir=${PREFIX}/bin --sbindir=${PREFIX}/bin --libexecdir=${PREFIX}/libexec --datadir=${PREFIX}/share --sysconfdir=${PREFIX}/etc --sharedstatedir=${PREFIX}/share/com --localstatedir=${PREFIX}/var --libdir=${PREFIX}/lib --includedir=${PREFIX}/include --oldincludedir=${PREFIX}/include --infodir=${PREFIX}/share/info --mandir=${PREFIX}/share/man --enable-largefile --disable-nls --enable-ipv6 --with-gnu-ld --enable-shared --enable-languages=c,c++,objc,fortran --enable-threads=posix --disable-multilib --enable-c99 --enable-long-long --enable-symvers-gnu --enable-libstdcxx-pch --program-prefix=${CMD_PREFIX} --enable-target-optspace --enable-cheaders=c_std --disable-bootstrap --disable-libgomp --disable-libmudflap --with-float=soft --with-sysroot=${NEWSYSROOT} --with-build-sysroot=${SYSROOT} --with-build-time-tools=${INSTALLDIR}/${PREFIX}/${CONF_TARGET}/bin --disable-libunwind-exceptions --disable-libssp --enable-__cxa_atexit
  • Which version of GCC are you building? What ./configure arguments are you using? Commented Jun 2, 2017 at 18:15
  • Building gcc 4.9.4. The configure arguments are the same as those that the previous compiler used (gcc -v output). I think the '--enable-cheaders=c_std' has something to do with it. As a work-around, I can copy the (missing) files (ccomplex cfenv cinttypes cstdalign cstdbool cstdint ctgmath) from libstdc++-v3/include/c_global/ to libstdc++-v3/include/c_std so the generated symlinks are not broken. The build completes. Still, if --enable-cheaders=c_std is configured, why would it try to compile code including headers not in c_std?
    – Jay
    Commented Jun 2, 2017 at 22:40
  • I suspect --enable-libstdcxx-pch is the option causing problems here; could you try without that? Commented Jun 14, 2017 at 7:38
  • @StephenKitt. I tried removing --enable-libstdcxx-pch, but that did not make any difference.
    – Jay
    Commented Jun 14, 2017 at 21:32

1 Answer 1


What environment are you using? And what is your target environment?

ARM has some toolchains available for download at ARM developer site.

You might need to make available libraries and header files for your target environment. For FreeBSD that would be the appropriate base.txz file which needs to be unpacked in the right place.

For 386 and amd64 FreeBSD v 11.* i there is existing GCC cross compilers for arm. Or to be specific arm64/aarch64. Even with Ada. That is in the ports found in /usr/ports/lang/gnatcross*.

If you google, it should be easy to be able to compile a generic arm cross compiler using a few configure options. Many use arm as an example when compiling the cross compiler.

If you have a Raspberry PI which is either arm or aarch64 architecture, you could have nice native environment. All you then need is to avoid stuff that is operating system dependent.

The RPI have several available operating system including : FreeBSD, Raspbian and other Linuxes and BSD versions.

I'm working at cross compiling GCC for aarch64 FreeBSD 12. It requires some modifications. So I copied the ports involved and modified them. The difficult bit is finding out how to cross compile gcc. And find out which options needs to be disabled.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .