Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix libcurl for arm64 #4424

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix libcurl for arm64 #4424

wants to merge 1 commit into from

Conversation

89jd
Copy link

@89jd 89jd commented Oct 23, 2024

Subsystem
Client

Motivation
I couldn't build / link libcurl on arm64 platform. The reason is the one in the repo used a newer version of GCC to compile curl

Solution
I have compiled it with 8.3.3 to match the gcc used in kotlin multiplatform

@89jd
Copy link
Author

89jd commented Oct 24, 2024

I have updated to the libcurl from libcurl4-gnutls-dev

Understand you may not want to use a random library, to get it, I did the following:

docker run -it arm64v8/debian:bullseye bash
apt install libcurl4-gnutls-dev

docker cp <container_id>:/usr/lib/aarch64-linux-gnu/libcurl.a ktor-client/ktor-client-curl/desktop/interop/linuxArm64/lib

@Stexxe Stexxe requested a review from e5l October 25, 2024 09:32
Copy link
Member

@e5l e5l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check if we can replace gnutls version with non GPL alternative? We don't link the library dynamically at the moment (the LGPL library must remain separable)

@89jd
Copy link
Author

89jd commented Oct 29, 2024

It does dynamically link to gnu i think. I need the shared libraries and the linker flags to compile my app which uses this Ktor version

linkerOpts(
                    "-lbrotlidec",
                    "-lcom_err",
                    "-lgnutls",
                    "-lgssapi_krb5",
                    "-lidn2",
                    "-lk5crypto",
                    "-lkrb5",
                    "-llber",
                    "-lldap",
                    "-lnettle",
                    "-lnghttp2",
                    "-lpsl",
                    "-lrtmp",
                    "-lssh2",
                    "-lz",

I can just build from source, but wasn't sure if that would be alright. Want me to do that again and push it?

@e5l
Copy link
Member

e5l commented Oct 29, 2024

let me try to check if I can do this locally

@e5l
Copy link
Member

e5l commented Oct 29, 2024

but if you can build standalone non-gnu binary, it would be great

@89jd
Copy link
Author

89jd commented Oct 29, 2024

Do you have any preferences to these features:


curl version:     8.10.1
  SSL:              enabled (OpenSSL)
  SSH:              no      (--with-{libssh,libssh2})
  zlib:             no      (--with-zlib)
  brotli:           no      (--with-brotli)
  zstd:             no      (--with-zstd)
  GSS-API:          no      (--with-gssapi)
  GSASL:            no      (libgsasl not found)
  TLS-SRP:          enabled
  resolver:         POSIX threaded
  IPv6:             enabled
  Unix sockets:     enabled
  IDN:              no      (--with-{libidn2,winidn})
  Build docs:       enabled (--disable-docs)
  Build libcurl:    Shared=no, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  Code coverage:    disabled
  SSPI:             no      (--enable-sspi)
  ca cert bundle:   /etc/ssl/certs/ca-certificates.crt
  ca cert path:     /etc/ssl/certs
  ca fallback:      no
  LDAP:             no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  LDAPS:            no      (--enable-ldaps)
  RTSP:             enabled
  RTMP:             no      (--with-librtmp)
  PSL:              enabled
  Alt-svc:          enabled (--disable-alt-svc)
  Headers API:      enabled (--disable-headers-api)
  HSTS:             enabled (--disable-hsts)
  HTTP1:            enabled (internal)
  HTTP2:            no      (--with-nghttp2)
  HTTP3:            no      (--with-ngtcp2 --with-nghttp3, --with-quiche, --with-openssl-quic, --with-msh3)
  ECH:              no      (--enable-ech)
  WebSockets:       enabled
  Protocols:        dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
  Features:         alt-svc AsynchDNS HSTS HTTPS-proxy IPv6 Largefile NTLM PSL SSL threadsafe TLS-SRP UnixSockets

Personally think, HTTP2 & websockets should probably be added, but other than that, not too sure what would be best

@e5l
Copy link
Member

e5l commented Nov 2, 2024

http2 and http3 would be nice to have

@e5l e5l self-requested a review November 2, 2024 07:53
@whyoleg
Copy link
Contributor

whyoleg commented Nov 2, 2024

JFYI: accidentally, yesterday I was decided to check if it possible to build libcurl via Conan :)
I was able to re-configure my openssl-builds for building libcurl:

https://github.com/whyoleg/openssl-builds/actions/runs/11641066156

While the build is green, there are some failures, mostly related to non-desktop targets are built and can be downloaded from artifacts there, or from the link below:

https://github.com/whyoleg/openssl-builds/actions/runs/11641066156/artifacts/2136057610

I haven't configured any flags so far, defaults are used. For now, libcurl built there should depend only on openssl and zlib

But, I haven't tested, that everything works fine when adding them to the project :)

BTW, what Kotlin targets do you think will benefit from static libraries? Or we could use static for all targets? Or we could split curl engine in two artefacts as I've done in cryptography-kotlin?

@e5l
Copy link
Member

e5l commented Nov 7, 2024

Hey @89jd, sorry for the delay. It looks like a more general and reproducible approach exists as #4445. Could you check if it helps to solve your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants