&gt; Install the <curl library> however, I am a b...
# kotlin-native
w
Install the curl library
however, I am a bit confused and annoyed by this step as 1, this shouldnt be necessary, developers shouldnt download and install arbitrary things just to make their machine able to build a project, this is literally what tools like gradle are meant for, why is this not handled by gradle?! 2, the link is just a download page, which gives absolutely no information as to how to "install" (pretending that even makes sense) the package 3, I have curl already "installed"
e
even if you have the
curl
binary installed, that doesn't mean you have the development libraries
how to get those depends on platform/distribution
it's not in Maven because that's not how native dependencies are traditionally distributed
(and I don't think Maven could cope with the huge diversity in Linux distributions anyway)
w
after following https://github.com/JetBrains/kotlin/blob/master/kotlin-native/samples/libcurl/README.md I can run task
runDebugExecutableMingwX64
succesfully, but task
assemble
has a similar error ".konan\dependencies\msys2-mingw-w64-x86_64-1\bin\ld.gold: error: cannot find -lcurl"
e
because you will need a Windows libcurl in order to build for Windows
I'm not sure how to set up the sysroot for cross-compiling though
w
but I assume I already have a windows libcurl because running the application works
assemble
works if I disable the linux build
however, obviously, that is not acceptable
e
hmm. then perhaps run just wants a shared library, assemble wants a static library, and you only have one of them
I cannot help with anything Windows-related; all I can say is that dealing with native libraries is a pain in every language, even the most native language of C
wait, are you working on Windows? then you'll need a Linux libcurl in order to build for Linux (and
assemble
builds for enabled targets)… and there's not just one Linux libcurl… it is challenging to make redistributable Linux binaries
w
I am working on windows, but I'd be deploying on AWS Lambda, those are currently the only runtimes that really need to be supported, so I dont necessarily have to have a fully redistributable linux binary, just for the one target that runs the AWS Lambda containers
looking at issues related to libcurl and aws(lambda), I find that the solution is to install libcurl-devel, but after installing it via https://www.msys2.org/ using
pacman -S libcurl-devel
it still cant find the package...
e
usually you need to build from a Linux system or container containing the same or compatible versions as your target - those applies to all native development. now that's not completely necessary for Kotlin because Konan fixes the glibc it build against, but that doesn't extend to external libraries. you will need to get the development version of whatever libcurl AWS lambda has, or deploy your own with your program
msys2 pacman only installs the windows curl library
w
I am now trying to set up a build pipeline to build the application from an AWS Lambda instead of local machine... which would be the end goal, but building and deploying from local machine would definitely be a nice bonus, especially during the current phase which is just exploring how things work