[Top][All Lists]

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

Re: inter-library-dependency, how?

From: Christian Rössel
Subject: Re: inter-library-dependency, how?
Date: Fri, 9 Sep 2011 20:40:05 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2

Hi Nick,

thanks for the quick response.

Am 09.09.2011 18:01, schrieb Nick Bowler:
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:
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?

Well, like the documentations says, -R/opt/packages/papi/ is
added to the dependency_libs:
dependency_libs=' -R/opt/packages/papi/
-L/opt/packages/papi/ -lpapi'

But when I link into foo, nothing is added to foo's runpath:
libtool: link: gcc -g -O2 -o foo foo.o  ./.libs/libfoo.a
-L/opt/packages/papi/ -lpapi

So, the problem remains. Any help appreciated.



Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzender des Aufsichtsrats: MinDirig Dr. Karl Eugen Huthmacher
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Karsten Beneke (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt

reply via email to

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