libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Windows binary with SSL3/TLS


From: Weber, Peter (Wilken Software Engineering GmbH)
Subject: Re: [libmicrohttpd] Windows binary with SSL3/TLS
Date: Fri, 17 Jun 2016 18:53:24 +0000

Hello!

You can also parse the output from objdump to get the dependencies.
> Or just use ntldd -R :)

This saved my life! It works and I can compile the application like I
want. The static-linking has become very interesting, I have learned a
lot!


DYNAMIC:

$ g++ -o foo.exe foo.cpp -Llib -lmicrohttpd -Iinclude -static-libstdc++ 
-static-libgcc -Wall -Wpedantic -std=gnu++11 -lws2_32 -lgnutls -lgcrypt 

# mirohttpd is stored in './lib', also the required shared-libariers
# -lws2_32 is needed for mircohttpd, gnutls and gcrypt for SSL/HTTPS
# -static-libstdc++ and -static-libgcc to compile them into foo.exe    
                                                               

The shared libraries, content of './lib':
libffi-6.dll
libiconv-2.dll
libintl-8.dll
libmicrohttpd.a # self compiled, static
libp11-kit-0.dll
libgcrypt-20.dll
libgmp-10.dll
libgnutls-30.dll
libgpg-error-0.dll
libhogweed-4-2.dll
libidn-11.dll
libnettle-6-2.dll
libtasn1-6.dll
libwinpthread-1.dll
zlib1.dll






STATIC:

I just figured out the reasons while writing this lines. I can't link a
pure statically executable, even when ld.exe succeceded. Because at
runtime the executable needs the following dll's!
libffi-6.dll
libp11-kit-0.dll # nasty
libintl-8.dll    # nasty
libiconv-2.dll

So I investigated the libraries and packages on the filesystem:

libp11-kit               # no static archive included
mingw-w64-x86_64-p11-kit # no static archive included
p11-kit                  # no static archive included
mingw-w64-x86_64-gettext # come on, this includes libintl.a!

Here is my final command:
g++ -static -static-libstdc++ -static-libgcc -o carrier.exe carrier.cpp -Llib 
-lmicrohttpd -Iinclude -Wall -Wpedantic -std=gnu++11 -lws2_32 -lgnutls -ltasn1 
-lgmp -liconv -lintl -liconv -lz -lidn -lintl -liconv -lnettle -lhogweed -lgmp 
-lwinpthread -lcrypt32 -lgcrypt -lgpg-error -Wl,-Bdynamic -lp11-kit 
-Wl,-Bstatic -lstdc++


Description of command:
1. -lcrypt32 is a windows-library and need for this stuff:

> C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.4.0/../../../../lib\libgnutls.a(system.o):(.text+0x2ca):
>  undefined reference to `__imp_CertEnumCRLsInStore'

Every search for this functions within the msys2-installation is
therefore doomed to fail ;)
2. -Wl,-Bdynamic -lp11-kit -Wl,-Bstatic -lstdc++

This line links just p11-kit dynamic, as a side effect it seems
necessary to "enforce" the static-linking of libstdc++ again manually.
The reason behind this, libp11-kit is only available as dynamic
library[1]!
I had already some sort of "contact" with Stef Walter, some time 
ago. Coincidence?

libffi and libintl are dependencies of libp11-kit, libiconv is a
dependency of libintl. You can see this also in the attachment,
"p11_kit.png".




Thank you very much for your help and patience
Peter


[1] https://lists.freedesktop.org/archives/p11-glue/2011-November/00009
9.html



Attachment: p11_kit.png
Description: p11_kit.png


reply via email to

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