comp.lang.ada
 help / color / mirror / Atom feed
From: Markus Schoepflin <nospam@no.spam>
Subject: Static linking
Date: Fri, 07 Aug 2009 09:54:00 +0200
Date: 2009-08-07T09:54:00+02:00	[thread overview]
Message-ID: <h5gmio$i2r$1@nntp.ilk.net> (raw)

Hello,

up to now (gcc-4.3.x) we have been happily using 'gnatmake ... -largs 
-static' to create statically linked executable. This has stopped working 
with 4.4:

 > touch foo.adb && gnatmake foo -largs -static
gcc-4.4 -c foo.adb
gnatbind -x foo.ali
gnatlink foo.ali -static
/usr/bin/ld: cannot find -lgnat-4.4
collect2: ld returned 1 exit status
gnatlink: error when calling /usr/bin/gcc-4.4
gnatmake: *** link failed.

Now I have been told that -static is a binder, not a linker argument, and 
indeed this works:

 > touch foo.adb && gnatmake foo -bargs -static
gcc-4.4 -c foo.adb
gnatbind -static -x foo.ali
gnatlink foo.ali

But this is not a static executable:

 > ldd foo
	linux-gate.so.1 =>  (0xb7f9e000)
	libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7e2d000)
	/lib/ld-linux.so.2 (0xb7f9f000)

Looking at the manual for the binder I'm told: '-static Link against a 
static GNAT run time.'. OK, so this works as advertised, no dynamic GNAT 
runtime used.

Now what is the correct way to created a static executable? This seems to 
work, but is it correct?

 > touch foo.adb && gnatmake foo -bargs -static -largs -static
gcc-4.4 -c foo.adb
gnatbind -static -x foo.ali
gnatlink foo.ali -static
 > ldd foo
	not a dynamic executable

And why did only passing '-largs -static' work for gcc-3.3.x?

Markus



             reply	other threads:[~2009-08-07  7:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07  7:54 Markus Schoepflin [this message]
2009-08-07 10:15 ` Static linking Ludovic Brenta
2009-08-07 10:46   ` Markus Schoepflin
2009-08-12 14:20 ` Alex R. Mosteo
  -- strict thread matches above, loose matches on Subject: below --
2014-10-04  1:19 static linking agent
2014-10-04  7:21 ` Simon Wright
2014-10-04 18:10   ` agent
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox