[Top][All Lists]

[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: Wed, 15 Jun 2016 16:12:06 +0000

Hello and big thanks at Silvio and Evgeny!
It worked and I can compile the library dynamically and link it! At
first I was bewildered by MSYS2, especially because I'm using Archlinux
(pacman) since years. My beloved package-manager was ported to Windows
*envy*. I'm now able to compile my program and link it dynamically.

One last problem remains:
I'm trying to compile libmicrohttpd statically or at least the final
executable, but this fails. My LDFLAG="-static" seems to be ignored.
Therefore I compile the final program with "-static", which required me
to care much about the libraries:

> $ g++ -static -static-libstdc++ -o foo foo.cpp -Llib -lmicrohttpd -Iinclude 
> -Wall -Wpedantic -std=gnu++11 -lws2_32 -lgnutls -lidn -lgcrypt -lffi 
> -lgpg-error -lhogweed -lgmp -lintl -liconv -lnettle -ltasn1 -lwinpthread -lz

These gives me still a lot of "undefinfed reference errors", especially
about "system.o", "system-keys-win.o" and "pkcs11.o". So I tried to add
"-lp11-kit" behind "-lgnutls" but it doesn't change anything. And
"system.o" and "system-keys-win.o" doesn't give me a hint, so stuff
from Windows or internals of GNUTLS?

See here:

Do you think I should try to hand over the required libraries to my
users also? I'm perfectly fine with this, but it sounds a little bit


For future readers, here my steps for WIN_X86_64:
1. Install
2. Launch msys2_shell.cmd
3.1 Optional if behind proxy:
    $ export http_proxy=...
    $ export https_proxy=...
3.2 $ pacman -S mingw-w64-x86_64-toolchain make wget tar # general stuff
    $ pacman -S mingw-w64-x86_64-curl mingw-w64-x86_64-libgcrypt 
mingw-w64-x86_64-gnutls # for libmicrohttpd
4. Close the terminal
5. Launch msys2_shell.cmd -mingw64 # important!
6. $ wget -c
   $ tar -xzvf libmicrohttpd-0.9.50.tar.gz libmicrohttpd-0.9.50/
   $ mkdir build && cd build
   $ LDFLAG="-static" CFLAGS='-Os -s' ../libmicrohttpd-0.9.50/configure
   $ CFLAGS='-Os -s' ../libmicrohttpd-0.9.50/configure
   $ make
   You will find the resulting library now here "build\src\microhttpd\.libs\".

Example for compiling a final program and linking:
1. Launch msys2_shell.cmd -mingw64 # important!
2. $ g++ -o foo.exe foo.cpp -Llib -lmicrohttpd -Iinclude -Wall -Wpedantic 
-std=gnu++11 -lws2_32 -lgnutls -lgcrypt

@LRN: I' sorry, but libmicrohttpd seems not to be included in the packages

reply via email to

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