[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Relinking problem
From: |
Nick Hudson |
Subject: |
Relinking problem |
Date: |
Thu, 9 Oct 2003 09:29:52 +0100 |
User-agent: |
KMail/1.5.4 |
The problem I mentioned a week or so ago with relinking is caused by the
following situation:
$ mkdir tmp
$ cd tmp
$ mkdir inst
$ touch dummy.c
$
$ libtool --mode=compile cc -o dummy.o -c dummy.c
mkdir .libs
cc -c dummy.c -fPIC -DPIC -o .libs/dummy.o
cc -c dummy.c -o dummy.o >/dev/null 2>&1
$
$
$ libtool --mode=link cc -o libl1.la dummy.lo -rpath $(pwd)/inst/
cc -shared .libs/dummy.o -Wl,-soname -Wl,libl1.so.0 -o .libs/libl1.so.0.0
(cd .libs && rm -f libl1.so.0 && ln -s libl1.so.0.0 libl1.so.0)
(cd .libs && rm -f libl1.so && ln -s libl1.so.0.0 libl1.so)
(cd .libs && rm -f libl1.so && ln -s libl1.so.0.0 libl1.so)
ar cru .libs/libl1.a dummy.o
ranlib .libs/libl1.a
creating libl1.la
(cd .libs && rm -f libl1.la && ln -s ../libl1.la libl1.la)
$
$ # XXX Note trailing '/'
$ libtool --mode=link cc -o libl2.la dummy.lo libl1.la -rpath $(pwd)/inst/
cc -shared .libs/dummy.o -Wl,--rpath -Wl,/home/nick/tmp/.libs -Wl,--rpath
-Wl,/home/nick/tmp/inst/ ./.libs/libl1.so -Wl,-soname -Wl,libl2.so.0 -o
.libs/libl2.so.0.0
(cd .libs && rm -f libl2.so.0 && ln -s libl2.so.0.0 libl2.so.0)
(cd .libs && rm -f libl2.so && ln -s libl2.so.0.0 libl2.so)
(cd .libs && rm -f libl2.so && ln -s libl2.so.0.0 libl2.so)
ar cru .libs/libl2.a dummy.o
ranlib .libs/libl2.a
creating libl2.la
(cd .libs && rm -f libl2.la && ln -s ../libl2.la libl2.la)
$
$
$
$ libtool --mode=install install libl1.la $(pwd)/inst
install .libs/libl1.so.0.0 /home/nick/tmp/inst/libl1.so.0.0
(cd /home/nick/tmp/inst && rm -f libl1.so.0 && ln -s libl1.so.0.0 libl1.so.0)
(cd /home/nick/tmp/inst && rm -f libl1.so && ln -s libl1.so.0.0 libl1.so)
(cd /home/nick/tmp/inst && rm -f libl1.so && ln -s libl1.so.0.0 libl1.so)
install .libs/libl1.lai /home/nick/tmp/inst/libl1.la
install .libs/libl1.a /home/nick/tmp/inst/libl1.a
ranlib /home/nick/tmp/inst/libl1.a
chmod 644 /home/nick/tmp/inst/libl1.a
libtool: install: warning: remember to run `libtool --finish
/home/nick/tmp/inst/'
$
$ # XXX note no trailing '/'
$ libtool --mode=install install libl2.la $(pwd)/inst
libtool: install: error: cannot install `libl2.la' to a directory not ending in
/home/nick/tmp/inst/
$
The pathname passed with the rpath argument has to match the install
pathname. This is easily broken with a trailing '/' mismatch or any non-
canonical pathname.
If anyone has any bright ideas on a solution I'd be grateful. My first
thought was to do the
absdir=`cd "$dir" && pwd`
dance for both pathnames, but I'm not sure they are guaranteed to exist.
Nick
- Relinking problem,
Nick Hudson <=