[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Multiple definition of gnulib symbols
From: |
Simon Josefsson |
Subject: |
Multiple definition of gnulib symbols |
Date: |
Wed, 25 Apr 2007 23:36:42 +0200 |
I've received a report where building GNU SASL, linked to GnuTLS,
fails because both projects use gnulib. Errors look like:
/bin/bash ../libtool --tag=CC --mode=link gcc -Os -ffunction-
sections -fdata-sections -s -Wl,--gc-sections -static -o gsasl
gsasl.o gsasl_cmd.o imap.o smtp.o callbacks.o ../l
ib/src/libgsasl.la ../gl/libgl.la -L/usr/lib -lreadline -lncurses -L/
usr/lib -lgnutls -L/usr/lib -ltasn1 -L/usr/lib -lgcrypt -L/usr/lib -
lgpg-error -L/usr/lib -lz -L/usr/lib -lns
l -L/usr/lib -lintl -L/usr/lib -liconv -L/usr/lib -lc
mkdir .libs
gcc -Os -ffunction-sections -fdata-sections -s -Wl,--gc-sections -o
gsasl gsasl.o gsasl_cmd.o imap.o smtp.o callbacks.o ../lib/src/.libs/
libgsasl.a ../gl/.libs/libgl.a -L/usr/li
b -lreadline -lncurses /usr/lib/libgnutls.a /usr/lib/libtasn1.a /usr/
lib/libgcrypt.a /usr/lib/libgpg-error.a -lz -lnsl /usr/lib/libintl.a /
usr/lib/libiconv.a -lc
/usr/lib/libgnutls.a(gc-libgcrypt.o)(.text.gc_init+0x0): In function
`gc_init':
: multiple definition of `gc_init'
../lib/src/.libs/libgsasl.a(gc-gnulib.o)(.text.gc_init+0x0): first
defined here
/usr/lib/gcc/i686-pc-linux-gnu/3.4.6/../../../../i686-pc-linux-gnu/
bin/ld: Warning: size of symbol `gc_init' changed from 7 in ../lib/
src/.libs/libgsasl.a(gc-gnulib.o) to 64 in .
./lib/src/.libs/libgsasl.a(gc-gnulib.o)
Yes, he's building static libraries only, and linking everything
statically, and generally seems to have weird strange gcc flags.
My ld/ar-fu is not strong enough to know how to solve this problem.
Is this namespace conflict a real problem in the gnulib design, and
that the only reason we aren't seeing it more widely is that nobody
links things statically and/or use gnulib in that many libraries
yet? Or is there some libtool/ld/etc setting that gnulib or my
projects should use, to avoid causing this situation?
It seems clear that the problem is that both libgnutls and libgsasl
contains the same gnulib symbols.
One solution might be for gnulib-tool to change the namespace of all
gnulib functions to 'gnutls_*' and 'gsasl_*' respectively, when
importing them into each project. That seems somewhat ugly though.
/Simon
Re: Multiple definition of gnulib symbols, Simon Josefsson, 2007/04/26