From: Simon Wright <simon@pushface.org>
Subject: Re: Controlling the linking of shared libraries
Date: Sat, 23 Jul 2011 00:50:46 +0100
Date: 2011-07-23T00:50:46+01:00 [thread overview]
Message-ID: <m2y5zpzxgp.fsf@pushface.org> (raw)
In-Reply-To: 82tyae4ya8.fsf@stephe-leake.org
Stephen Leake <stephen_leake@stephe-leake.org> writes:
> Björn Persson <bjorn@xn--rombobjrn-67a.se> writes:
>
>> Does anyone know how to pass command line parameters to Gnatmake and
>> GPRbuild that they should forward to gcc when they invoke gcc as a
>> linker to build a shared library? -largs seems to be used only when a
>> program is linked. When a shared library is linked it seems to be
>> ignored.
>
> Read chapters 11.12 "GNAT Project Manager | Library Projects" and 19
> "GNAT and Libraries" of the GNAT User manual.
I did this and it took me a *long* time to see that you need
Linker'Linker_Options.
This is a subset of one I'm working on:
with "tash_options";
project Tashlib is
for Library_Name use "tash";
for Library_Kind use "static";
for Library_Dir use "lib";
for Source_Dirs use ("include");
for Externally_Built use "true";
package Linker is
for Linker_Options use Tash_Options.Library_Options;
end Linker;
end Tashlib;
and
project Tash_Options is
for Source_Dirs use ();
Library_Options :=
(
"-L/usr/lib",
"-ltk8.5",
"-ltcl8.5"
);
end Tash_Options;
The resulting link for a program using tashlib.gpr is
$ gnatmake -P tash_tests.gpr tashtest.adb
gnatbind -E -I- -x /Users/simon/sf/tcladashell/tests/.build/tashtest.ali
gnatlink /Users/simon/sf/tcladashell/tests/.build/tashtest.ali -g \
-L/Users/simon/sf/tcladashell/lib/ -ltash \ <<<<a
-Wl,-rpath,/opt/gcc-4.6.0......./4.6.0/adalib/ \
-L/usr/lib -ltk8.5 -ltcl8.5 \ <<<<b
-o /Users/simon/sf/tcladashell/tests/tashtest
where the part I've marked 'a' comes from the main part of tashlib.gpr
and the part marked 'b' comes from Tashlib.Linker'Linker_Options.
Note that this all works fine for static libraries, in spite of what you
might have expected from the documentation; the only thing missing is
that if you create a stand-alone library (SAL) the source files will be
copied to the right place, whereas for this static library I have to do
it in the Makefile.
next prev parent reply other threads:[~2011-07-22 23:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-21 18:01 Controlling the linking of shared libraries Björn Persson
2011-07-21 23:14 ` anon
2011-07-22 6:36 ` Stephen Leake
2011-07-22 23:50 ` Simon Wright [this message]
2011-07-24 11:08 ` Björn Persson
2011-07-24 18:03 ` anon
2011-07-24 19:07 ` Project file version: was " anon
2011-07-24 19:13 ` Simon Wright
2011-07-25 1:05 ` anon
2011-07-26 8:18 ` Björn Persson
2011-07-25 11:43 ` Stephen Leake
2011-07-25 12:06 ` Simon Wright
2011-07-25 12:29 ` Dmitry A. Kazakov
2011-07-26 8:19 ` Björn Persson
2011-07-28 10:18 ` Stephen Leake
2011-07-29 22:47 ` Vincent
2011-07-26 9:20 ` Vincent
2011-07-26 23:37 ` Björn Persson
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox