building gcc on cygwin with --target=i486-linux-gnu

Dave Korn
Sun Oct 8 13:57:00 GMT 2006

On 08 October 2006 14:27, Alexander Kotelnikov wrote:

> Hello.
> I tried to build gcc 4.1.1 as a cross-compiler for i486-linux-gnu on
> cygwin and the build failed with error
> /opt/bin/i486-linux-gnu-ld: cannot find /lib/
> collect2: ld returned 1 exit status
> make[3]: *** [] Error 1
> And there is really no /lib/ on cygwin. Can anyone explain
> what does this mean?

  It means libc for the target, not the host!

  It's trying to build  This is the gcc shared support library
that gets linked in against every program gcc compiles.  Because it's a
cross-compiler, it's building an i486-linux-gnu version of libgcc, and that
needs to link against an i486-linux-gnu C library.

> Thanks
> If it matters, gcc was configures as
> ./configure --prefix=/opt --target=i486-linux-gnu --with-gnu-ld
> --with-gnu-as --enable-languages=c 

  When building a cross-compiler, you need to either have a pre-existing set
of system libs and headers from the target system, or you need to compile
glibc for the same target at the same time.  If you have the pre-existing
libs, you copy them onto your build machine and point configure at them using
--with-sysroot (or --with-headers and --with-libs, but --with-sysroot is
preferred these days).  If you don't, your best option is to use Dan Kegel's
crosstool script to manage the build of comiler-and-C-library-together for

  What's the actual target you want to cross-compile for?  Do you have a
particular linux system in mind?

Can't think of a witty .sigline today....

For unsubscribe information see

More information about the crossgcc mailing list