Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <3EB9FD23.1050704@ece.gatech.edu> Date: Thu, 08 May 2003 02:45:55 -0400 From: Charles Wilson User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4a) Gecko/20030401 X-Accept-Language: en-us, en MIME-Version: 1.0 To: cygwin AT cygwin DOT com, libtool AT gnu DOT org Subject: libtool: make install DESTDIR + dependent shared libraries = relink problem Content-Type: multipart/mixed; boundary="------------000607070706020201070801" --------------000607070706020201070801 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit When using 'make install DESTDIR' to build an installable package (cygwin tarballs, linux rpm's, etc), dependent libraries get relinked against 'old' versions in and not against the 'new' version in /. See attached testcase, and problem description below. Any ideas on how this problem should be addressed -- other than 'Don't do that' ? --Chuck ------------------------------------------------------ Demonstrates the problems with dependent shared libraries and 'make install DESTDIR=...' on cygwin. This problem affects cygwin AND linux -- and I assume it affects most other unixes. To demonstrate the issue, we have two different "releases" of a package. This package contains two sharedlibs. This is obviously a contrived example, but the error HAS been observed 'in the wild' on cygwin: pcre-4.2. The 1.0.0 release of the package has the following version numbers for its libraries: libone: -version-info 1:0:1 libtwo: -version-info 2:0:1 libtwo depends on libone. On cygwin, this results in a 'DLLVER' of 'c' - 'a', or libone: cygone-0.dll libtwo: cygtwo-1.dll If you have questions about how -version-info works, and how it interacts with DLL versioning on cygwin, see this page: http://home.att.net/~perlspinr/libversioning.html The 1.0.1 release of the package has the following version numbers for its libraries: libone: -version-info 2:0:0 (*) libtwo: -version-info 2:1:1 (**) (*) We changed the API of libone (renamed some of its exported functions -- one_*_square() were renamed to one_*_SQR() ) so we increment 'c', reset 'a' to zero and leave 'r' at zero. (**) The API of libtwo doesn't change (it didn't happen to USE the functions in libone that got renamed), but its internal code did change. So, we increment 'r' but leave 'c' and 'a' alone. [If you're interested, the change was simply to modify the initial value of one_global_int_var. It was 22, it is now 33] Using the 'c' - 'a' formula, we have libone: cygone-2.dll libtwo: cygtwo-1.dll The problem manifests when version 1.0.0 has been installed, and we're trying to build version 1.0.1 using 'make install DESTDIR=' So, here's the test procedure: After unpacking, cd destdir-relinklib-demo-1.0.0 ./bootstrap ./configure --prefix=/usr make make install DESTDIR=`pwd`/inst So far, no problems. Now, you need write access to /usr/lib, /usr/include, and /usr/bin for the next step. make install which will install the following files (which probably won't conflict with anything on your system, but you might want to check, first) /usr/include/destdir-relinklib-demo/libone.h /usr/include/destdir-relinklib-demo/libtwo.h /usr/lib/libone.a /usr/lib/libtwo.a /usr/lib/libone.la /usr/lib/libtwo.la /usr/lib/libone.dll.a /usr/lib/libtwo.dll.a /usr/bin/cygone-0.dll /usr/bin/cygtwo-1.dll Okay, now it's time to build the 'next release' of destdir-relinklib-demo. So, cd ../destdir-relinklib-demo-1.0.1 ./bootstrap ./configure --prefix=/usr make Stop here. If you check in libtwo/.libs and use (on cygwin) 'cygcheck cygtwo-1.dll' -- or objdump libtwo*so* on other unixes -- you'll see that libtwo is indeed linked against THIS build of libone. In cygwin, that means cygtwo-1.dll depends on cygone-2.dll Now, do make install DESTDIR=`pwd`/inst Then, look once again in libtwo/.libs/ (or in inst/usr/[bin|lib]) and check the shared version of libtwo's dependencies. On cygwin, that means 'cygcheck cygtwo-1.dll' !!! It depends on cygone-0.dll, NOT cygone-2.dll. !!! That is, on relink, when doing a 'make install DESTDIR', the dependent library is linked against the dependee in /, not /! If you watch the 'make install DESTDIR' output carefully, you'll see the relink command for libtwo. On cygwin, it appears as: /bin/bash ../libtool --mode=install /usr/bin/install -c libtwo.la /usr/src/libtool/devel/DEMO/tmp/destdir-relinklib-demo-1.0.1/inst/usr/lib/libtwo.la libtool: install: warning: relinking `libtwo.la' (cd /usr/src/libtool/devel/DEMO/tmp/destdir-relinklib-demo-1.0.1/libtwo; /bin/bash ../libtool --mode=relink gcc -g -O2 -o libtwo.la -rpath /usr/lib -version-info 2:1:1 -no-undefined two.lo ../libone/libone.la -inst-prefix-dir /usr/src/libtool/devel/DEMO/tmp/destdir-relinklib-demo-1.0.1/inst) gcc -shared .libs/two.o -L/usr/lib -L/usr/src/libtool/devel/DEMO/tmp/destdir-relinklib-demo-1.0.1/inst/usr/lib -lone -o .libs/cygtwo-1.dll -Wl,--image-base=0x10000000 -Wl,--out-implib,.libs/libtwo.dll.a Info: resolving _one_global_int_var by linking to __imp__one_global_int_var (auto-import) Creating library file: .libs/libtwo.dll.a Here's the important bit: 'gcc -shared .libs/two.o -L/usr/lib -L/usr/lib -lone ...' That is, we use -lone to locate libone, and search -L/usr/lib FIRST. Now, this doesn't happen if you do a straight 'make install' -- because the dependee library (libone) does actually get installed into , overwriting the old one, before we try to relink libtwo. So, the relinked libtwo, in THAT case, gets the proper linkage against cygone-2.dll. Also, during the initial build of libtwo, we get the 'proper' linkage because during *build* phase (as opposed to relink phase), the link command is /bin/bash ../libtool --mode=link gcc -g -O2 -o libtwo.la -rpath /usr/lib -version-info 2:1:1 -no-undefined two.lo ../libone/libone.la gcc -shared .libs/two.o ../libone/.libs/libone.dll.a -o .libs/cygtwo-1.dll -Wl,--image-base=0x10000000 -Wl,--out-implib,.libs/libtwo.dll.a Info: resolving _one_global_int_var by linking to __imp__one_global_int_var (auto-import) Creating library file: .libs/libtwo.dll.a Here's the important bit from THAT command: 'gcc -shared .libs/two.o ../libone/.libs/libone.dll.a ...' That is, we use explicitly use ../libone/.libs/libone.dll.a to locate libone, and don't mess around with -Lthis -Lthat -lone. ------------------------------------------------------ Now, similar behavior occurs on linux: The offending relink command is libtool: install: warning: relinking `libtwo.la' (cd /home/cwilson/foo/destdir-relinklib-demo-1.0.1/libtwo; /bin/sh ../libtool --mode=relink gcc -g -O2 -o libtwo.la -rpath /usr/lib -version-info 2:1:1 -no-undefined two.lo ../libone/libone.la -inst-prefix-dir /home/cwilson/foo/destdir-relinklib-demo-1.0.1/inst) gcc -shared .libs/two.o -L/usr/lib -L/home/cwilson/foo/destdir-relinklib-demo-1.0.1/inst/usr/lib -lone -Wl,-soname -Wl,libtwo.so.1 -o .libs/libtwo.so.1.1.1 /usr/bin/install -c .libs/libtwo.so.1.1.1T /home/cwilson/foo/destdir-relinklib-demo-1.0.1/inst/usr/lib/libtwo.so.1.1.1 Complete with the 'bad' 'gcc -shared .libs/two.o -L/usr/lib -L/usr/lib -lone ...' (The rebuilt .so is in libtwo/.libs/libtwo.so.1.1.1T and in /usr/lib/, while the original .so is in libtwo/.libs/libtwo.so.1.1.1) objdump -p on the original libtwo.so.1.1.1 shows that it depends on libone.so.2 -- which is correct -- while the rebuilt libtwo (libtwo.so.1.1.1T) depends on libone.so.0 -- which is incorrect. ------------------------------------------------- --------------000607070706020201070801 Content-Type: application/x-bzip2; name="destdir-relink.tar.bz2" Content-Transfer-Encoding: base64 Content-Disposition: inline; filename="destdir-relink.tar.bz2" QlpoOTFBWSZTWTvLIVYADbF/5P34ggJ89///P+//+v////9ABAIAEAiIiGAVn3ubY1dbswAB WrZLa2jYMBAASyUAV3ZEqh0oVrRI2w0A0MiQADKjVH6pvVBj1INqaMmmQaANBoNGmQZAwTQY EGEYNQSmk0CBGmiZFPIFPSep+iJ6nplAAAGgAABkAAHDQDQAGgNAaAAABpo00AZAAANGmQYS aiiTST9FP1T0n6U9I081Rp+pD9ImnqYmIaAABtJo0aNMjQNNAcNANAAaA0BoAAAGmjTQBkAA A0aZBgqSICAI0E0GkxT0CajTTT000mR6E9RpoaekyekwmgAHqavqp+gFnm/QVZX9SfSwU/MY DE+16oj3ZFzkBxgBVCgZhKCDUgQJjqXJrdd3rxn55+dUrNKId5vDqlqAA4ATACkppJJRWRIc VqK04cikTkIrBJnCJNKsjozErsMB4wKVFIhUZSRRUi34D41JPOlKBtgfuJ6Ym6PdE3TETjPs MJ0O0erxdzp8Xrhh3c5XKqZ/Ij9vDDyTnMm5iaiEI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e6q9jBSwFmJSSlC lRZLFixSb4NY7VnUac0maKidTTIircs5fWyWcrZPUm3v45uxHww6CcHC+/j5mnh3tztOkv6B y41NbvG5xpiTabK4zJbqlkYvqweHFqfv1FabppvPgmsn1tycfgZkNqQMkSsdkkJoEhbGhlpq aNkcQMQSqSRWUDqosi8w2SO2SmIaGUhqa51haYeFsZ6W52NwZw5yVhP+afAqdtOiSNz03b6l VBgNJwcHpdV89iRbEuUUUUSioyKb09MFOWGyZsuTCzSpC+EWYBgQcooWORgeIvWqVpSlTqtN ymHU7zHezs6wLEhxyUkeJil5Bq5cxq5jjI9qfu3Z8odwYu5utUVJ0510rLDL1JPWdjBavdXT OPwc26j8nZIX2tH2fxe26MGy5DbXCQ0khwPOl0zOknLuHTC3GkGoN7BJF5XvcLV3owXxddqx qTrnC8y8WfDTcTNL4R7qsCUE6BjMmEEXk1JA4IGsebCT3i0UBA2UzHKlMrapK4QCCZIpvdGu mbNkGAl0uSTEjRSC9QTK0x/kY4z15t4lZ89bSj69z0UiqPPR78qSdbuyvM1aLct9W7XZ4Gc4 VI7B4pPi8xOp3474mmjfv31Ld+VupHLlfELuM8wrZSqPaKnUusJUslhGBcSyWLFkoaw4/VIb l0TgSWo1YTOQ9fhlzV7W9uYtvuSdmC+5M5wDqpzylUy2SQ+EHvX5FMhXF5Q06RJMY8e/uMY6 iVs2dzS+AdaFKUxGYsN6hhUeFrHUQ6Qzl46yEVOF/Di/wWtG6Uokx3HGyq4O696cq4Il9yO/ s1DawD2n/x9Rdl0WIpPDJEP/xdyRThQkDvLIVYA= --------------000607070706020201070801 Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --------------000607070706020201070801--