public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Statically linked GCC toolchain
       [not found] <44F9FFD6.6010903@persistent.co.in>
@ 2006-09-04 15:06 ` prakash
  2006-09-05 15:20   ` Michael Eager
  0 siblings, 1 reply; 2+ messages in thread
From: prakash @ 2006-09-04 15:06 UTC (permalink / raw)
  To: prakash; +Cc: crossgcc, gcc-help

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Statically linked GCC toolchain
  2006-09-04 15:06 ` Statically linked GCC toolchain prakash
@ 2006-09-05 15:20   ` Michael Eager
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Eager @ 2006-09-05 15:20 UTC (permalink / raw)
  To: prakash; +Cc: crossgcc, gcc-help

prakash wrote:

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

Follow the source:  :-)
Download the SRPM from RedHat and unpack it using the following:
   rpm -i gcc-<whatever>.src.rpm
This will put several files in /usr/src/redhat/{SPECS,SOURCES/
Take a look at gcc.spec in the SPECS directory.  It will show
you in detail how RedHat builds gcc.  It's a bit complex, but
everything is there.

You can also re-build gcc using
"rpmbuild --rebuild gcc-<whatever>.src.rpm".

-- 
Michael Eager	 eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-09-05 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <44F9FFD6.6010903@persistent.co.in>
2006-09-04 15:06 ` Statically linked GCC toolchain prakash
2006-09-05 15:20   ` Michael Eager

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).