Hello there! Can I confirm something about multip...
# ktor
m
Hello there! Can I confirm something about multiplatform from this link please: https://ktor.io/docs/client-engines.html#curl
On Linux, you have to install the
gnutls
version of libcurl. To install this version on Ubuntu you can run:
Copy code
sudo apt-get install libcurl4-gnutls-dev
I'm building a simple app that runs on Linux and needs to make network requests. If I do this on Android / JVM I simply depend on my favourite HTTP library (OkHttp for example) and write code. Why do I need to download / install something else in addition to depending on
implementation("io.ktor:ktor-client-curl:$ktor_version")
? Why can't the requirement of installing
libcurl4-gnutls-dev
be satisfied simply by pulling in
ktor-client-curl
into my project? Thanks in advance.
a
Because the libcurl, which does the actual HTTP communication, is dynamically linked. It's possible to statically link libcurl but this will affect the executable size.
👍 1
m
Thanks Aleksei, that helps my understanding. Does that mean then when I create a
.kexe
via the multiplatform build process that my binary for Linux doesn't have the ability to make HTTP requests and I need to ensure that where ever I run the binary I first also need to install
libcurl
? Or is this only relevant for allowing me to compile the binary and once distributed it can run happily without further dependency installations?
a
I need to ensure that where ever I run the binary I first also need to install
libcurl
?
Yes.
m
Perfect, thank you 🙏 . One last question: If I wanted to include
libcurl
into my final binary (static linking??) would that be possible or would that not be advised?
a
Starting with Ktor 3.1.0 (the next upcoming release), libcurl will be linked statically. See https://github.com/ktorio/ktor/pull/4445.
m
Oooooooooo......... I didn't know that. Very interesting. Many thanks Aleksei thank you color .