https://kotlinlang.org logo
Title
j

Joakim Forslund

02/27/2022, 10:43 AM
Adding a setup of cinterop with curl just gives colliding symbols, so obviously ktor client is expecting something different
I've tried to install with choco and also placing the https://curl.se/windows/ binaries inside the executable folder
a

Aleksei Tirman [JB]

02/28/2022, 8:20 AM
Could you please check that you have the
libcurl.dll.a
file in one of the following directories: C:/msys64/mingw64/lib, C:/Tools/msys64/mingw64/lib, C:/Tools/msys2/mingw64/lib?
j

Joakim Forslund

02/28/2022, 8:21 AM
Well, my msys64 folder is located on another drive, should this not be configurable at the very least?
a

Aleksei Tirman [JB]

02/28/2022, 9:00 AM
You can create a def file with the paths replaced for your specific case:
package = libcurl
headers = curl.h
headerFilter = *
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
In the Gradle build file you can manually create a cinterop:
nativeTarget.apply {
    binaries {
        executable {
            entryPoint = "main"
        }
    }

    nativeTarget.compilations.getByName("main") {
        cinterops.create("libcurl") {
            defFile = File(projectDir, "interop/libcurl.def")
        }
    }
}
j

Joakim Forslund

02/28/2022, 9:00 AM
That's what I did, but that ends up giving duplicate symbols
a

Aleksei Tirman [JB]

02/28/2022, 9:01 AM
Could you please share an exact error? I don't get any errors while building my sample application.
Or maybe you could create an alias for the msys64 folder if it's possible on Windows.
j

Joakim Forslund

02/28/2022, 9:09 AM
Compilation failed: Linking globals named 'knifunptr_libcurl0_curl_strequal': symbol multiply defined!

 * Source files: 
 * Compiler version info: Konan: 1.6.20-RC / Kotlin: 1.6.20
 * Output kind: PROGRAM`
My current work around has been to move the files from my local msys2 folder to
.konan\dependencies\msys2-mingw-w64-x86_64-1
Instead of trying the cinterop setup
The symlink / alias idea might work, but i'd rather have the option for konan to look in my local msys2 folder on another drive, if that indeed is the problem