[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rpath configuration

From: Gary V. Vaughan
Subject: Re: rpath configuration
Date: Fri, 31 May 2013 09:57:42 +0700

Hi Bob,

On 31 May 2013, at 08:28, Bob Rossi <address@hidden> wrote:
> Ping.
> Is this the active libtool mailing list?

Yes it is.  If you don't get a reply it means that nobody who read your
request is confident about the right answer.

In my case, I only know just enough about C++ to avoid it at all costs,
which is why I didn't respond initially :)

> On Fri, May 24, 2013 at 07:15:50PM -0400, Bob Rossi wrote:
>> I'm building a program that links against boost with libtool.
>> The boost library is installed on the system and is a shared library.
>> When i run my program ./test_suite I get,
>> $ ./test_suite 
>> .../build/.libs/lt-test_suite: error while loading shared libraries: 
>> cannot open shared object file: No such file 
>> or directory
>> My Makefile looks like,
>> noinst_PROGRAMS += test_suite

To avoid building the test_suite unless invoked with `make check` you
can use:

  check_PROGRAMS += test_suite

>> test_suite_SOURCES = \
>>    src/progs/test_suite/fixture.cpp \
>>    src/progs/test_suite/main.cpp
>> test_suite_CPPFLAGS = \
>> test_suite_LDFLAGS = \
>> test_suite_LDADD = \
>>    @BOOST_LIBS@
>> Where the boost variables are,
>> BOOST_CPPFLAGS = -IBOOSTDIR/boost_1_53_0_prefix/include

Not literally -IBOOSTDIR I trust.  You probably need something more

  -I $(BOOSTDIR)/...

>> BOOST_LDFLAGS = -LBOOSTDIR/boost_1_53_0_prefix/lib


>> BOOST_LIBS = -lboost_filesystem -lboost_system
>> I have a few questions.
>> For linking against system libraries, is using LDFLAGS and LDADD
>> appropriate the way I have done it?

I don't see any reference to libtool or a libtool archive here, so how
does Automake know it should be linking with libtool in this case?

Unfortunately, some distributions remove the .la files from system
directories that libtool uses to figure out the correct linker
invocation.  If your system is missing files such as:


...then you have to force Automake to use libtool.  Check the Automake
manual for details of how to set test_suite_LINK appropriately.

Also, you need to add the CXX tag to LT_INIT to incorporate C++ settings
into your generated project libtool script, if you didn't do that

>> Is it my responsibility to add the -rpath libtool option to include
>> BOOSTDIR/boost_1_53_0_prefix/lib?

Libtool's -rpath option is for specifying the target library's install
destination, not for adding the location of deplibs.  Automake will set
-rpath for you, so there's almost never any need to specify it manually.

>> Should I be setting LD_LIBRARY_PATH when running from the build
>> directory?

No, libtool will take care of that (LD_LIBRARY_PATH is just one spelling
of that variable for linux and a few other Unices) automatically.

>> I notice that when I link against libtool created libraries in the
>> same Makefile I don't see this issue at all.

Is that because Automake can tell you want to link using libtool, but in
the case of the you paste above, Automake thinks you want to
link with g++?

Please show the output from running make to demonstrate what you are
actually seeing.

Gary V. Vaughan (gary AT gnu DOT org)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]