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?


* 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.

PGP signature


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