Re: Linking libtool created .la to shared library .dylib

Jacob Barthelmeh <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
Hi Robert,

Thanks for the response, both here and on stack overflow. That sounds right I’ll give it a try.

Regards,
Jacob

> On Oct 6, 2015, at 2:49 PM, Robert Boehne <[email protected]> wrote:
> 
> Because Libtool was not used to create libB.dylib, it does not know how to adjust the environment to find it.  You have to do that.
> You can put the path to libB in your environment, or you can add a flag to hard-code that path when libA.la is used.
> 
> Do that by adding an RPATH specification like this:
> 
> libA_la_LIBADD = $(LIBM) -Ldir/to/ -rpath dir/to/ -lB
> 
> Hope that solves your issue.
> 
> Robert Boehne
> 
> On Oct 6, 2015 3:39 PM, "Jacob Barthelmeh" <[email protected] <mailto:[email protected]>> wrote:
> Hello,
> 
> Am stumped on a link. Even after pouring over the manuals for hours and searching online it is probably a misunderstanding of autotools.
> 
> I have one .la library made by libtool, one .dylib shared library and am creating a program. The .la is linked to the .dylib and the program uses the .la.
> 
> Makefile.am for the .la library
> 
> lib_LTLIBRARIES = libA.la
> libA_la_LDFLAGS = ${AM_LDFLAGS} -no-undefined
> libA_la_LIBADD = $(LIBM) -Ldir/to/ -lB
> libA_la_CPPFLAGS = ${AM_CPPFLAGS}
> 
> Makefile.am for program with libtool wrapper
> 
> noinst_PROGRAMS = test
> test_SOURCES = test_source.c
> test_LDADD = libA.la -Ldir/to/ -lB
> 
> libA.la is created and links to B.dylib but the test program "wrapper" created by automake is exporting DYLD_LIBRARY_PATH to find libA.la while not linking to B.dylib. Giving the error
> 
> dyld: Library not loaded: ./B.dylib
>   Referenced from: /dir/to/test/.libs/test
>   Reason: image not found
> Trace/BPT trap: 5
> 
> Some things that I have tried are adding "-Ldir/to/ -lB" to test_LDFLAGS in addition to already being added in test_LDADD. And have tried setting test_LDFLAGS = -rpath -Ldir/to in the hopes that setting the runtime search path to the directory where B.dylib is would help.
> 
> If I manually export DYLD_LIBRARY_PATH to include /dir/to/B.dylib then the test program is able to run but I'm looking to have autotools take care of this rather than requiring someone to export a path before being able to run it. Any tips or ideas would be greatly appreciated.
> 
> Regards, Jacob
> 
> Jacob Barthelmeh
> www.wolfssl.com <http://www.wolfssl.com/>
> [email protected] <mailto:[email protected]>
> 406-231-1496 <tel:406-231-1496>
> Skype: jacob_bart
> 
> 
> 
> 
> _______________________________________________
> https://lists.gnu.org/mailman/listinfo/libtool <https://lists.gnu.org/mailman/listinfo/libtool>
> 

Jacob Barthelmeh
www.wolfssl.com
[email protected]
406-231-1496
Skype: jacob_bart

_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool
signature.asc (application/pgp-signature, 801 B)
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJWFES3AAoJED3Mz1UGLKftXccQAJJNmoagdNIHKE+h19q3B3Bv
sJf1GqD3Ns96YPU/wu6dRhUd0DjsKhONwfdLOuQZ2Ldc2mxfGQC+5hrUq8uaQEOm
L0tN9OwWyicTqrwmF26omBWxm90lfKHtKBj93iiuWF49LOc4iQgAXaT3LtnZ7HHs
M/49MrPogAiXvhh807uJNDofh/ebVwVAqgH9HogzA4ynCoMLiKFSCum5N+Q9KhnS
lUMS9rIA4CPPQQ9vjfY8ABXE9PwuC89OZQ7RqBn3BjfLFDi7rijtReLfhd9Vk/BM
kMFW9IbSErbzeT49YkJuzEhngUiUdy8kbq0c6vDN1vFGzD3ZLVs0tVdkbw7B1Tya
Vxw69HRdvGtGiM7WQeQouo1+7ftNC9RXv6wVkUlOgBwPBvSj0Cfmg6KTrEOBBcg0
P+tfBa6CATRMAPjwiSU/4xej6nYKKYzEJEYowZ0kBRi6PONLahnaZadqf+werjjZ
Kp7OBxY2zE/DuppRhZz4eF/a1JetWa1APyLwYaubgRD83hhqeucw5BJr0ekvS0Js
QyMjKxsGWhV8gGDDDq9mnVg7wRI5AEDkZOAJ6nIdF9Q/PYoDTcRG3svxO31H/jf9
wPfIUylZLEhEoZGiI4G0YBicoCGI9wHSr9YhNrcIGZbMGHqRaeujkJY+PbPJD/Dr
0/r+7Ed1znPeMSzimfJ3
=rsOF
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.