添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
刚失恋的水煮肉  ·  curl ...·  2 周前    · 
粗眉毛的蚂蚁  ·  ConflictAlgorithm ...·  4 月前    · 
魁梧的小刀  ·  友情链接 铂特优选·  5 月前    · 

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

I did this

Build and install, curl linked to mbedTLS 2.X on an arm machine.

cmake ../../curl/ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCURL_USE_OPENSSL=OFF -DCURL_USE_MBEDTLS=ON -DMBEDTLS_LIBRARIES=/home/ludo/staging/mbedtls/lib -DMBEDTLS_INCLUDE_DIRS=/home/ludo/staging/mbedtls/include -DMBEDCRYPTO_LIBRARY=/home/ludo/staging/mbedtls/lib/libmbedcrypto.so -DMBEDTLS_LIBRARY=/home/ludo/staging/mbedtls/lib/libmbedtls.so -DMBEDX509_LIBRARY=/home/ludo/staging/mbedtls/lib/libmbedx509.so -DCMAKE_INSTALL_PREFIX=/home/ludo/staging/curl

I expected the following

After the installation curl is still linked to mbedTLS and use it.
The exact same flow, cmake -> make -> make install works perfectly on x86 machines.
It fails on arm(v7 and v8) machines.

curl/libcurl version

From build folder :

arm@ludo-vm:~/ludo/build/curl/src$ ./curl -V
curl 7.87.1-DEV (Linux) libcurl/7.87.1-DEV mbedTLS/2.28.0 zlib/1.2.11
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS HSTS HTTPS-proxy IPv6 Largefile libz NTLM SSL threadsafe UnixSockets

ldd output

arm@ludo-vm:~/ludo/build/curl/src$ ldd ./curl 
	linux-vdso.so.1 (0x0000ffffb1197000)
	libcurl.so.4 => /home/arm/ludo/build/curl/lib/libcurl.so.4 (0x0000ffffb1070000)
	libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffb0ec0000)
	/lib/ld-linux-aarch64.so.1 (0x0000ffffb115e000)
	libmbedtls.so.14 => /home/ludo/staging/mbedtls/lib/libmbedtls.so.14 (0x0000ffffb0e80000)
	libmbedx509.so.1 => /home/ludo/staging/mbedtls/lib/libmbedx509.so.1 (0x0000ffffb0e40000)
	libmbedcrypto.so.7 => /home/ludo/staging/mbedtls/lib/libmbedcrypto.so.7 (0x0000ffffb0db0000)
	libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000ffffb0d80000)

From install folder :

arm@ludo-vm:/home/ludo/staging/curl/bin$ ./curl -V
./curl: symbol lookup error: ./curl: undefined symbol: curl_easy_nextheader

ldd output

arm@ludo-vm:/home/ludo/staging/curl/bin$ ldd ./curl
	linux-vdso.so.1 (0x0000ffff92a37000)
	libcurl.so.4 => /lib/aarch64-linux-gnu/libcurl.so.4 (0x0000ffff92900000)
	libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff92750000)
	/lib/ld-linux-aarch64.so.1 (0x0000ffff929fe000)
	libnghttp2.so.14 => /lib/aarch64-linux-gnu/libnghttp2.so.14 (0x0000ffff92710000)
	libidn2.so.0 => /lib/aarch64-linux-gnu/libidn2.so.0 (0x0000ffff926e0000)
	librtmp.so.1 => /lib/aarch64-linux-gnu/librtmp.so.1 (0x0000ffff926b0000)
	libssh.so.4 => /lib/aarch64-linux-gnu/libssh.so.4 (0x0000ffff92630000)
	libpsl.so.5 => /lib/aarch64-linux-gnu/libpsl.so.5 (0x0000ffff92600000)
	libssl.so.3 => /lib/aarch64-linux-gnu/libssl.so.3 (0x0000ffff92550000)
	libcrypto.so.3 => /lib/aarch64-linux-gnu/libcrypto.so.3 (0x0000ffff92160000)
	libgssapi_krb5.so.2 => /lib/aarch64-linux-gnu/libgssapi_krb5.so.2 (0x0000ffff92100000)
	libldap-2.5.so.0 => /lib/aarch64-linux-gnu/libldap-2.5.so.0 (0x0000ffff92090000)
	liblber-2.5.so.0 => /lib/aarch64-linux-gnu/liblber-2.5.so.0 (0x0000ffff92070000)
	libzstd.so.1 => /lib/aarch64-linux-gnu/libzstd.so.1 (0x0000ffff91fa0000)
	libbrotlidec.so.1 => /lib/aarch64-linux-gnu/libbrotlidec.so.1 (0x0000ffff91f80000)
	libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000ffff91f50000)
	libunistring.so.2 => /lib/aarch64-linux-gnu/libunistring.so.2 (0x0000ffff91d90000)
	libgnutls.so.30 => /lib/aarch64-linux-gnu/libgnutls.so.30 (0x0000ffff91b90000)
	libhogweed.so.6 => /lib/aarch64-linux-gnu/libhogweed.so.6 (0x0000ffff91b30000)
	libnettle.so.8 => /lib/aarch64-linux-gnu/libnettle.so.8 (0x0000ffff91ad0000)
	libgmp.so.10 => /lib/aarch64-linux-gnu/libgmp.so.10 (0x0000ffff91a40000)
	libkrb5.so.3 => /lib/aarch64-linux-gnu/libkrb5.so.3 (0x0000ffff91960000)
	libk5crypto.so.3 => /lib/aarch64-linux-gnu/libk5crypto.so.3 (0x0000ffff91920000)
	libcom_err.so.2 => /lib/aarch64-linux-gnu/libcom_err.so.2 (0x0000ffff91900000)
	libkrb5support.so.0 => /lib/aarch64-linux-gnu/libkrb5support.so.0 (0x0000ffff918e0000)
	libsasl2.so.2 => /lib/aarch64-linux-gnu/libsasl2.so.2 (0x0000ffff918b0000)
	libbrotlicommon.so.1 => /lib/aarch64-linux-gnu/libbrotlicommon.so.1 (0x0000ffff91870000)
	libp11-kit.so.0 => /lib/aarch64-linux-gnu/libp11-kit.so.0 (0x0000ffff91720000)
	libtasn1.so.6 => /lib/aarch64-linux-gnu/libtasn1.so.6 (0x0000ffff916f0000)
	libkeyutils.so.1 => /lib/aarch64-linux-gnu/libkeyutils.so.1 (0x0000ffff916d0000)
	libresolv.so.2 => /lib/aarch64-linux-gnu/libresolv.so.2 (0x0000ffff916a0000)
	libffi.so.8 => /lib/aarch64-linux-gnu/libffi.so.8 (0x0000ffff91680000)

operating system

Linux ludo-vm 5.15.0-1029-azure #36-Ubuntu SMP Mon Dec 5 19:31:21 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

Just tested with the nominal path

cmake ../../mbedtls/ -DCMAKE_BUILD_TYPE=Release -DUSE_SHARED_MBEDTLS_LIBRARY=ON
make && sudo make install
cmake ../../curl/ -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCURL_USE_OPENSSL=OFF -DCURL_USE_MBEDTLS=ON
make && sudo make install

Same behavior, the binary in the build folder is ok.
The one installed in /usr/local is broken

./curl: symbol lookup error: ./curl: undefined symbol: curl_easy_nextheader`

This is just your system loading the wrong library at run-time, this is not curl's fault. You need to make sure you load the library in the right order from the right directories.

Curl is being install by its own script not by my system. I undesrtand your point, but don't you think that somthing that is compiled and installed by its own tools should simply work?

What is the point to have something that is working inside its build folder and failing after the install step?
The ldd output does not seems to point to a system issue.

Many software packages, including curl, install libraries to a default locations, like /lib or /usr/lib. Your system searches in /lib/aarch64-linux-gnu first and founds it there. So you have installed curl by some other means already, maybe with a package manager. Installing the same software with a package manager and some other means is just asking for troubles like this.

Many software packages, including curl, install libraries to a default locations, like /lib or /usr/lib. Your system searches in /lib/aarch64-linux-gnu first and founds it there. So you have installed curl by some other means already, maybe with a package manager. Installing the same software with a package manager and some other means is just asking for troubles like this.

Got it!
Thanks for the clarification.