[Help-gnutls] Re: gnutls 2.3.4 doesn't copile using MinGW

Massimo Gaspari massimo.gaspari at alice.it
Tue Apr 15 23:40:07 CEST 2008


Simon Josefsson wrote:
>> /bin/sh ../libtool --tag=CC   --mode=link gcc -std=gnu99 -pipe
>> -I/usr/local/include -O2 -Wno-pointer-sign   -o gnutls-serv.exe
>> serv-gaa.o serv.o common.o select.o ../lib/libgnutls.la
>> -L/usr/local/lib -lgcrypt -lgpg-error  ../gl/libgnu.la -lws2_32
>> libtool: link: gcc -std=gnu99 -pipe -I/usr/local/include -O2
>> -Wno-pointer-sign -o gnutls-serv.exe serv-gaa.o serv.o common.o
>> select.o  ../lib/.libs/libgnutls.a -L/usr/local/lib
>> ../gl/.libs/libgnu.a /usr/local/lib/libgcrypt.a
>> /usr/local/lib/libgpg-error.a -lws2_32
>> C:/msys/1.0/local/lib/libgcrypt.a(libgcrypt_la-missing-string.o):missing-string.c:(.text+0x30):
>> multiple definition of `_vasprintf'
>> ../lib/.libs/libgnutls.a(vasprintf.o):vasprintf.c:(.text+0x0): first
>> defined here
>> collect2: ld returned 1 exit status
>> make[3]: *** [gnutls-serv.exe] Error 1
>> make[3]: Leaving directory `/home/Massimo/gnutls-2.3.4/src'
>> make[2]: *** [all-recursive] Error 1
>> make[2]: Leaving directory `/home/Massimo/gnutls-2.3.4/src'
>> make[1]: *** [all-recursive] Error 1
>> make[1]: Leaving directory `/home/Massimo/gnutls-2.3.4'
>> make: *** [all] Error 2
>>
>> This time "touch" can't help :-).
>>
>> Any other suggestion?
>>     
>
> Ouch, this isn't a fun problem. :-(
>
> I've known about this for some time, but don't know a good solution.
>
> The problem is that libgcrypt defines a 'vasprintf' function, and it is
> stored in the static library.
>
> GnuTLS also defines a 'vasprintf' function.
>
> When you use shared libraries, this isn't a problem because the
> namespaces won't collide, so the symbols will just be hidden.
>
> But with static libraries, both symbols are there, and they collide.
>
> The interesting thing is that my Windows builds (see
> <http://josefsson.org/gnutls4win/>) do not trigger this problem.  I
> build both shared and static libraries.  So maybe you could see if
> building shared libraries for some strange reason makes the static
> library link for you?
>
> I'm not sure what the best solution is.  Possibly 'vasprintf' shouldn't
> be exported, but with static libraries, I don't think that is possible.
> All symbols used are exported.  So maybe the symbol needs to be renamed.
>
> This is a general problem with linking multiple libraries that use
> modules from gnulib, so I should bring this up on the gnulib list.
>
>   

Wouldn't it be better to use the symbol gnutls_vasprintf in GnuTLS? 
There are few files using that symbol, stdio.h.in and three .c file, 
it's easy to do it. Is there any issue to do that?
That may solve the problem. I'll try to do it.
>>  Nevertheless during compilation I got the followin warnings
>>
>> libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H
>> -I. -I../.. -I../../lgl -I../../lgl -I../../libextra
>> -I../../lib/minitasn1 -I../../libextra/openpgp/
>> -I../../libextra/opencdk -I../../lib -I../../includes -I../../includes
>> -I/usr/local/include -pipe -I/usr/local/include -O2 -Wno-pointer-sign
>> -MT x509.lo -MD -MP -MF .deps/x509.Tpo -c x509.c -o x509.o
>> x509.c: In function '_gnutls_x509_crt_cpy':
>> x509.c:95: warning: implicit declaration of function 'alloca'
>> x509.c:95: warning: incompatible implicit declaration of built-in
>> function 'alloca'
>> x509.c: In function 'gnutls_x509_crt_get_fingerprint':
>> x509.c:1965: warning: incompatible implicit declaration of built-in
>> function 'alloca'
>> x509.c: In function 'gnutls_x509_crt_get_key_id':
>> x509.c:2160: warning: incompatible implicit declaration of built-in
>> function 'alloca'
>> mv -f .deps/x509.Tpo .deps/x509.Plo
>>
>>
>> The same warning is present for other files as well. Do you need a
>> full list?
>>     
>
> No, that error is sufficient for me.
>
> Does your system have alloca.h?  What does ./configure say about alloca?
>   

No MinGW hasn't the alloca.h. The configure script gave me the following 
messages

checking alloca.h usability... no
checking alloca.h presence... no
checking for alloca.h... no

and

checking for working alloca.h... no
checking for alloca... yes

and I got

#define HAVE_ALLOCA 1

in config.h. I found definition for alloca in malloc.h (MinGW include file).

Ok I added gnutls_ and edit config.h after the configure step using
#define HAVE_ALLOCA 0
#define HAVE_ALLOCA_H 0

and I did "make". Both issues seems disappeared (I got the  warning

libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I.. -I../intl 
-I/usr/local/include -pipe -I/usr/local/include -O2 -Wno-pointer-sign 
-MT asprintf.lo -MD -MP -MF .deps/asprintf.Tpo -c asprintf.c -o asprintf.o
asprintf.c: In function 'asprintf':
asprintf.c:36: warning: implicit declaration of function 'gnutls_vasprintf'

but this can be fixed later.)

But now I have a new issue!!

/bin/sh ../../libtool --tag=CC   --mode=link gcc -std=gnu99 -pipe 
-I/usr/local/include -O2 -Wno-pointer-sign -no-install  -o 
ex-client2.exe ex-client2.o libexamples.la ../../gl/libgnu.la 
../../lib/libgnutls.la ../../libextra/libgnutls-extra.la -lws2_32
libtool: link: warning: `-no-install' is ignored for i686-pc-mingw32
libtool: link: warning: assuming `-no-fast-install' instead
libtool: link: gcc -std=gnu99 -pipe -I/usr/local/include -O2 
-Wno-pointer-sign -o ex-client2.exe ex-client2.o  ./.libs/libexamples.a 
../../gl/.libs/libgnu.a -L/usr/local/lib ../../lib/.libs/libgnutls.a 
../../libextra/.libs/libgnutls-extra.a 
/home/Massimo/gnutls-2.3.5/lib/.libs/libgnutls.a -lz 
/usr/local/lib/libgcrypt.a /usr/local/lib/libgpg-error.a -lws2_32
../../lib/.libs/libgnutls.a(stream.o):stream.c:(.text+0xb7a): undefined 
reference to `_rpl_fseeko'
../../lib/.libs/libgnutls.a(armor.o):armor.c:(.text+0x7a2): undefined 
reference to `_rpl_fseeko'
collect2: ld returned 1 exit status
make[4]: *** [ex-client2.exe] Error 1
make[4]: Leaving directory `/home/Massimo/gnutls-2.3.5/doc/examples'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/Massimo/gnutls-2.3.5/doc'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/Massimo/gnutls-2.3.5/doc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Massimo/gnutls-2.3.5'
make: *** [all] Error 2

Compiling the example I think the oder of libs is wrong. libgnu.a (that 
contains the missed symbols) should be the latest.

I edited the Makefile in doc/example changing

LIBS =  -lws2_32

to

LIBS =  -lws2_32 ../../gl/.libs/libgnu.a


and this issue disappeared.

But now I got another one!!!

rm -rf $backupdir; exit $rc
gnutls.texi:429: @image file `gnutls-internals.txt' (for text) 
unreadable: No such file or directory.
gnutls.texi:593: @image file `gnutls-layers.txt' (for text) unreadable: 
No such file or directory.
gnutls.texi:1523: Unknown command `headitem'.
gnutls.texi:1633: @image file `gnutls-x509.txt' (for text) unreadable: 
No such file or directory.
gnutls.texi:1867: @image file `gnutls-pgp.txt' (for text) unreadable: No 
such file or directory.
./signatures.texi:14: Unknown command `euro'.
./signatures.texi:14: Misplaced {.
./signatures.texi:14: Misplaced }.
./signatures.texi:15: Unknown command `euro'.
./signatures.texi:15: Misplaced {.
./signatures.texi:15: Misplaced }.
gnutls.texi:3469: @image file `gnutls-client-server-use-case.txt' (for 
text) unreadable: No such file or directory.
gnutls.texi:3475: @image file `gnutls-objects.txt' (for text) 
unreadable: No such file or directory.
gnutls.texi:3483: @image file `gnutls-handshake-state.txt' (for text) 
unreadable: No such file or directory.
gnutls.texi:3492: @image file `gnutls-handshake-sequence.txt' (for text) 
unreadable: No such file or directory.
gnutls.texi:3500: @image file `gnutls-mod_auth_st.txt' (for text) 
unreadable: No such file or directory.
gnutls.texi:3515: @image file `gnutls-extensions_st.txt' (for text) 
unreadable: No such file or directory.
gnutls.texi:3691: @image file `gnutls-certificate-user-use-case.txt' 
(for text) unreadable: No such file or directory.
makeinfo: Removing output file `gnutls.info' due to errors; use --force 
to preserve.
make[4]: *** [gnutls.info] Error 1
make[4]: Leaving directory `/home/Massimo/gnutls-2.3.5/doc'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/Massimo/gnutls-2.3.5/doc'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/Massimo/gnutls-2.3.5/doc'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Massimo/gnutls-2.3.5'
make: *** [all] Error 2


Why the doc processing is mandatory with make? Usually a 'make doc' is 
used avoiding doc processing if it's not required. (I got a pdf from the 
GnuTLS home site).


OK I surrend .......for the moment

Hope this helps.

Massimo






More information about the Gnutls-help mailing list