This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


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: statically linked gcc executables


On Jan 24, 2008 12:18 PM, Andrew Haley <aph@redhat.com> 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.

>
> The long answer:
>
> Usually, people who want to do this don't know what they're doing, and
> people who do know how to do it wouldn't consider doing it because
> they know all the problems it will cause.

Question: which kind of problems could happen if I build gcc without
architecture specific optimizations?

>
> When you build gcc you're building it for a specific host/target
> combination, and configure autodetects properties of both.  It doesn't
> usually make much sense to use a gcc that's been built for one host on
> a different host.

I'm working on applications which are data critical, so when I change
a library on the system there is the risk that results may be
different, so I create a repository with the critical libraries, and I
upgrade the libraries on repository only when it is needed and
independently from the system libraries (I do this in order to upgrade
the productivity tools and their related libraries without interacting
with the libraries linked by my application). Obviously when I change
the compiler I obtain different results on my applications, so my idea
is to create a "development package" which includes my critical
libraries and also the compiler in order to obtain the same result
(always using the same optimizations flags) on  my application also
when I'm compiling on different Linux installations.
I guess that the same gcc static binary (e.g. compiled for generic
i386 architecture) should give me the same output on different linux
environments running on i386 machines. Is there any reason for which
this might not be true?

>
> Sometimes, however, people build gcc on an old operating system
> version and it will run on a newer version.  That makes sense for
> cross-compilers, in particular.
>
> So, can I ask you what you are really trying to do?  Is it that you really need to run on some ancient Linux that really doesn't have
> ld-linux.so.2?

All the linux on which I run the applications do have  ld-linux.so.2,
but it is different from a glibc version to another. For example when
I use a different version of ld-linux.so.2 I obtain the following :

....
/home/test/svn/external-pkg/gcc_i386_march_pentium4/usr/libexec/gcc/i686-pc-linux-gnu/4.2.2/cc1plus:
relocation error:/home/test/svn/external-pkg/gcc_i386_march_pentium4/lib/libc.so.6:
symbol _dl_tls_get_addr_soft, version GLIBC_PRIVATE not defined in
file ld-linux.so.2 with link time reference

so I cannot use the same ld-linux.so.2 because they are different.

Thanks a lot for your help.
Angelo

>
> Andrew.
>
>


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