This is the mail archive of the crossgcc@sourceware.org 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]
Other format: [Raw text]

Re: Building a static toolchain ?


On (01/04/10 11:43), Dimitry Andric wrote:
> On 2010-03-31 23:25, Yann E. MORIN wrote:
> >>- make sure any extra dependencies, usually libgmp and/or libmpfr,
> >>*are* statically linked into the toolchain executables, since not
> >>everybody will have those as .so files on their system, or may have
> >>different, incompatible versions.
> >
> >Yes, and those *I* was not able to properly build statically (yet!)... :-(
> 
> For that, I use something like the attached patch, which should apply
> cleanly to gcc 4.3.3, but most likely also to later versions.
> 
> After building the toolchain, you can check out the dependencies with
> ldd, for example:
> 
> $ ldd $TOOLCHAIN_ROOT/libexec/gcc/$TARGET_TRIPLET/4.3.3/cc1
>          linux-gate.so.1 =>  (0x00a5b000)
>          libc.so.6 => /lib/libc.so.6 (0x00110000)
>          /lib/ld-linux.so.2 (0x00996000)
> 
> So it only links dynamically with glibc, while it contains gmp and mpfr
> statically:
> 
> $ strings $TOOLCHAIN_ROOT/libexec/gcc/$TARGET_TRIPLET/4.3.3/cc1|grep -E "gmp|mpfr"
> real_from_mpfr
> mpfr_from_real
> |*p+>(__builtin_constant_p (1) && (1) == 0 ? (((S)->_mpfr_exp == ((mp_exp_t)((~((~(unsigned long)0)>>1))+1))) ? 0 : ((S)->_mpfr_sign)) : mpfr_cmp_ui_2exp ((S),(1),0)) < 0
> !(((t)->_mpfr_exp) == (((-2147483647L - 1L))+2))
> prec >= 2 && prec <= ((mpfr_prec_t)((mpfr_prec_t)(~(mpfr_prec_t)0)>>1))
> p >= 2 && p <= ((mpfr_prec_t)((mpfr_prec_t)(~(mpfr_prec_t)0)>>1))
> (((k)->_mpfr_exp) == ((((long) ((~ (unsigned long) 0) ^ ((unsigned long) (~ (unsigned long) 0) >> 1))))+1)) || ((k)->_mpfr_exp) <= 2
> (!(((r)->_mpfr_exp) == ((((long) ((~ (unsigned long) 0) ^ ((unsigned long) (~ (unsigned long) 0) >> 1))))+2)) && !(((r)->_mpfr_exp) == ((((long) ((~ (unsigned long) 0) ^ ((unsigned long) (~ (unsigned long) 0) >> 1))))+3)))
> (((cache->x)->_mpfr_sign) > 0)
> ! (un < pn || (un == pn && __gmpn_cmp (up, pp, pn) < 0))
> 

> diff -ur a/configure.ac b/configure.ac
> --- a/configure.ac	2008-02-02 04:29:30.000000000 +0100
> +++ b/configure.ac	2010-04-01 11:18:19.000000000 +0200
> @@ -1139,7 +1139,7 @@
>  ACX_PROG_CMP_IGNORE_INITIAL
>  
>  # Check for GMP and MPFR
> -gmplibs="-lmpfr -lgmp"
> +gmplibs="-Wl,-Bstatic -lmpfr -lgmp -Wl,-Bdynamic"
>  gmpinc=
>  have_gmp=no
>  
> diff -ur a/configure b/configure
> --- a/configure	2008-02-02 04:29:30.000000000 +0100
> +++ b/configure	2010-04-01 11:18:19.000000000 +0200
> @@ -4368,7 +4368,7 @@
>  
>  
>  # Check for GMP and MPFR
> -gmplibs="-lmpfr -lgmp"
> +gmplibs="-Wl,-Bstatic -lmpfr -lgmp -Wl,-Bdynamic"
>  gmpinc=
>  have_gmp=no
>  
> 
> 

you could add symlinks to gmp and mpfr sources on top of gcc tree
and then it should link them statically you would not need this patch.

> --
> For unsubscribe information see http://sourceware.org/lists.html#faq


--
For unsubscribe information see http://sourceware.org/lists.html#faq


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