curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Curl as static library with dependencies

From: amchess via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 22 Nov 2019 11:28:50 +0100 (CET)

Thanks for your answer.

I want to compile in windows x64 with msys the following code:

https://github.com/noobpwnftw/Stockfish/tree/livebook
With the following dlls in the src folder and eliminating the LDFLAGS += -static in the Makefile, it works:

libcurl-x64.dll
libcrypto_1_1-x64.dll
libssl_1_1-x64.dll
libssl_1_1-x64.dll
libssh2_x64.dll
libbrotlicommon.dll
libbrotlidec.dll
libbrotlienc.dll

but I need a static (LTO) build.

So,
- I got the static libraries and their includes.
- I copied them into MinGW lib and include folders.
- I launched the following command:

mingw32-make profile-build ARCH=x86-64-bmi2 COMP=mingw CXX=x86_64-w64-mingw32-g++ -j14

but I have errors like the following:

C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib\libcurl.a(libcurl_la-connect.o):(.text+0x66): undefined reference to `__imp_getsockopt' C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib\libcurl.a(libcurl_la-connect.o):(.text+0x92): undefined reference to `__imp_WSAGetLastError' C:/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/lib/../lib\libcurl.a(libcurl_la-connect.o):(.text+0x2a0): undefined reference to `__imp_inet_ntop' ...

I tried to specify the flag -lws2_32 at the end of the command and also the entire dependencies chain:

mingw32-make profile-build ARCH=x86-64-bmi2 COMP=mingw CXX=x86_64-w64-mingw32-g++ -j14 -lz -lbrotlicommon-static -lbrotlidec-static -lssh2 -lnghttp2 -lssl -lcurl -lwsock32 -lwinsock2 -lws2_32 -lcrypto -lcrypt32 -lbcrypt -lwldap32
but nothing changes.
What am I missing?
Many thanks in advance,
Andrea

Il 21 novembre 2019 alle 17.16 Daniel Stenberg <daniel_at_haxx.se> ha scritto: On Tue, 19 Nov 2019, amchess

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-11-22