[Top][All Lists]

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

incorrect LD_LIBRARY_PATH for binary wrapper script using non-recursive

From: Marcel Martin
Subject: incorrect LD_LIBRARY_PATH for binary wrapper script using non-recursive make
Date: Tue, 06 Sep 2005 01:54:20 +0200
User-agent: KMail/1.8.2

I'm using libtool 1.5.18 on Solaris 9 and I've encountered what seems to be a 
bug in libtool's wrapper script for uninstalled programs. It sets an 
incorrect LD_LIBRARY_PATH so the programs won't run.

I've converted my entire project to use just one Makefile.am (read "Recursive 
Make Considered Harmful" by Peter Miller available at 
http://aegis.sourceforge.net/auug97.pdf if you want to know why).

Since the source code of the project is of course still in subdirectories, I 
need to specify paths relative to the root directory of the project within 
lib_LTLIBRARIES = src/libmylib.la
src_libmylib_la_SOURCES = src/calculator.cpp

The only program is a unit test located in a tests/ subdirectory:
check_PROGRAMS = tests/mytestprog
tests_mytestprog_SOURCES = tests/calculatortest.cpp
tests_mytestprog_LDADD = src/libmylib.la

The library and "mytestprog" compile and link fine (I use "make check" for 
that). However, I can't run "mytestprog":
make  check-TESTS
make[1]: Entering directory `/homes/mmartin/mylib'
ld.so.1: /homes/mmartin/mylib/tests/.libs/mytestprog: fatal: libmylib.so.0: 
open failed: No such file or directory

(/homes/mmartin/mylib/ is the project directory)
Adding an appropriate "echo" to the wrapper script tests/mytestprog told me 
that it sets LD_LIBRARY_PATH to /homes/mmartin/mylib/tests/src/.libs, which 
is not correct because the library is in /homes/mmartin/mylib/src/.libs/.

My experience with libtool is limited so I don't know if I'm perhaps using it 
incorrectly. I have the problem with Solaris 9 on both x86 and SPARC, it 
works on GNU/Linux (x86), however.

I've prepared a minimal example exhibiting the error, it's available at

Thanks for any help,

$ libtool --version
ltmain.sh (GNU libtool) 1.5.18 (1.1220.2.245 2005/05/16 08:55:27)

=========== Makefile.am ========
AUTOMAKE_OPTIONS = foreign 1.8

lib_LTLIBRARIES = src/libmylib.la
src_libmylib_la_SOURCES = src/calculator.cpp
src_libmylib_la_LDFLAGS = -no-undefined -version-info 0:0:0

pkginclude_HEADERS = src/calculator.h

TESTS = tests/mytestprog

tests_mytestprog_SOURCES = tests/calculatortest.cpp
tests_mytestprog_LDADD = src/libmylib.la

Attachment: pgpIjFD_Jp1Er.pgp
Description: PGP signature

reply via email to

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