public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* How to build stand-alone (statically linked) gcc?
@ 2015-07-31 19:17 David Kang
  2015-07-31 20:01 ` Tim Prince
  2015-08-03  7:42 ` AW: " Warlich, Christof
  0 siblings, 2 replies; 3+ messages in thread
From: David Kang @ 2015-07-31 19:17 UTC (permalink / raw)
  To: gcc-help


 Hi,

 I am building gcc as a cross compiler.
I'm building it on Ubuntu 14.04, but I want to use the gcc binaries on older CentOS machines.
So, far gcc complains that it cannot find proper glibc on the older CentOS machines.

gcc: /lib64/libc.so.6: version `GLIBC_2.8' not found (required by /tmp/gcc)
gcc: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /tmp/gcc)
gcc: /lib64/libc.so.6: version `GLIBC_2.11' not found (required by /tmp/gcc)

 Is there a way to build gcc itself such that gcc doesn't need dynamic library for maximum portability?
I'll appreciate any help.

 David


-- 
----------------------
Dr. Dong-In "David" Kang
Computer Scientist
USC/ISI

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

* Re: How to build stand-alone (statically linked) gcc?
  2015-07-31 19:17 How to build stand-alone (statically linked) gcc? David Kang
@ 2015-07-31 20:01 ` Tim Prince
  2015-08-03  7:42 ` AW: " Warlich, Christof
  1 sibling, 0 replies; 3+ messages in thread
From: Tim Prince @ 2015-07-31 20:01 UTC (permalink / raw)
  To: gcc-help



On 7/31/2015 3:17 PM, David Kang wrote:
>  I am building gcc as a cross compiler.
> I'm building it on Ubuntu 14.04, but I want to use the gcc binaries on older CentOS machines.
> So, far gcc complains that it cannot find proper glibc on the older CentOS machines.
>
> gcc: /lib64/libc.so.6: version `GLIBC_2.8' not found (required by /tmp/gcc)
> gcc: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /tmp/gcc)
> gcc: /lib64/libc.so.6: version `GLIBC_2.11' not found (required by /tmp/gcc)
>
>  Is there a way to build gcc itself such that gcc doesn't need dynamic library for maximum portability?
>
You may widen the range of supported dynamic glibc by building against
the oldest one you wish to support (within reason).
I wouldn't like to try supporting both CentOS and Ubuntu with the same
binary, given that the latter uses varying non-LSB schemes for managing
32- and 64-bit applications.

-- 
Tim Prince

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

* AW: How to build stand-alone (statically linked) gcc?
  2015-07-31 19:17 How to build stand-alone (statically linked) gcc? David Kang
  2015-07-31 20:01 ` Tim Prince
@ 2015-08-03  7:42 ` Warlich, Christof
  1 sibling, 0 replies; 3+ messages in thread
From: Warlich, Christof @ 2015-08-03  7:42 UTC (permalink / raw)
  To: David Kang, gcc-help

> Is there a way to build gcc itself such that gcc doesn't need dynamic library for maximum portability?

We have a similar setup here, using Ubuntu 14.04 to build our cross toolchains. To get statically linked
binaries, we had to add

CFLAGS+=-static LDFLAGS+=-static LIBTOOLFLAGS2+=-all-static

when calling "make" for binutils

and 

CFLAGS+=-static LDFLAGS+=-static

when calling "make" for gcc.

Optionally, i.e. if you also want a static gdb, you may add

LDFLAGS+=-static

when calling "make" for gdb.

Hope this helps, it does work fine here.

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

end of thread, other threads:[~2015-08-03  7:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-31 19:17 How to build stand-alone (statically linked) gcc? David Kang
2015-07-31 20:01 ` Tim Prince
2015-08-03  7:42 ` AW: " Warlich, Christof

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