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

Bug#167604: debian-policy: provides the exception of static libraries.



On Sat, Nov 16, 2002 at 12:34:43AM +0900, Akira TAGOH wrote:
> >>>>> On Fri, 15 Nov 2002 13:27:49 +0100,
> >>>>> "BA" == Bill Allombert <allomber@math.u-bordeaux.fr> wrote:
> 
> >> Subject: debian-policy: provides the exception of static libraries.
> >> In Libraries section,
> >> 
> >> In general, libraries must have a shared version in the
> >> library package and a static version in the development
> >> package.
> >> 
> >> But, if libraries uses dlopen(3) internally, then some
> >> programs links the static version, it doesn't work
> >> correctly. because dlopen(3) doesn't try to resolve the
> >> symbols in the static-linked program. in most cases, the
> >> static version of such libraries is meaningless to be
> >> provided.
> 
> BA> You need to link your executable binary with -export-dynamic:
> BA> man ld:
> BA>        -export-dynamic
> BA>               When  creating  an ELF file, add all symbols to the
> BA>               dynamic symbol table.  Normally, the dynamic symbol
> BA>               table contains only symbols which are used by a dy?
> BA>               namic object.  This option is needed for some  uses
> BA>               of dlopen.
> 
> No, it doesn't help.
> try this case:

<snip>

You need the following patch to Makefile to fix this:
--- Makefile~	2002-11-17 05:26:45.000000000 +0000
+++ Makefile	2002-11-17 05:31:02.000000000 +0000
@@ -22,7 +22,7 @@
 	gcc -rdynamic -ldl -L. -lfoo -o $@ $<
 
 t-static: t.c libfoo.a
-	gcc -static -export-dynamic -o $@ $< -L. -lfoo -ldl
+	gcc -export-dynamic -o $@ $< -L. -Wl,-Bstatic -lfoo -ldl -Wl,-Bdynamic
 
 clean:
 	rm -f libfoo.so libfoo.a *.o t-shared t-static module.so

-export-dynamic does no good if you linked a static object; you want a
dynamic object with libfoo linked statically.

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ | Dept. of Computing,
 `. `'                          | Imperial College,
   `-             -><-          | London, UK

Attachment: pgpIyJSpD84b4.pgp
Description: PGP signature


Reply to: