This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


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

Re: How to make a portable toolchain?


Hi M.R.,

I can link to libc statically on Solaris8 with link option "-Wl,-static". As
static libc requires libdl on Solaris, so I put -ldl in the LDFLAGS, but I
got linkage error saying "can not find -ldl".

Under /usr/lib on Solaris8, I can only see libdl.so but not libdl.a, this is
the reason of above linkage error. --- SUN does not ship libdl.a

If I configure cross gcc with option --disable-shared, can I get rid of
option -ldl when I compile/link targets with the cross gcc?

Thanks,
-Bin


----- Original Message -----
From: "M. R. Brown" <mrbrown@0xd6.org>
To: "Rodney Smith" <rodney.smith@watchguard.com>
Cc: <crossgcc@sourceware.cygnus.com>; <binzhou@tgivan.com>; "Bin Zhou"
<binzhou@pop-star.net.cn>
Sent: Thursday, November 01, 2001 2:22 AM
Subject: Re: How to make a portable toolchain?

* Rodney Smith <rodney.smith@watchguard.com> on Wed, Oct 31, 2029:

> Is there a configuration option to statically link a cross-compiler? I
want
> to make my toolchains portable and not rely on the host having a
particular
> version of libc, etc, so I want to statically link the compiler
executables.
> Short of finding the linker command lines in the makefile and adding
> "-Wl,-static", is there a configuration option?
> I still want the target to use dynamic libraries.
> -r
>

Use --disable-shared when configuring the cross toolchain (binutils and
gcc).  Note for gcc, the --disable-shared affects libgcc for the target, so
only use it for binutils, and specify -static as part of your LDFLAGS:

$ LDFLAGS="-static" ../configure ...

This way configure will substitute -static in every Makefile it generates.

By default libiberty and libbfd are static, so you should already be
OK, but you need the -static so that libc is linked statically.

M. R.



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


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