How to build cross compiler g++ ?

Brian Dessent
Thu Sep 27 01:38:00 GMT 2007

Peter Skvarka wrote:

> checking for main in -lm... configure: error: Link tests are not allowed
> make: *** [configure-target-libstdc++-v3] Error 1

This error means that during the process of configuring libstdc++, some
aspect of the target platform (libc, etc) needed to be determined but
the only way to determine it was by linking a test program.  But that
cannot be done because earlier in the configuration process it was
determined that your cross-gcc cannot link executables -- probably
because you didn't provide a sysroot.

In order for this (and most likely, additional) libstdc++ configure test
to run, you will need the target libc headers, library, and other misc
things like crt*.o that are necessary to actually link a C program.  You
provide this tree in the same layout as on the target, using the
--with-sysroot parameter.  These things are not part of gcc, they're
part of whatever libc you're using.

As an alternative you can figure out which link test is failing,
determine what the result would have been (i.e. whether it was supposed
to pass or fail), and add that value to the crossconfig.m4 file.

> When I look into ./gcc I am seeing here created g++, but after installing it
> it is not runnable, because it has not libstdc++, also under all my src
> directory with toolchain sources is not libstdc++, only some epty
> directories with that name are here.
> What am I doing wrong ?
> It seems that libstdc++ for 3.4.4 is missing, or it should be built with GNU
> C library ?
> I dont understand it, help me.

It's not missing.  The above error is telling you that it was trying to
configure libstdc++ in order to build it, but it can't because of the
inability to link a test program.


More information about the Gcc-help mailing list