Linking libtool created .la to shared library .dylib

Jacob Barthelmeh <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
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
[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-----

iQIcBAEBCgAGBQJWE+8oAAoJED3Mz1UGLKftgukP/1/CBnjrrgBYIEzGVql4gfKp
zynBNCi+UeDnWA218LOXR7DHNc49/LAZqnHxkINtkSqJJrRu4FKO/U+rLRHQdwDA
UDzQKsg/wR8bgnd8kZ8xSA5pxNCo+kdF+T+zee7SVMkdmTWbmj8HMu98sE0Ex1C9
VqGe9SWVD9akgmR68lmar38CG8ykJgX4dW8jPhvWYWCkOgJtf4aeYql2UaxCklOD
8lGjEx/KNiwW8eZmtCPsvXfn5wJ/SHMebOcLlds9+ePitKCZSKo4XL0fkLpA2jxJ
m6nQDBaOIJtDx0ibaXexslTiEqLkWPCVjR3YgwXN36JpCH7AI/4HGUKtjdq0zgfW
eob3+VLj8GTKTqbtuXgEm7wOiMGh+G7eDYMkqSqO8tkIpssR/LNaBBSvYD+ZWJZy
o7KPTK2/kSJ8OEzkFUQ+NvpQzu2Gx8itEFxfOfNh92Zstcgj64Mpt1KO65Jv5qp+
UHvs/UpULzIFKW0bfvsIPSok4UjJyGnakl5IfVhFpvcdb3FM+qpPINRGby8LZbpw
eIpC3cXE1bsG91K84oR4rf1cxwD33m7cK0HdIYj+CR7onuG7i0CtGMOYabJpCxb5
zuMSPLbwi9/EB35+Ee5b4n6G8F8YdvquCmle7S7fq53GeT/N6Z9oDyGs4paTSLmh
DC0aZsKh2zlgVEpR/x2T
=mJ6P
-----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.