[gnutls-dev] Problem linking gnutls 1.0.16

Bob Friesenhahn bfriesen at simple.dallas.tx.us
Sat Jul 24 22:38:25 CEST 2004

On Sat, 24 Jul 2004, Nikos Mavroyanopoulos wrote:

> On Thursday 22 July 2004 04:07, Bob Friesenhahn wrote:
>> I am building gnutls and friends on a Solaris 9 system with gcc 3.4.1,
>> The whole process has been quite painful.  In some places I had to
>> edit Makefile.am files and add missing library dependencies.  It seems
>> that perhaps gnutls relies on some automatic library dependency
>> support provided by the OS.  I have installed libgpg-error-0.7,
>> libgcrypt-1.2.0, libtasn1-0.2.10, and opencdk-0.5.5.
>> I am now down to the final link stage but am stuck at the following
>> error.  Can someone please help?
> Could you send me the line that the final linking of libgnutls.so
> is done? It seems that some objects (such as lib/x509/rfc2818_hostname)
> do not get included. Have you used any configure options?

/bin/sh ../libtool --mode=link gcc-3.4.1  -O2 -D_REENTRANT 
-D_THREAD_SAFE -O2 -finline-functions -I/usr/local/include 
-I/usr/local/include  -L/usr/local/lib -R/usr/local/lib -o gnutls-serv 
serv-gaa.o serv.o common.o ../lib/libgnutls.la 
../libextra/libgnutls-extra.la -L/usr/local/lib -lgcrypt 
-L/usr/local/lib -lgpg-error -lz -lnsl -lsocket -L/usr/local/lib 
-lopencdk -L/usr/local/lib -lgcrypt -L/usr/local/lib -lgpg-error 
-L/usr/local/lib -ltasn1 -lz   -lz
gcc-3.4.1 -O2 -D_REENTRANT -D_THREAD_SAFE -O2 -finline-functions 
-I/usr/local/include -I/usr/local/include -o .libs/gnutls-serv 
serv-gaa.o serv.o common.o  -L/usr/local/lib ../lib/.libs/libgnutls 
/usr/local/lib/libopencdk.so /usr/local/lib/libgcrypt -lnsl -lsocket 
/usr/local/lib/libgpg-error.so /usr/local/lib/libintl.so 
/usr/local/lib/libiconv.so -lc /usr/local/lib/libtasn1.so -lz 
ld: warning: file 
/home/bfriesen/src/im/gnutls-1.0.16/lib/.libs/libgnutls: linked to 
../lib/.libs/libgnutls: attempted multiple inclusion of file
Undefined                       first referenced
  symbol                             in file
gnutls_x509_crt_check_hostname      common.o
gnutls_openpgp_key_to_xml           common.o
_gnutls_hostname_compare            ../libextra/.libs/libgnutls-extra
gnutls_x509_crt_to_xml              common.o
ld: fatal: Symbol referencing errors. No output written to 
collect2: ld returned 1 exit status
gmake[3]: *** [gnutls-serv] Error 1
gmake[3]: Leaving directory `/home/bfriesen/src/im/gnutls-1.0.16/src'
gmake[2]: *** [all-recursive] Error 1
gmake[2]: Leaving directory `/home/bfriesen/src/im/gnutls-1.0.16/src'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/home/bfriesen/src/im/gnutls-1.0.16'
gmake: *** [all] Error 2

>> /home/bfriesen/src/im/gnutls-1.0.16/lib/.libs/libgnutls: linked to
>> ../lib/.libs/libgnutls: attempted multiple inclusion of file
> It seems however that the library is created. Could you check
> the library (with nm) for the following symbols? Does the linking
> of other programs work?

Nm shows that lib/x509/.libs/libx509.a contains the symbols
gnutls_x509_crt_check_hostname, _gnutls_hostname_compare, and

If this library is used as a libtool convenience library, then it is
likely the problem is due due to multiple occurances of common.o in
the package:

blade:src/im/gnutls-1.0.16% find . -name 'common.o' -print

Objects from libtool convenience libraries are extracted to individual 
.o files prior to use so it is likely that this is why the linker 
fails to see the symbols (two common.o files in the same library, 

I did have to update a number of Makefile.am files in packages gnutils 
depends on since the library dependencies were sometimes not 
completely listed.  Apparently the Linux linker will silently insert 
library dependencies (recorded in the .so file), but this is not true 
of most platforms so it is necessary to tell libtool about all 
dependencies so they can be recorded in the .la file.

Bob Friesenhahn
bfriesen at simple.dallas.tx.us

More information about the Gnutls-devel mailing list