Bug#493814: Dangling libgnat.so-4.3 links in adalib directory of gnat, no libgnat.so file
Hello Ludovic,
> Kay Hayen writes:
> > We are compiling software not necessarily with the system default
> > compiler, but based on PATH. For that purpose we figure out the
> > adalib directory of the used compiler, and link against libgnat.so
> > from there.
>
> Are you trying to set the LD_LIBRARY_PATH so the compiled program
> finds the library?
Not really, it is more like we are trying to find out which libgnat.so the
compiler uses, so we can include it and install it on systems where our
software will run.
The policy (for our software, it's obviously not universally advisable) is to
do static linking, primarily to to be able to update only one selected
binary.
But in this case we are making an exception: We have a Ada shared library that
is accessed with ctypes module from Python. I absolutely love the mix Ada and
Python, it is nice team. :-)
To make that work, we must build a shared library. On amd64 libgnat.a can't be
linked statically (it's not compiled without -fPIC, so it complains because
code linked in is not relocatable) so we want to do the next best thing, to
include the exact libgnat.so used by the compiler and then use
LD_LIBRARY_PATH to force its copy on the target system.
That's why /usr/lib/libgnat.so which is sufficient for 99% of the population
is not good enough for our case. I am not saying that is sane.
BTW: May I ask you? Is the inability of building a "statically linked shared
library" which was possible on gnat x86 (where -fPIC has no effect), is that
something that could be considered a bug? It certainly would be great for us
to be able to do that, because then only our "libhomebrew.so" would be
dynamic, but not reference any other shared library.
[ dangling libgnat.so links ]
> /usr/lib/gcc/x86_64-linux-gnu/4.3/rts-native/adalib/libgnat.a
>
> > For manually compiled gcc installations there is a libgnat.so in that
>
> directory.
>
> OK, I'll fix that. I have a couple other fixes in the pipeline, too,
> and I was planning to upload 4.3.1-2 next week anyway.
Thanks a lot, that's great. Let me thank you for the great quality
package. :-)
Yours,
Kay Hayen
Reply to: