gpt4 book ai didi

c++ - synergy 1.4.16 编译失败 - 未定义对 `pthread_xxxx' 的引用

转载 作者:行者123 更新时间:2023-11-28 04:47:43 25 4
gpt4 key购买 nike

尝试在 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但是将 pthread 添加到 src/cmd/synergyd/CMakeLists.txt 上的 target_link_libraries 末尾的解决方案并没有解决我的问题,它仍然存在一样。

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

最佳答案

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

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

项目(协同 C CXX)

设置(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03 -pthread")

关于c++ - synergy 1.4.16 编译失败 - 未定义对 `pthread_xxxx' 的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48944179/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com