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

Simon Josefsson simon at josefsson.org
Wed Apr 16 13:00:48 CEST 2008


Massimo Gaspari <massimo.gaspari at alice.it> writes:

>> 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.

Yes, that is one solution, however doing it systematically for each and
every symbol defined by gnulib is a lot of work.

Maybe you could add '#define vasprintf gnutls_vasprintf' in your
config.h when building GnuTLS?  I'm not sure it will work, but something
like that will be necessary to fully solve this problem.

>>> 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'
...
>> 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).

Thanks.  We should use the gnulib alloca module.  I'll see if I can fix
this.

> 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

That's a fine workaround meanwhile.

> (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.)

Yup, related to the gnutls_vasprintf problem.

> 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.

I'm not sure if it will solve this, but I changed the order of libgnu.la
in Makefile.am.  Please test tomorrow's snapshot.

>
> 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).

To build the manual, you need a newer texinfo.  However, building it
shouldn't be required unless you modified any source files that is used
by the manual.  Possibly you have done that...  I think this should go
away when all your other build problems are solved in the official
distribution.

I think you are making good progress.   Let's keep trying..

/Simon





More information about the Gnutls-help mailing list