1

Я пытаюсь скомпилировать Azure storage C++ SDK на Fedora 22. Я использую gcc версию 5.1.1-1. Во время компиляции тестового приложения, используя следующую команду:undefined ссылка на символ 'pthread_rwlock_wrlock @@ GLIBC_2.2.5' в azure storage C++ sdk compilation

$> CASABLANCA_DIR=/source/codebox/azure/cpprestsdk/ CXX=g++ cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=on 

$> make 

Это производит следующее сообщение об ошибке:

/usr/bin/ld: CMakeFiles/azurestoragetest.dir/main.cpp.o: undefined reference to symbol '[email protected]@GLIBC_2.2.5' 
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line 
collect2: error: ld returned 1 exit status 
tests/CMakeFiles/azurestoragetest.dir/build.make:879: recipe for target 'Binaries/azurestoragetest' failed 
make[2]: *** [Binaries/azurestoragetest] Error 1 
CMakeFiles/Makefile2:125: recipe for target 'tests/CMakeFiles/azurestoragetest.dir/all' failed 
make[1]: *** [tests/CMakeFiles/azurestoragetest.dir/all] Error 2 
Makefile:126: recipe for target 'all' failed 
make: *** [all] Error 2 

Я могу видеть libpthread.so.0 библиотеку в /USR/lib64 каталог. Какую другую библиотеку мне нужно установить?

ответ

0

Добавить правильный find_package invokation к вашему CMakeLists.txt:

find_package(Threads) 

Затем связать библиотеку к вашей цели:

target_link_libraries(my_target ${CMAKE_THREAD_LIBS_INIT}) 

Это все. Вероятно, вы забыли target_link_libraries.

Смежные вопросы