I am trying to setup curl in my multiplatform proj...
# kotlin-native
s
I am trying to setup curl in my multiplatform project by following this guide: https://kotlinlang.org/docs/curl.html#generate-bindings But when I try to add Interop to host targets , it doesn’t get recognised by IDE…. Any help is appreciated!
I am struggling with this error: (when I don’t enable interop)
s
s
Thanks @Sebastian Sellmair [JB], I will look into those!
s
And here would be a sample project for libcurl exactly, that I wrote for integration testing ☺️ 👍 https://github.com/JetBrains/kotlin/tree/master/libraries/tools/kotlin-gradle-plug[…]ation-tests/src/test/resources/testProject/commonizeCurlInterop Ping me if you need help, or have any questions or ideas 👍
👍 1
s
@Sebastian Sellmair [JB] I enabled cInterop but now getting
fatal error: 'curl/curl.h' file not found
s
In those sample projects I put the header files into the repository! You can either use headers on your machine coming from any libcurl installation, or do the same as me. For personal projects, I would also just put the headers into the repo!
s
Will see, I am new to Kotlin/Native so forgive me for asking stupid questions or asking things which for you might be common sense😶🙃
@Sebastian Sellmair [JB] I added the headers in repo and done required changes, CInterops Tasks Completed Successfully All targets Except linuxX64 compile successfully But LinuxX64 still fails with error:
> Task :linkDebugTestLinuxX64
e: /Users/shabinder/.konan/dependencies/clang-llvm-apple-8.0.0-darwin-macos/bin/ld.lld invocation reported errors
The /Users/shabinder/.konan/dependencies/clang-llvm-apple-8.0.0-darwin-macos/bin/ld.lld command returned non-zero exit code: 1.
output:
ld.lld: error: unable to find library -lcurl
s
What machine are you using?
s
@Sebastian Sellmair [JB] its MacOs Bigsur I5-9th gen
@Sebastian Sellmair [JB] Just Removing LinuxX64 as a Target Solved All Build Errors! If You want to look at a reproducer , here you go : https://github.com/Shabinder/youtube-api-dl
but I want to have LinuxX64 as a target , and I get a feel that the issue is related to my Build Machine ….., if Possible,Can you @Sebastian Sellmair [JB] try building on yours if you get same error or not.
s
I think the problem is that you also need the binary for linux on your machine to link against! Do you have a curl binary on your hands for linuxx64?
s
How do I check that? Do I have to download Curl for linux and link manually using compilerOpts/LinkerOpts? If yes how do I do that?