Nheko-Reborn / mtxclient

Client API library for Matrix, built on top of libcurl
MIT License
40 stars 25 forks source link

Build fails: Arch /w 5.18.16-arch1-1 #96

Closed adventurist closed 1 year ago

adventurist commented 1 year ago

Thanks again for following up so quick on the other issue. Everything builds perfectly on that system, but I have another deployment environment where I've run into some issues.

Description

Build fails when linking with coeurl libcoeurld.so

Branch / Commit

master / e136bc27b28d3bb5683735eb5a65d6ef2534ca3a

OS

Arch with Kernel version 5.18.16-arch1-1

Compiler

GCC / G++ 12.1.1

Procedure

cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DHUNTER_ENABLED=ON
cmake --build build

Result

[ 56%] Building CXX object CMakeFiles/matrix_client.dir/lib/structs/responses/turn_server.cpp.o
[ 56%] Building CXX object CMakeFiles/matrix_client.dir/lib/structs/responses/users.cpp.o
[ 57%] Building CXX object CMakeFiles/matrix_client.dir/lib/structs/responses/version.cpp.o
[ 58%] Building CXX object CMakeFiles/matrix_client.dir/lib/structs/responses/well-known.cpp.o
[ 58%] Building CXX object CMakeFiles/matrix_client.dir/lib/structs/responses/public_rooms.cpp.o
[ 59%] Linking CXX shared library libmatrix_client.so
[ 59%] Built target matrix_client
[ 59%] Building CXX object CMakeFiles/client_api.dir/tests/client_api.cpp.o
[ 60%] Linking CXX executable client_api
/usr/bin/ld: _deps/coeurl-build/libcoeurld.so: undefined reference to `arc4random_addrandom' 
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/client_api.dir/build.make:109: client_api] Error 1
make[1]: *** [CMakeFiles/Makefile2:250: CMakeFiles/client_api.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Any information is greatly appreciated!

adventurist commented 1 year ago

Update:

I have tried building coeurl (https://nheko.im/nheko-reborn/coeurl.git) on the same system, and there was no problem (current master commit d926893007c353fbc149d8538a5762ca8384273a)

deepbluev7 commented 1 year ago

What version is your glibc?

adventurist commented 1 year ago

What version is your glibc?

It is 2.37

deepbluev7 commented 1 year ago

That is supposed to have that function in the libc...

Is this a new build directory? What happens if you pass -DUSE_BUNDLED_OPENSSL=OFF?

adventurist commented 1 year ago

That is supposed to have that function in the libc...

Is this a new build directory? What happens if you pass -DUSE_BUNDLED_OPENSSL=OFF?

I built clean as follows:

rm -rf build
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Debug -DHUNTER_ENABLED=ON -DUSE_BUNDLED_OPENSSL=OFF

This results in

CMake Error at /home/logicp/.hunter/_Base/Download/Hunter/0.24.8/ca7838d/Unpacked/cmake/find/FindOpenSSL.cmake:309 (message):
  Incorrect OPENSSL_VERSION_NUMBER define in header:
  /usr/include/openssl/opensslv.h
Call Stack (most recent call first):
  CMakeLists.txt:97 (find_package)

My OpenSSL version: OpenSSL 3.0.8 7 Feb 2023 (Library: OpenSSL 3.0.8 7 Feb 2023)

deepbluev7 commented 1 year ago

Without the bundled openssl, it should not pull in the openssl from the hunter dir. Maybe just try wiping ~/.hunter

adventurist commented 1 year ago

Without the bundled openssl, it should not pull in the openssl from the hunter dir. Maybe just try wiping ~/.hunter

The bad news:

I wiped ~/.hunter and rebuilt from scratch, but it ends up in the same place as detailed in the issue description (arc4random_addrandom undefined when linking client_api)

but, the good news:

Since these appear to be tests, I don't necessarily need them in order to continue with my own work, so I simply rebuilt again with tests/examples disabled, and the build completed.

Given that it appears to only affect tests, I am happy to proceed as you like: (close issue, re-characterize issue, continue as-is, ?)

deepbluev7 commented 1 year ago

I think this is an issue with your system, so if you found a workaround, I'll just close it. We don't use arc4random directly, but our dependencies use it. So it is probably their cmake files that are wrong.