bug-libtool
[Top][All Lists]
Advanced

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

install library path impact on project tests


From: Roumen Petrov
Subject: install library path impact on project tests
Date: Thu, 24 Dec 2009 18:16:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.6) Gecko/20091218 SeaMonkey/2.0.1

Hi All,

The described in this mail issue is inspired from following application build and tests.
- cross build environment, build on linux, hosts linux and mingw32.
- libxml build from trunk source. last stable installed in location {PREFIX}. Build system use libtool < 2.0 and pkg-config for dependent libraries. - libxslt build from trunk source with flags to use libxml from above build tree. Last stable installed in location {PREFIX}. build system use libtool < 2.0 pkg-config for dependent libraries. - xmlsec build from trunk source with flags to use libxml and libxslt from above build trees. Last stable installed in location {PREFIX}. Build system use libtool 2.2.6.

In above build environment xmlsec tests (make check) fail as incorrect libraries from installed location are used.

Initially I guess that problem is with order of dependent libraries but all -L flags first list build directory and after this installation directory .


The attached test case (added to cwrapper.at) show problem with a single library and application when library is already installed (attached as compressed file "libtool-origin-cwrapper.patch.gz").

In the test case m1 executable pass the tests on linux and mingw host.
The executable m2 pass on linux but fail on mingw.
The difference is -L{install_path} at the end of libtool link command.


For mingw host:
1) part of libtool source for first test :
=== lt-m1.c ===
...
const char * LIB_PATH_VALUE   = "Z:\\{TST048DIR}\\foo\\.libs;";
...
const char * EXE_PATH_VALUE = "Z:\\opt\\mingw\\lib;Z:\\opt\\mingw\\bin;Z:\\{TST048DIR}\\foo\\.libs;Z:\\{TST048DIR}\\inst\\lib;Z:\\{TST048DIR}\\inst\\bin;";
...
------

2) libtool C source file for second test:
=== lt-m2.c ===
...
const char * LIB_PATH_VALUE   = "Z:\\{TST048DIR}\\foo\\.libs;";
...
const char * EXE_PATH_VALUE = "Z:\\opt\\mingw\\lib;Z:\\opt\\mingw\\bin;Z:\\{TST048DIR}\\inst\\lib;Z:\\{TST048DIR}\\inst\\bin;Z:\\{TST048DIR}\\foo\\.libs;";
...
------

The test for mingw host is build with LDFLAGS set to -L/opt/mingw/lib ( to find libz required for one of the libtool tests - this is other issue may be out of scope of this report.


The simple fix is in cwrapper to change order of export to PATH environment variable : first to prepend EXE_PATH_VALUE and after this LIB_PATH_VALUE. This will resolve issue even if LDFLAGS contain library path to installed location.
I'm not sure that this is right solution.
May be problem is with order of library path ?


Linux is not impacted as m1 is linked with "-Wl,-rpath -Wl,XXX/foo/.libs -Wl,-rpath -Wl,XXX/inst/lib", m2 with "-LXXX/inst/lib -Wl,-rpath -Wl,XXX/foo/.libs -Wl,-rpath -Wl,XXX/inst/lib" and in both executables RPATH is set to "XXX/foo/.libs:XXX/inst/lib", i.e path to correct library is hard coded into binaries.


Roumen


P.S.
"cwrapper and installed shared libraries" test output for mingw host (note {SRCDIR}, {BLDDIR} and {TST048DIR} replace real very long paths) :
============================================
abs_srcdir=`CDPATH="${ZSH_VERSION+.}:" && cd {SRCDIR} && pwd`; cd tests; \
        CONFIG_SHELL="/bin/sh" /bin/sh $abs_srcdir/tests/testsuite \
MAKE="make" CC="i386-mingw32msvc-gcc" CFLAGS="-O2 -fno-strict-aliasing -Wall" CPP="i386-mingw32msvc-gcc -E" CPPFLAGS="" LD=".../bin/ld" LDFLAGS="-L/opt/mingw/lib" LIBS="" LN_S="ln -s" NM=".../i386-mingw32msvc-nm -B" RANLIB="i386-mingw32msvc-ranlib" STRIP="i386-mingw32msvc-strip" lt_INSTALL="/usr/bin/ginstall -c" OBJEXT="o" EXEEXT=".exe" SHELL="/bin/sh" CONFIG_SHELL="/bin/sh" CXX="i386-mingw32msvc-g++" CXXFLAGS="-O2 -fno-strict-aliasing -Wall" CXXCPP="i386-mingw32msvc-g++ -E" F77="i386-mingw32msvc-g77" FFLAGS="-g -O2" FC="i386-mingw32msvc-g77" FCFLAGS="-g -O2" GCJ="i386-mingw32msvc-gcj" GCJFLAGS="-g -O2" _lt_pkgdatadir="{SRCDIR}" LIBTOOLIZE="{BLDDIR}/libtoolize" LIBTOOL="{BLDDIR}/libtool" tst_aclocaldir="{SRCDIR}/libltdl/m4" -e -v 48
## -------------------------- ##
## libtool 2.2.7a test suite. ##
## -------------------------- ##
48. cwrapper.at:85: testing ...
{SRCDIR}/tests/cwrapper.at:89: $LIBTOOL --features | grep 'disable shared libraries' && exit 77
stdout:
libtool: compile: i386-mingw32msvc-gcc -O2 -fno-strict-aliasing -Wall -c a.c -DDLL_EXPORT -DPIC -o .libs/a.o libtool: compile: i386-mingw32msvc-gcc -O2 -fno-strict-aliasing -Wall -c a.c -o a.o >/dev/null 2>&1 libtool: link: i386-mingw32msvc-gcc -shared .libs/a.o -L/opt/mingw/lib -o .libs/liba-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/liba.dll.a
Creating library file: .libs/liba.dll.a
libtool: link: i386-mingw32msvc-ar cru .libs/liba.a  a.o
libtool: link: i386-mingw32msvc-ranlib .libs/liba.a
libtool: link: ( cd ".libs" && rm -f "liba.la" && ln -s "../liba.la" "liba.la" ) libtool: install: /usr/bin/ginstall -c .libs/liba.dll.a {TST048DIR}/inst/lib/liba.dll.a
libtool: install: inst_destdir=
libtool: install: dlbindir=../bin
libtool: install: base_file=`basename liba.la`
libtool: install: dlpath=`/bin/sh 2>&1 -c '. .libs/'liba.la'i; echo liba-0.dll'`
libtool: install:  dldir=`dirname ../bin/liba-0.dll`
libtool: install: case ../bin in /*) dldir=../bin;; *) dldir={TST048DIR}/inst/lib/../bin;; esac libtool: install: test -d {TST048DIR}/inst/lib/../bin || mkdir -p {TST048DIR}/inst/lib/../bin libtool: install: /usr/bin/ginstall -c .libs/liba-0.dll {TST048DIR}/inst/lib/../bin/liba-0.dll
libtool: install:  chmod a+x {TST048DIR}/inst/lib/../bin/liba-0.dll
libtool: install: if test -n '' && test -n 'i386-mingw32msvc-strip --strip-unneeded'; then eval 'i386-mingw32msvc-strip --strip-unneeded {TST048DIR}/inst/lib/../bin/liba-0.dll' || exit 0; fi libtool: install: /usr/bin/ginstall -c .libs/liba.lai {TST048DIR}/inst/lib/liba.la libtool: install: /usr/bin/ginstall -c .libs/liba.a {TST048DIR}/inst/lib/liba.a
libtool: install: chmod 644 {TST048DIR}/inst/lib/liba.a
libtool: install: i386-mingw32msvc-ranlib {TST048DIR}/inst/lib/liba.a
----------------------------------------------------------------------
Libraries have been installed in:
   {TST048DIR}/inst/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-LLIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
libtool: compile: i386-mingw32msvc-gcc -O2 -fno-strict-aliasing -Wall -c a.c -DDLL_EXPORT -DPIC -o .libs/a.o libtool: compile: i386-mingw32msvc-gcc -O2 -fno-strict-aliasing -Wall -c a.c -o a.o >/dev/null 2>&1 libtool: link: rm -fr .libs/liba.a .libs/liba.dll.a .libs/liba.la .libs/liba.lai libtool: link: i386-mingw32msvc-gcc -shared .libs/a.o -L/opt/mingw/lib -o .libs/liba-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/liba.dll.a
Creating library file: .libs/liba.dll.a
libtool: link: i386-mingw32msvc-ar cru .libs/liba.a  a.o
libtool: link: i386-mingw32msvc-ranlib .libs/liba.a
libtool: link: ( cd ".libs" && rm -f "liba.la" && ln -s "../liba.la" "liba.la" ) libtool: compile: i386-mingw32msvc-gcc -O2 -fno-strict-aliasing -Wall -c m.c -DDLL_EXPORT -DPIC -o .libs/m.o libtool: compile: i386-mingw32msvc-gcc -O2 -fno-strict-aliasing -Wall -c m.c -o m.o >/dev/null 2>&1 libtool: link: i386-mingw32msvc-gcc -O2 -fno-strict-aliasing -Wall -o .libs/m1.exe m.o -L/opt/mingw/lib foo/.libs/liba.dll.a -L{TST048DIR}/inst/lib {SRCDIR}/tests/cwrapper.at:148: if "$lt_exe" ; then :; else lt_status=$?; test $lt_status != 0 && test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; exit $lt_status; fi
stderr:
stdout:
libtool: link: i386-mingw32msvc-gcc -O2 -fno-strict-aliasing -Wall -o .libs/m2.exe m.o -L/opt/mingw/lib foo/.libs/liba.dll.a -L{TST048DIR}/inst/lib -L{TST048DIR}/inst/lib {SRCDIR}/tests/cwrapper.at:151: if "$lt_exe" ; then :; else lt_status=$?; test $lt_status != 0 && test "X$host" != "X$build" && test -x "$lt_exe" && exit 77; exit $lt_status; fi
stderr:
stdout:
48. cwrapper.at:85:  skipped (cwrapper.at:151)

## ------------- ##
## Test results. ##
## ------------- ##

0 tests were successful.
1 test was skipped.
============================================

Attachment: libtool-origin-cwrapper.patch.gz
Description: GNU Zip compressed data


reply via email to

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