[Top][All Lists]

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

Bad -static and -dlopen interaction.

From: Peter Rosin
Subject: Bad -static and -dlopen interaction.
Date: Tue, 4 Sep 2007 00:03:15 +0200
User-agent: Mutt/1.5.12-2006-07-14


I am fooling around with the -dlopen option, trying to
fix some issues with a library that has a bunch of plugin

I stumbled across an issue best highlighted by the attached
script. The third link from the end fails for me.

Linking of bar-static fails since symbols are extracted
from libdep.a, but the link is later done against libdep.dll.a
(the import lib of the shared dll), which doesn't export the
"helper" symbol. At least not on my platform (cygwin).

I believe symbols should be extracted from the libs that
are later part of the actual link, no?

(side note: I would also like some flag during creation of which make the "-dlopen self" nonsence during link
 of the programs go away. Why doesn't libtool notice the
 dlopen variable in when it is linking the programs?
 To me, that seems to be the exact info needed. Or?)

Please enlighten me, am I doing something stupid? If so, what
is the recommended way to create a library with modules that
work both static and shared? Does libltdl somehow resolve this
-static issue?

I'm running my script from an empty directory,
that way it's easy to clean up and try again (after tinkering
with the script).

The output of the failing link of bar-static from a fairly
recent cvs libtool (GNU libtool 1.2504 2007/08/18 09:18:43) 2.1a
is inlined below and I have the same issue with (GNU libtool) 1.5.23a (1.1220.2.412 2006/10/13 14:13:30)

$LIBTOOL --mode=link --tag=CC $CC -o bar-static \
 bar.lo -dlopen self -static

libtool: link: rm -f .libs/bar-static.nm .libs/bar-static.nmS 
libtool: link: creating .libs/bar-staticS.c
libtool: link: generating symbol list for `bar-static.exe'
libtool: link: extracting global C symbols from 
libtool: link: extracting global C symbols from 
libtool: link: extracting global C symbols from 
libtool: link: (cd .libs && gcc -g -O2 -c -fno-builtin "bar-staticS.c")
libtool: link: rm -f ".libs/bar-staticS.c" ".libs/bar-static.nm" 
".libs/bar-static.nmS" ".libs/bar-static.nmT"
libtool: link: gcc -o bar-static.exe .libs/bar.o .libs/bar-static.def 
.libs/bar-staticS.o  -L/home/peda/src/example/build/inst 
/home/peda/src/example/build/.libs/module2.a ./.libs/libfoo.a  
-L/home/peda/src/example/build/inst -L/home/peda/src/example/build/inst
 undefined reference to `_helper'
collect2: ld returned 1 exit status
libtool: link: rm -f ".libs/bar-staticS.o"


Description: Bourne shell script

reply via email to

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