public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Compilining with newlib
@ 2007-06-01 18:09 none none
  2007-06-01 18:28 ` Brian Dessent
  0 siblings, 1 reply; 2+ messages in thread
From: none none @ 2007-06-01 18:09 UTC (permalink / raw)
  To: gcc-help

Hi all,

My aim is to cross compile applications for an embeded powerpc
system running a lite version of linux and having nothing on (no headers,
no gcc etc).  I have two questions. 

So I have my linux box with and intel i386 on and got binutils-2.17, gcc-4.2 and glibc from 
2.3.4 to 2.6.(!!)

I have compiled gcc successfully using 
../configure
--target=powerpc-linux --prefix=$prefix --disable-shared --disable-threads
--enable-languages=c --with-newlib
make all-gcc install-gcc


Then I tried in vain to install glibc. I got many errors and finally I had enough and 
abandoned the effort. My first question is this:

Has anyone been able to cross compile gcc-glibc for powerpc? If yes which relative new 
combination of gcc-glibc works (new meaning gcc after 3.3.4 because older are too old 
for my system and configure fails)

Secondly I have desided to use newlib so I downloaded newlib-1.15.0 and tried to 
configure it for powerpc using the following
CC=powerpc-linux-gcc ../configure --host=powerpc-linux --prefix=$prefix

I had previously exported powerpc-linux-gcc and binutils to my path.

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 ??? (!!!!)

Thanks in advance for any help
Andreas Sotirakopoulos




      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Compilining with newlib
  2007-06-01 18:09 Compilining with newlib none none
@ 2007-06-01 18:28 ` Brian Dessent
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dessent @ 2007-06-01 18:28 UTC (permalink / raw)
  To: none none; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-01 18:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-01 18:09 Compilining with newlib none none
2007-06-01 18:28 ` Brian Dessent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).