Re: statically linked gcc executables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Angelo Leto wrote:
On Jan 24, 2008 5:12 PM, Andrew Haley <aph@xxxxxxxxxx> wrote:
Angelo Leto wrote:
On Jan 24, 2008 12:18 PM, Andrew Haley <aph@xxxxxxxxxx> wrote:
Angelo leto wrote:
Hi, I'm trying to build statically all the gcc executables in order to
generate a portable compiler package, in particular I need a package
which is not dependent from a specific dynamic loader version
(ld-linux.so.2), could you please help me to find a way to obtain
this?
For instance I can run gcc using the command "ld-linux.so.2
~/mygcc/usr/bin/c++", but c++ then calls cc1plus which also needs
ld-linux.so.2 ....
The short answer is to set the makefile args to that gcc links with
-static.  Simply "make LDFLAGS=-static" might work for you.
I already tried this, but seems not to work.
It works for me.  You need to tell us in what way it seems not to
work for you.  We can't get far by guessing.

The steps I execute are:
1) I downloaded gcc-4.2.2 from
ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-4.2.2/gcc-4.2.2.tar.bz2
2) enter gcc-4.2.2
3) make LDFLAGS=-static
4)  /usr/local/src/gcc-4.2.2 # ldd host-i686-pc-linux-gnu/gcc/cc1plus
        linux-gate.so.1 =>  (0xffffe000)
        libc.so.6 => /lib/libc.so.6 (0xb7e94000)
        /lib/ld-linux.so.2 (0xb7fdd000)

That's odd, because when I tried it, it worked.  Perhaps because I built
without bootstrapping.  Maybe it's because you're building a different
version of gcc.

If you go into the gcc dir,

 # rm cc1plus
 # make cc1plus LDFLAGS=-static

what happens?

I do sympathize, but I think you're doing the wrong thing.  Yes, you are
going to have to have two versions of your gcc binaries, one with
ld-linux.so.2 and one with ld-linux.so.1, but that should be all.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux