Re: Statically linked GCC toolchain

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

 



Hi All,

Oops! I think I was doing a mistake. I should not run following both steps for building gcc :
1) #make bootstrap
2) #make
I should have to use only one of them.
After executing following steps I have able to create statically linked gcc toolchain: 1)#../gcc-3.4.5/configure --prefix=/home/praks/GCC345 --enable-languages=c,c++,java
2)#make BOOT_LDFLAGS="-static"
3) #make install
Or
1)#../gcc-3.4.5/configure --prefix=/home/praks/GCC345 --enable-languages=c,c++,java
2)#make LDFLAGS="-static"
3) #make install

Now problem is generated gcc is fully statically linked, means "#ldd gcc" shows no dependency.
(praks) bin> ldd gcc
       not a dynamic executable
(praks) bin>

I don't know how RedHat builds gcc which has following kind of dependency:
(praks) bin> ldd /usr/bin/gcc
       libc.so.6 => /lib/i686/libc.so.6 (0x40023000)
       /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
(praks) bin>
(aniket) bin> ldd /usr/bin/g++
       libc.so.6 => /lib/i686/libc.so.6 (0x40023000)
       /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
(aniket) bin>

It would be nice if anyone could suggest what steps I should have to follow to create gcc having same dependencies as RedHat's default gcc has.
Thanks in advanced.

Regards,
Prakash

prakash wrote:
Hi,

I am trying to build a gcc-3.4.5 on RedHat 7.1 so that I can use it on following different platforms:
RH 7.1, RH7.3, RH8, RH9, RHEL2.1 RHEL4.0, FC2, FC3,etc

My requirement is to use gcc without setting LD_LIBRARY_PATH to location of libgcc_s.so, on different platform as mentioned above. I don't want application binaries which are generated/created as statically linked executables by these toolchain. I have observed that Red hat's default /usr/bin/gcc is statically linked gcc. I tried same configuration parameter (returned by #/usr/bin/gcc -v) to build it, but I could not able to get statically linked gcc. I could not able to find out how they build it on Net. Here is steps (found on net) which I tried:

# LDFLAGS=-static ../gcc-3.4.5/configure --prefix=/home/praks/GCC345 --enable-languages=c,c++,java
#make LDFLAGS=-static bootstrap && make LDFLAGS=-static

But it creates gcc which is dependent on libgcc_s.so
-----------------------------------------------------
(praks) bin> ./gcc
./gcc: error while loading shared libraries: libgcc_s.so.1: cannot load shared object file: No such file or directory
(praks) bin> ldd ./gcc
libgcc_s.so.1 => not found
libc.so.6 => /lib/i686/libc.so.6 (0x40023000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
(praks) bin>
-----------------------------------------------------

However, GCC configure script supports --enable-static && --enable-shared. With help of these flags we can build gcc toolchain statically linked. But binaries which are generated by these toolchain are statically linked executables. I want only statically gcc linked toolchain & I want to use this gcc toolchain on different platforms as mentioned earlier. It would be nice if anyone could give pointers.

Regards,
Prakash





DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Pvt. Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Pvt. Ltd. does not accept any liability for virus infected mails.

[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