synergy 1.4.16无法编译 - 未定义引用`pthread_xxxx'

时间:2018-02-23 08:47:18

标签: c++ pthreads raspberry-pi3 raspbian

当试图在Mint 17.1(Rebecca)上编译synergy 1.4.16时,我收到以下错误:

../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::newMutex()':
CArchMultithreadPosix.cpp:(.text+0x319): undefined reference to `pthread_mutexattr_init'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::raiseSignal(IArchMultithread::ESignal)':
CArchMultithreadPosix.cpp:(.text+0x43b): undefined reference to `pthread_kill'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::threadSignalHandler(void*)':
CArchMultithreadPosix.cpp:(.text+0x490): undefined reference to `pthread_detach'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::closeThread(CArchThreadImpl*)':
CArchMultithreadPosix.cpp:(.text+0x62b): undefined reference to `pthread_detach'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::newThread(void* (*)(void*), void*)':
CArchMultithreadPosix.cpp:(.text+0x8e6): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0x90f): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0x935): undefined reference to `pthread_create'
CArchMultithreadPosix.cpp:(.text+0x9a4): undefined reference to `pthread_create'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::CArchMultithreadPosix()':
CArchMultithreadPosix.cpp:(.text+0xe11): undefined reference to `pthread_mutexattr_init'
CArchMultithreadPosix.cpp:(.text+0xf05): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0xf26): undefined reference to `pthread_sigmask'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::startSignalHandler()':
CArchMultithreadPosix.cpp:(.text+0x10a8): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0x10cd): undefined reference to `pthread_sigmask'
CArchMultithreadPosix.cpp:(.text+0x1104): undefined reference to `pthread_create'
../../../../../lib/libarch.a(CArchMultithreadPosix.o): In function `CArchMultithreadPosix::cancelThread(CArchThreadImpl*)':
CArchMultithreadPosix.cpp:(.text+0x5e3): undefined reference to `pthread_kill'
collect2: error: ld returned 1 exit status
make[2]: *** [../../bin/synergyd] Error 1
make[1]: *** [src/cmd/synergyd/CMakeFiles/synergyd.dir/all] Error 2
make: *** [all] Error 2
Going back to: /home/jussi/Downloads/synergy-1.4.16/synergy-1.4.16-Source
Error: make failed: 512

我已经尝试过针对相同问题here的解决方案,但在pthreadtarget_link_libraries末尾添加src/cmd/synergyd/CMakeLists.txt的解决方案无法解决我的问题,它仍然存在同样的。

我没有使用预编译软件包的唯一原因是我需要使用与我的Raspberry Pi 3的协同作用,并且通过packge repos提供的软件包具有不兼容的协同协议 - 在Pi与1.4.12上的1.4.16 Mint 17.1因此,在每台机器上具有兼容协议的替代解决方案也是足够的。

2 个答案:

答案 0 :(得分:1)

在CMakeList.txt中的项目定义之后设置CMAKE_CXX_FLAGS使其对我有用:

首先,声明项目(对于先决条件检查很重要)。

项目(协同C CXX)

set(CMAKE_CXX_FLAGS“ $ {CMAKE_CXX_FLAGS} -std = c ++ 03 -pthread”)

答案 1 :(得分:0)

确定了另一种解决方案:我通过(ab?)解决了这个问题,使用了具有更高协议版本的协同服务器似乎与旧协议版本向后兼容的事实,所以我编译了版本1.8.something和我的Pi 1.4.16上的客户很高兴连接,我现在可以与Pi共享连接到我的Mint的键盘和鼠标。