[Top][All Lists]

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

Re: inter-library-dependency, how?

From: Nick Bowler
Subject: Re: inter-library-dependency, how?
Date: Fri, 9 Sep 2011 12:01:52 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On 2011-09-09 17:56 +0200, Christian Rössel wrote:
> I want to build a program that depends on a libtool library that depends
> on a non-libtool library that needs rpath information to be found a runtime.
> My looks like this:
> lib_LTLIBRARIES    =
> libfoo_la_SOURCES  = libfoo.c  libfoo.h
> libfoo_la_CPPFLAGS = -I/opt/packages/papi/
> libfoo_la_LDFLAGS  = -L/opt/packages/papi/
> libfoo_la_LIBADD   = -lpapi
> bin_PROGRAMS = foo
> foo_SOURCES  = foo.c
> foo_LDADD    =
> Building and linking succeeds, but trying to run ./foo leads to
> ./foo: error while loading shared libraries: cannot open
> shared object file: No such file or directory
> The library is in the location specified by libfoo_la_LDFLAGS (.a and
> .so). But the rpath /opt/packages/papi/ is not available. How
> do I get it into foo without specifying it as
> foo_LDFLAGS = -Wl,-rpath /opt/packages/papi/

Looking at,

  -R libdir
      If output-file is a program, add libdir to its run-time path. If
      output-file is a library, add -Rlibdir to its dependency_libs, so
      that, whenever the library is linked into a program, libdir will
      be added to its run-time path.

So it seems that adding -R/opt/packages/papi/ to
libfoo_la_LDFLAGS would do the trick?

Nick Bowler, Elliptic Technologies (

reply via email to

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