Francesco Pedron
01/13/2022, 3:47 PMcurl_easy_init()
When this line is added I get this error on build:
The C:\Users\Francesco\.konan\dependencies\llvm-11.1.0-windows-x64-essentials/bin/clang++ command returned non-zero exit code: 1.
output:
lld: error: unable to find library -lcurl
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
This is my libcurl.def:
package = libcurl
headers = curl.h
headerFilter = *
linkerOpts.mingw_x64 = -LC:/msys64/mingw64/lib -LC:/Tools/msys64/mingw64/lib -lcurl -L/opt/homebrew/opt/curl/include/curl
compilerOpts.mingw_x64 = -IC:/msys64/mingw64/include/curl -IC:/Tools/msys64/mingw64/include/curl
Please let me know if someone has some clues on how to get it working or if I can provide more information. Thanks.
This is a repo with my current project: https://github.com/francescopedronomnys/kotlin-native-libcurl-dll
Something that I find strange is that this is part of libcurl.def as defined on ktor-client-curl:
linkerOpts.mingw_x64 = -LC:/msys64/mingw64/lib -LC:/Tools/msys64/mingw64/lib -LC:/Tools/msys2/mingw64/lib -lcurl -L/opt/homebrew/opt/curl/include/curl
compilerOpts.mingw_x64 = -I/usr/include/curl -I/usr/include/x86_64-linux-gnu/curl -I/opt/homebrew/opt/curl/include/curl
I do not understand if those paths on compilerOpts.mingw_x64
are correct or just a copy/paste error, to me they don't look like Windows paths and so on my libcurl.def I've set the path where curl's dll, lib and headers are (C:/Tools/msys64/mingw64
)msink
01/13/2022, 5:48 PMFrancesco Pedron
01/14/2022, 9:13 AMlibcurl.dll.a
, this is what I have inside lib folder:
Directory: C:\Tools\msys64\mingw64\lib
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 12/01/2022 17:46 11415 libcurl.exp
-a---- 12/01/2022 17:46 19226 libcurl.lib
What I tried to do now is changing -lcurl
to -llibcurl
inside .def file and it works! Let me know if it makes sense to you.
Here's the commit that made it work: https://github.com/francescopedronomnys/kotlin-native-libcurl-dll/commit/3b1ffbd5cdc9beb394d3dfbc5171e71f962f01d7
I also found out that I have to put libcurl.dll in
C:\Windows\System32
to make it work at runtime, otherwise the exe will exit immediately.msink
01/14/2022, 9:21 AMlibcurl.lib
is import library for libcurl.dll
?
Then AFAIK what should work in your case is -l:libcurl.lib
msink
01/14/2022, 9:22 AM-llibcurl
is something weird... then linker should look for liblibcurl.a
or something similar.msink
01/14/2022, 9:23 AM.dll
- in runtime it should be in same folder with .exe
, or somewhere in system PATHFrancesco Pedron
01/14/2022, 9:27 AM-l:libcurl.lib
instead of -llibcurl
and the hint about the .dll
in the same folder as exe.