[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Libtool fails to build working binary when -no-install is used
From: |
Simon Josefsson |
Subject: |
Libtool fails to build working binary when -no-install is used |
Date: |
Thu, 29 Mar 2007 12:17:32 +0200 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.95 (gnu/linux) |
Hi! I'm tracking down what I believe is a libtool bug, or possibly a
libtool documentation issue. In libssh2, a shared library, we have a
"hello world" kind of self test that just invokes the library
init/done function. The self test is linked to libssh2. The
Makefile.am to build it is:
AM_CPPFLAGS = -I$(top_srcdir)/include
AM_LDFLAGS = -no-install
LDADD = ../src/libssh2.la
ctests = simple
TESTS = $(ctests)
check_PROGRAMS = $(ctests)
Building this on Mac OS X fails to produce a binary 'simple' that
works. It fails to run because it cannot find the shared library.
The relevant output is:
make[2]: Nothing to be done for `check-am'.
making check in tests
make simple
gcc -DHAVE_CONFIG_H -I. -I../src -I../include -DLIBSSH2_DARWIN -I/
usr/include -I/usr/include -MT simple.o -MD -MP -MF .deps/simple.Tpo -
c -o simple.o simple.c
mv -f .deps/simple.Tpo .deps/simple.Po
/bin/sh ../libtool --tag=CC --mode=link gcc -DLIBSSH2_DARWIN -I/
usr/include -I/usr/include -no-install -L/usr/lib -lcrypto -L/usr/lib
-lz -o simple simple.o ../src/libssh2.la
mkdir .libs
gcc -DLIBSSH2_DARWIN -I/usr/include -I/usr/include -o simple
simple.o -L/usr/lib ../src/.libs/libssh2.dylib -lcrypto -lz
make check-TESTS
dyld: Library not loaded: /usr/local/lib/libssh2.1.dylib
Referenced from: /Users/daniel/Desktop/libssh2/tests/./simple
Reason: image not found
FAIL: simple
The documentation for -no-install is:
`-no-install'
Link an executable OUTPUT-FILE that can't be installed and
therefore doesn't need a wrapper script. Useful if the program is
only used in the build tree, e.g., for testing or generating other
files.
I believe that -no-install should have added a '-Wl,-rpath
../src/.libs/' to the gcc command when building 'simple'. Then the
binary would have found its shared library. Such a binary should not
be installed, with the library paths to the build tree in it, but
that's the point of -no-install.
See the original report in:
http://article.gmane.org/gmane.network.ssh.libssh2.devel/221
The libtool version used is 1.5.22.
Thanks,
Simon
- Libtool fails to build working binary when -no-install is used,
Simon Josefsson <=