This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compilining with newlib


none none wrote:

> I keep getting the error:
> checking whether the C compiler (powerpc-linux-gcc  ) works... no
> configure: error: installation or configuration problem: C compiler cannot create executables.
> 
> What am I doing wrong? Is my gcc really not working or do I get something wrong with newlib??
> If yes what do I have to do in order to get my powerpc-linux-gcc finally run a hello world program ??? (!!!!)

You'll have to look at config.log to see what the details of the failure
are, but if you only did "make all-gcc install-gcc" then you don't have
a functioning compiler.  As the name suggests, libgcc is part of the
compiler and without it you will not be able to link any executables,
and libgcc (nor any of the other target libraries like libstdc++,
libgfortran, libgomp, ...) is not built with "all-gcc".  But as you've
seen, building target libraries depends on having an existing libc, so
there is a circular dependency.

There are a couple of ways to break this dependency.  By far the easiest
is to stop trying to build up a toolchain from zero and instead take the
working libc (headers, libs, crt objects) of an existing system that's
close to what you're building and use that as the sysroot.  You don't
have to use this permanently, but it allows you to at least build a
functioning gcc that you can then use to rebuild your own libc later if
you want.

The other, if you are using newlib, is to merge the gcc and newlib
sources and do a combined tree build.  This will build the compiler and
libc at the same time.  The build machinery has special support for
newlib in this aspect, so that it's possible to build a newlib target
without a preexisting newlib libc.

You can also look at the crosstool script, which does what you are
trying to do (breaks the circular dependency without resorting to newlib
or using an existing libc) but it takes a fair number of patches,
special-purpose hacks, multiple steps, etc.  It's a rather complex way
to go about things, but it is at least turnkey.  But crosstool only
supports linux+glibc, no other combination.

Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]