libtool
[Top][All Lists]
Advanced

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

Can't make dll out of a static convenience library: This system cannot l


From: basinilya
Subject: Can't make dll out of a static convenience library: This system cannot link to static lib
Date: Sat, 4 Jul 2020 23:27:35 +0300
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0

Hi. I'm trying to build mingw-w64-gnutls 3.6.12 on Archlinux. At some point it 
wants to make a C++ dll out of a C convenience static library and a C++ object 
file, but libtool omits the static library and link fails with undefined 
reference.
I don't understand why libtool omits the static library, because if I call g++ 
directly the dll is created just fine. I had to manually add `-lssp` to the 
command line, but I'm not sure if that's the cause.

Failure:

    [il@arch lib]$ make V=1
    ...
    make[2]: Entering directory 
'/home/il/.cache/pikaur/build/mingw-w64-gnutls/src/gnutls-3.6.12/build-i686-w64-mingw32/lib'
    /bin/sh ../libtool  --tag=CXX   --mode=link i686-w64-mingw32-g++ 
-I../../lib/includes -I./includes -D_FORTIFY_SOURCE=2 -O2 -pipe -fno-plt 
-fexceptions --param=ssp-buffer-size=4  -no-undefined -version-info 29:0:1 
-Wl,-O1,--sort-common,--as-needed -fstack-protector  -o libgnutlsxx.la -rpath 
/usr/i686-w64-mingw32/lib libgnutlsxx_la-gnutlsxx.lo libgnutls.la
    
    *** Warning: This system cannot link to static lib archive libgnutls.la.
    *** I have the capability to make that library automatically link in when
    *** you link to this library.  But I can only do this if you have a
    *** shared version of the library, which you do not appear to have.
    libtool: link: rm -fr  .libs/libgnutlsxx.dll.a
    libtool: link: i686-w64-mingw32-g++ -shared -nostdlib 
/usr/lib/gcc/i686-w64-mingw32/10.1.0/../../../../i686-w64-mingw32/lib/../lib/dllcrt2.o
 /usr/lib/gcc/i686-w64-mingw32/10.1.0/crtbegin.o  
.libs/libgnutlsxx_la-gnutlsxx.o   -L/usr/i686-w64-mingw32/lib 
-L/usr/lib/gcc/i686-w64-mingw32/10.1.0 
-L/usr/lib/gcc/i686-w64-mingw32/10.1.0/../../../../i686-w64-mingw32/lib/../lib 
-L/usr/lib/gcc/i686-w64-mingw32/10.1.0/../../../../i686-w64-mingw32/lib 
-lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread 
-ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname 
-lmingwex -lmsvcrt /usr/lib/gcc/i686-w64-mingw32/10.1.0/crtend.o  -O2 -Wl,-O1 
-Wl,--sort-common -Wl,--as-needed -fstack-protector   -o 
.libs/libgnutlsxx-28.dll -Wl,--enable-auto-image-base -Xlinker --out-implib 
-Xlinker .libs/libgnutlsxx.dll.a
    /usr/lib/gcc/i686-w64-mingw32/10.1.0/../../../../i686-w64-mingw32/bin/ld: 
.libs/libgnutlsxx_la-gnutlsxx.o:gnutlsxx.cpp:(.text+0x10): undefined reference 
to `gnutls_deinit'
    ...
    collect2: error: ld returned 1 exit status


Success:

    [il@arch lib]$ i686-w64-mingw32-g++ -shared -nostdlib 
/usr/lib/gcc/i686-w64-mingw32/10.1.0/../../../../i686-w64-mingw32/lib/../lib/dllcrt2.o
 /usr/lib/gcc/i686-w64-mingw32/10.1.0/crtbegin.o  
.libs/libgnutlsxx_la-gnutlsxx.o \
    >   .libs/libgnutls.a  \
      -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -lpthread 
-ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname 
-lmingwex -lmsvcrt \
    >    \
    >   -L/usr/i686-w64-mingw32/lib -L/usr/lib/gcc/i686-w64-mingw32/10.1.0 
-L/usr/lib/gcc/i686-w64-mingw32/10.1.0/../../../../i686-w64-mingw32/lib/../lib 
-L/usr/lib/gcc/i686-w64-mingw32/10.1.0/../../../../i686-w64-mingw32/lib \
    >   -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt 
-lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc 
-lmoldname -lmingwex -lmsvcrt \
    >   -lp11-kit -lws2_32 -lunistring -ltasn1 -lnettle -lhogweed -lgmp 
-lcrypt32 \
    >   -lssp \
    >   /usr/lib/gcc/i686-w64-mingw32/10.1.0/crtend.o  -O2 -Wl,-O1 
-Wl,--sort-common -Wl,--as-needed -fstack-protector   -o 
.libs/libgnutlsxx-28.dll -Wl,--enable-auto-image-base -Xlinker --out-implib 
-Xlinker .libs/libgnutlsxx.dll.a
    [il@arch lib]$


[il@arch lib]$ /bin/sh ../libtool --version
libtool (GNU libtool) 2.4.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]