[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
libtool does not create a shared library without -rpath option
From: |
Bruno Haible |
Subject: |
libtool does not create a shared library without -rpath option |
Date: |
Sun, 6 Apr 2008 18:10:04 +0200 |
User-agent: |
KMail/1.5.4 |
Hi,
This is common behaviour of libtool 2.2.2 and 1.5.26: "libtool --mode=link"
does not create a shared library, even when the user has explicitly asked
for a shared library. Unless a -rpath option has been given. Even worse: The
"libtool --mode=install" command fails in this case.
How to reproduce:
$ mkdir testdir
$ cd testdir
$ cat > configure.ac <<\EOF
PACKAGE=libiconv
VERSION=0
AC_INIT(configure.ac)
AC_CONFIG_AUX_DIR(build-aux)
AC_CONFIG_MACRO_DIR(m4)
AC_PROG_MAKE_SET
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_CANONICAL_HOST
AC_OBJEXT
AC_EXEEXT
LT_INIT
AC_OUTPUT
EOF
$ libtoolize -c -f -i -v
$ aclocal -I m4
$ autoconf
$ ./configure --disable-static --enable-shared
...
checking whether to build shared libraries... yes
checking whether to build static libraries... no
...
$ cat > hello.c <<\EOF
#include <stdio.h>
void hello() { printf("Hello world!\n"); }
EOF
$ ./libtool --mode=compile gcc -g -O2 -c hello.c -o hello.o
or
$ ./libtool --mode=compile gcc -g -O2 -c hello.c -o hello.lo
$ ./libtool --mode=link gcc -g -O2 -o libhello.la -no-undefined hello.lo
libtool: link: ar cru .libs/libhello.a .libs/hello.o
libtool: link: ranlib .libs/libhello.a
libtool: link: ( cd ".libs" && rm -f "libhello.la" && ln -s "../libhello.la"
"libhello.la" )
$ ./libtool --mode=install cp libhello.la /tmp/libhello.la
libtool: install: cp .libs/libhello.lai /tmp/libhello.la
cp: cannot stat `.libs/libhello.lai': No such file or directory
There are three problems here:
1) The doc says (in a footnote!) that "If you don't specify an `rpath', then
libtool builds a libtool convenience archive, not a shared library"
But heck, I want to create a shared object file, a .so file. Not a .la
file. LD_PRELOAD only works with .so files.
2) I configured with "--disable-static --enable-shared", to try to help
libtool know that I want a .so file. But in vain. Without -rpath, it
insists on creating .a files which I have explicitly not asked for!
3) The --mode=install step fails, and the error message is not helpful in
determining the remedy. IMO, in such a case, before libtool executes
the command "cp .libs/libhello.lai /tmp/libhello.la", it should verify
whether .libs/libhello.lai exists at all and either
- create .libs/libhello.lai now (thereby violating the GNU standards
which say that no write access to the build directory should be
required during "make install", but that's a different topic: libtool
already violates this part of the GNU standards)
or
- emit an error message like "library was created without -rpath option
and therefore cannot be installed".
Bruno
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- libtool does not create a shared library without -rpath option,
Bruno Haible <=