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

Linker problem #8

Open
andrew-palamar opened this issue Dec 14, 2024 · 0 comments
Open

Linker problem #8

andrew-palamar opened this issue Dec 14, 2024 · 0 comments

Comments

@andrew-palamar
Copy link

andrew-palamar commented Dec 14, 2024

Hello, checked demo binaries from releases. Looks great, thanks for your work!
But when I try to build this project on Debian Bookworm or Trixie I have following errors:

FAILED: bin/c_cli/c_cli 
: && /usr/bin/cc -fPIC  bin/c_cli/CMakeFiles/c_cli.dir/main.c.o -o bin/c_cli/c_cli  -Wl,-rpath,/home/ap/sip-phone/build-libphone/bin/phone  bin/phone/libphone.so.0.9.5  /home/ap/installed/pjproject/lib/libpjproject.a  /usr/lib/x86_64-linux-gnu/libcrypto.so  /usr/lib/x86_64-linux-gnu/libssl.so  /usr/lib/x86_64-linux-gnu/libasound.so  /usr/lib/x86_64-linux-gnu/libopus.so && :
/usr/bin/ld: bin/phone/libphone.so.0.9.5: undefined reference to `uuid_unparse'
/usr/bin/ld: bin/phone/libphone.so.0.9.5: undefined reference to `uuid_generate'
collect2: error: ld returned 1 exit status
[2/3] Linking CXX executable bin/cpp_cli/cpp_cli
FAILED: bin/cpp_cli/cpp_cli 
: && /usr/bin/c++ -fPIC  bin/cpp_cli/CMakeFiles/cpp_cli.dir/main.cpp.o -o bin/cpp_cli/cpp_cli  -Wl,-rpath,/home/ap/sip-phone/build-libphone/bin/phone  bin/phone/libphone.so.0.9.5  -lpthread  /home/ap/installed/pjproject/lib/libpjproject.a  /usr/lib/x86_64-linux-gnu/libcrypto.so  /usr/lib/x86_64-linux-gnu/libssl.so  /usr/lib/x86_64-linux-gnu/libasound.so  /usr/lib/x86_64-linux-gnu/libopus.so && :
/usr/bin/ld: bin/phone/libphone.so.0.9.5: undefined reference to `uuid_unparse'
/usr/bin/ld: bin/phone/libphone.so.0.9.5: undefined reference to `uuid_generate'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Used HEAD from main and latest tagged release. Both has same errors.

One thing I should mention. On Debian Trixie gcc version is gcc (Debian 14.2.0-8) 14.2.0. To build with it I had to add include:

diff --git a/src/phone/include/phone_instance_t.h b/src/phone/include/phone_instance_t.h
index 2ebfdbb..1d34bfc 100644
--- a/src/phone/include/phone_instance_t.h
+++ b/src/phone/include/phone_instance_t.h
@@ -7,6 +7,7 @@
 #include <vector>
 #include <functional>
 #include <memory>
+#include <algorithm>
 
 namespace pj {
 class Endpoint;

No other edit to the source tree done.
Tried to use pjproject mentioned in README.md and from submodule with the same results.

Could you tell if those symbols belongs to libuuid or to pjproject itself?

sudo ldconfig -p | grep libuuid

libuuid.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libuuid.so.1
libuuid.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libuuid.so

UPD:
After adding libuuid to phone libs it seems to link properly now. cpp_cli seems to run now. Have to check it with SIP server now.

diff --git a/src/phone/CMakeLists.txt b/src/phone/CMakeLists.txt
index b922eb1..39316e5 100644
--- a/src/phone/CMakeLists.txt
+++ b/src/phone/CMakeLists.txt
@@ -5,6 +5,8 @@ pkg_check_modules(OPUS REQUIRED IMPORTED_TARGET opus)
 
 # configure git variables in version templates
 find_package(Git REQUIRED)
+find_library(LIBUUID uuid)
+
 execute_process(
         COMMAND ${GIT_EXECUTABLE} -C ${CMAKE_SOURCE_DIR} rev-parse HEAD
         RESULT_VARIABLE result
@@ -66,7 +68,7 @@ target_include_directories(phone
         PRIVATE
         include/phone)
 
-target_link_libraries(phone PRIVATE ${RESOLV_LIBRARY} stunning::stunning PkgConfig::PJPROJECT PkgConfig::OPUS)
+target_link_libraries(phone PRIVATE ${LIBUUID} ${RESOLV_LIBRARY} stunning::stunning PkgConfig::PJPROJECT PkgConfig::OPUS)
 
 set(phone_PUBLIC_HEADERS
         ${CMAKE_CURRENT_SOURCE_DIR}/include/phone.h
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

No branches or pull requests

1 participant