[MinGW-Users] Need advice on how to include OpenSSL statically in linux/windows crossbuild DLL

Back to archive index
Benedikt Hallinger beni****@halli*****
Wed Jan 6 07:20:17 JST 2021

in my project fgcom-mumble (https://github.com/hbeni/fgcom-mumble) i 
build a windows DLL from linux.
This all wents good so far and the DLL looks good when i do not include 

When i do, the compilation succeeds, but two DLL entries are reported 
missing from the final generated DLL, and i really struggle to find out 
The missing bits are OpenSSLs libcrypto and libssl, against which i link 
statically (i try to at least).
I have seen this with https://github.com/lucasg/Dependencies tool.

The makefile generates this command:
x86_64-w64-mingw32-g++-posix -fPIC --shared -DMINGW_WIN64 -o 
fgcom-mumble.dll lib/io_plugin.cpp lib/radio_model.cpp lib/audio.cpp 
lib/io_UDPServer.cpp lib/io_UDPClient.cpp lib/garbage_collector.cpp 
fgcom-mumble.cpp -L./lib/openssl/ -static -lssl.dll -lcrypto.dll 
-DSSLFLAGS -lws2_32 -lcrypt32 -static-libgcc -static-libstdc++ -I. 
-I./lib -g3 -DDEBUG -I./lib/openssl/include/ -Wl,-Bstatic -lstdc++ 
-lpthread -lws2_32

./lib/openssl/libcrypto.dll.a and ./lib/openssl/libssl.dll.a are there 
and resolved (if i rename them, the build fails).

My impression was that the "static" switch should have included the dlls 
into my archive.
What do i do wrong here? I already googled and tried different things 
several days now (some -Wl liker flags like static etc), but to no 
avail. Please be aware that I'm fairly new to C/C++ and cross compiling.

Thank you very much in advance,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot 2021-01-05 215355.png
Type: image/png
Size: 13625 bytes
Desc: not available
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20210105/950b0c3d/attachment.png>

More information about the MinGW-Users mailing list
Back to archive index