![编译 HHVM-如何将 libpthread 添加到链接器?](https://linux22.com/image/966929/%E7%BC%96%E8%AF%91%20HHVM-%E5%A6%82%E4%BD%95%E5%B0%86%20libpthread%20%E6%B7%BB%E5%8A%A0%E5%88%B0%E9%93%BE%E6%8E%A5%E5%99%A8%EF%BC%9F.png)
我在尝试着编译 HipHop VM在 Ubuntu 13.04 上出现以下错误消息:
Linking CXX executable gen-ext-hhvm
/usr/bin/ld: ../../../bin/libfolly.a(ExceptionTracerLib.cpp.o): undefined reference to symbol 'pthread_once@@GLIBC_2.2.5'
/usr/bin/ld: note: 'pthread_once@@GLIBC_2.2.5' is defined in DSO /lib/x86_64-linux-gnu/libpthread.so.0 so try adding it to the linker command line
我尝试在 CMake/HPHPFindLibs.cmake 中添加类似 target_link_libraries({$target} /lib/x86_64-linux-gnu/libpthread.so.0) 的内容,但没有成功。
我应该添加什么以及在哪里添加才能使其正常工作?
答案1
尝试将以下内容添加到 cmake 文件:
find_package(Threads REQUIRED)
target_link_libraries({$target} ${CMAKE_THREAD_LIBS_INIT})