zlib-ada and linker option
Björn Persson
bjorn at xn--rombobjrn-67a.se
Sun Sep 23 19:30:13 UTC 2012
Pavel Zhukov wrote:
> I've been testing zlib-ada with test exaples as well as with aws. I've
> to add -lz options to gprbuild manually.
> I think the best way is adding Linker_Option to zlib_ada.gpr, isn't
> it?
That's odd, you shouldn't need to do that. libzlib_ada is supposed to be
linked to libz already, and I just verified that I can compile both AWS
and the examples without -lz.
If a program would call functions in Zlib directly, then it would need
to be linked with -lz, but programs (and libraries like AWS) that use
Zlib-Ada aren't supposed to call Zlib directly. They call subprograms in
Zlib-Ada, and those subprograms in turn call functions in Zlib. That is
after all the whole purpose of a binding.
If you run "readelf --dynamic /usr/lib*/libzlib_ada-1.4.so.0", do you
see a line saying "Shared library: [libz.so.1]"?
If you run "ldd /usr/lib*/libzlib_ada-1.4.so.0", does it resolve the
link to libz.so.1 successfully?
Have you ensured that the Zlib-Ada sources aren't in any of the source
directories? If they are, I suppose they'll get compiled in directly
instead of being linked in as a library, and then -lz will be required.
To link the test programs to the shared library you should first separate
them from the sources of the library itself. For AWS you need to delete
all the files that begin with "zlib" in the "include" directory.
Björn
More information about the Ada
mailing list