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" <ja...@wolfssl.com> 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 > ja...@wolfsssl.com > 406-231-1496 > Skype: jacob_bart > > > > > _______________________________________________ > https://lists.gnu.org/mailman/listinfo/libtool > >
_______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool