Build fails if curl is preinstalled (Alpine Linux)
The linking step of OpenVDS and its executables fails if cURL is preinstalled on the system and OpenVDS builds its own cURL as well. I have attached a Dockerfile to reproduce the error. It seems that CMake picks up a different cURL or some other dependency which pulls in libidn2
.
Do you have any idea what causes this?
[...]
[ 96%] Linking CXX executable VDSCopy
cd /open-vds/build/tools/VDSCopy && /usr/bin/cmake -E cmake_link_script CMakeFiles/VDSCopy.dir/link.txt --verbose=1
/usr/bin/c++ -O3 -DNDEBUG -s -Wl,--exclude-libs=ALL -Wl,--no-export-dynamic CMakeFiles/VDSCopy.dir/VDSCopy.cpp.o ../Shared/CMakeFiles/tools_shared.dir/HelpConnection.cpp.o -o VDSCopy -Wl,-rpath,/open-vds/build/src/OpenVDS: ../../src/OpenVDS/libopenvds.so.3.4.255 ../../fmt_9.1.0/lib
fmt.a ../../jsoncpp_1.8.4/src/lib_json/libjsoncpp_static.a ../../docs/libhelp_connection.a
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ../../src/OpenVDS/libopenvds.so.3.4.255: undefined reference to `idn2_lookup_ul'
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ../../src/OpenVDS/libopenvds.so.3.4.255: undefined reference to `idn2_check_version'
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ../../src/OpenVDS/libopenvds.so.3.4.255: undefined reference to `idn2_strerror'
/usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ../../src/OpenVDS/libopenvds.so.3.4.255: undefined reference to `idn2_free'
collect2: error: ld returned 1 exit status
Operating system
Alpine Linux (latest), but problem seems to appear starting from Alpine Linux 3.18. It builds fine in Alpine Linux 3.17.
I tested in Docker on an M1 Mac with and without x86_64 emulation. The error shows up in both cases.
What did I try
Without success
- Enabled/disabled different I/O managers.
- Had a look into the CMake files, but I must admit that I do not know how to properly debug this.
- Installing
libidn2-dev
, but it seems to be present already if one installscurl-dev
. - Switching between Make and Ninja as build system
Successfully
- Setting
-DBUILD_CURL=OFF
seems to fix the problem. However, I am not sure if this has implications for features or performance.