Errors Compiling OpenCV on Debian - c++

I installed OpenCV from the repos on my Debian Wheezy (64bits). I was able to compile the source file of an example but when it goes to the build step this happens:
g++ -o dist/Debug/GNU-Linux-x86/opencvtestapp build/Debug/GNU-Linux-x86/main.o
build/Debug/GNU-Linux-x86/main.o: In function `main':
/home/ ... /main.cpp:9: undefined reference to `cv::VideoCapture::VideoCapture(int)'
/home/ ... /main.cpp:11: undefined reference to `cv::VideoCapture::isOpened() const'
/home/ ... /main.cpp:16: undefined reference to `cv::VideoCapture::get(int)'
/home/ ... /main.cpp:17: undefined reference to `cv::VideoCapture::get(int)'
/home/ ... /main.cpp:21: undefined reference to `cv::namedWindow(std::string const&, int)'
/home/ ... /main.cpp:26: undefined reference to `cv::VideoCapture::read(cv::Mat&)'
/home/ ... /main.cpp:33: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
/home/ ... /main.cpp:33: undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'
/home/ ... /main.cpp:35: undefined reference to `cv::waitKey(int)'
/home/ ... /main.cpp:40: undefined reference to `cv::VideoCapture::~VideoCapture()'
/home/ ... /main.cpp:40: undefined reference to `cv::VideoCapture::~VideoCapture()'
build/Debug/GNU-Linux-x86/main.o: In function `cv::Mat::~Mat()':
/usr/include/opencv2/core/mat.hpp:297: undefined reference to `cv::fastFree(void*)'
build/Debug/GNU-Linux-x86/main.o: In function `cv::Mat::release()':
/usr/include/opencv2/core/mat.hpp:382: undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/opencvtestapp] Error 1
make[2]: Leaving directory `/home/work/OpenCVTestApp'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/work/OpenCVTestApp'
make: *** [.build-impl] Error 2
I am using NetBeans 8.0 and OpenCV2.3 (from the repo).
Any suggestions on what I could be missing?
Thanks!

#berak is totally right on his comment, for that was the problem.
I forgot to add the libraries to the linker configuration. :P
As for 2.3 in 2014: I agree. I am planning to use 3.o alpha but this is what the repo had and I didn't want to compile the whole thing just to run some samples.
Thank you #berac! I hope the question is still useful for someone out there.

Related

MicroROS build_agent.sh fails

I'm following the tutorial for microROS for teensy found here
https://micro.ros.org/docs/tutorials/core/teensy_with_arduino/
Everything up to the build step works ok, but build fails, error output below, but before we get to that, I wanted to provide some more context:
Building this inside a docker container on Nvidia Jetson Nano 4GB (B01)
/etc/nv_tegra_release
L4T BSP Version: L4T R32.7.1
I tried it with several container images found here:
https://github.com/dusty-nv/jetson-containers
ROS2Foxy:
dustynv/ros:foxy-ros-base-l4t-r32.7.1
dustynv/ros:foxy-pytorch-l4t-r32.7.1
When I launched the docker container in both tests I used either:
./scripts/docker_run.sh -c dustynv/ros:foxy-ros-base-l4t-r32.7.1
./scripts/docker_run.sh -c dustynv/ros:foxy-pytorch-l4t-r32.7.1
once inside the docker container This is the bit where it all goes south:
Build step
ros2 run micro_ros_setup build_agent.sh
Below the parts of the output trace that are relevant:
[Processing: micro_ros_agent]
[Processing: micro_ros_agent]
[Processing: micro_ros_agent]
[Processing: micro_ros_agent]
[Processing: micro_ros_agent]
--- stderr: micro_ros_agent
Cloning into 'xrceagent'...
Switched to a new branch 'ros2'
HEAD is now at 3eb56b5 Release v2.3.0
Cloning into 'spdlog'...
HEAD is now at eb322062 Bump version to 1.9.2
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
The package name passed to `find_package_handle_standard_args` (tinyxml2)
does not match the name of the calling package (TinyXML2). This can lead
to problems in calling code that expects `find_package` result variables
(e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
cmake/modules/FindTinyXML2.cmake:40 (find_package_handle_standard_args)
/opt/ros/foxy/install/share/fastrtps/cmake/fastrtps-config.cmake:51 (find_package)
CMakeLists.txt:153 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `fmt::v6::internal::basic_data<void>::signs'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `vtable for fmt::v6::format_error'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `int fmt::v6::internal::snprintf_float<double>(double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `fmt::v6::internal::error_handler::on_error(char const*)'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `char fmt::v6::internal::decimal_point_impl<char>(fmt::v6::internal::locale_ref)'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `fmt::v6::internal::basic_data<void>::zero_or_powers_of_10_32'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `char fmt::v6::internal::thousands_sep_impl<char>(fmt::v6::internal::locale_ref)'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `std::locale fmt::v6::internal::locale_ref::get<std::locale>() const'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `typeinfo for fmt::v6::format_error'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > fmt::v6::internal::grouping_impl<char>(fmt::v6::internal::locale_ref)'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `int fmt::v6::internal::format_float<long double>(long double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `spdlog::details::log_msg::log_msg(spdlog::source_loc, fmt::v6::basic_string_view<char>, spdlog::level::level_enum, fmt::v6::basic_string_view<char>)'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `int fmt::v6::internal::snprintf_float<long double>(long double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `fmt::v6::format_error::~format_error()'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `fmt::v6::internal::basic_data<void>::hex_digits'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `fmt::v6::internal::basic_data<void>::digits'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `int fmt::v6::internal::format_float<double>(double, int, fmt::v6::internal::float_specs, fmt::v6::internal::buffer<char>&)'
/microros_ws/install/micro_ros_agent/lib/libmicroxrcedds_agent.so.2.3.0: undefined reference to `fmt::v6::internal::basic_data<void>::zero_or_powers_of_10_64'
collect2: error: ld returned 1 exit status
make[5]: *** [micro_ros_agent] Error 1
make[4]: *** [CMakeFiles/micro_ros_agent.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [micro_ros_agent-prefix/src/micro_ros_agent-stamp/micro_ros_agent-build] Error 2
make[1]: *** [CMakeFiles/micro_ros_agent.dir/all] Error 2
make: *** [all] Error 2
---
Failed <<< micro_ros_agent [10min 2s, exited with code 2]
Summary: 1 package finished [10min 48s]
1 package failed: micro_ros_agent
1 package had stderr output: micro_ros_agent
I have also tried to completely reformat the SD card for the Jetson and start fresh. Same problem. So far I have spent 2 fulls days trying to overcome this problem. I think it is time to throw up my arms and ask for some kind soul out there to provide some insight!

Undefined reference error C++ in example program

I'm trying to run some example code from this repository
When going to the example folder (/binacpp/example) and run i.e.
./example.run.sh
It works.
However when I update the file (even with just an extra space in a comment) and try to recompile the program by typing:
make example
Then I get this error:
Making example
g++ -I../lib/libcurl-7.56.0/include -I../lib/jsoncpp-1.8.3/include -I../lib/libwebsockets-2.4.0/include -I../lib/libbinacpp/include \
example.cpp \
-L../lib/libcurl-7.56.0/lib \
-L../lib/libwebsockets-2.4.0/lib \
-L../lib/libbinacpp/lib \
-lcurl -lcrypto -lwebsockets -lbinacpp -o example
/tmp/ccCycCcN.o: In function `ws_depth_onData(Json::Value&)':
example.cpp:(.text+0xd85): undefined reference to `Json::Value::asString[abi:cxx11]() const'
example.cpp:(.text+0xdf0): undefined reference to `Json::Value::asString[abi:cxx11]() const'
example.cpp:(.text+0xf79): undefined reference to `Json::Value::asString[abi:cxx11]() const'
example.cpp:(.text+0xfe4): undefined reference to `Json::Value::asString[abi:cxx11]() const'
/tmp/ccCycCcN.o: In function `ws_klines_onData(Json::Value&)':
example.cpp:(.text+0x1255): undefined reference to `Json::Value::asString[abi:cxx11]() const'
/tmp/ccCycCcN.o:example.cpp:(.text+0x1317): more undefined references to `Json::Value::asString[abi:cxx11]() const' follow
/tmp/ccCycCcN.o: In function `main':
example.cpp:(.text+0x22c4): undefined reference to `BinaCPP::init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&)'
example.cpp:(.text+0x242d): undefined reference to `Json::Value::asString[abi:cxx11]() const'
example.cpp:(.text+0x24aa): undefined reference to `Json::Value::asString[abi:cxx11]() const'
example.cpp:(.text+0x25e5): undefined reference to `Json::Value::asString[abi:cxx11]() const'
example.cpp:(.text+0x2659): undefined reference to `Json::Value::asString[abi:cxx11]() const'
example.cpp:(.text+0x27d2): undefined reference to `Json::Value::asString[abi:cxx11]() const'
/tmp/ccCycCcN.o:example.cpp:(.text+0x28a2): more undefined references to `Json::Value::asString[abi:cxx11]() const' follow
collect2: error: ld returned 1 exit status
Makefile:25: recipe for target 'example' failed
make: *** [example] Error 1
I looked this error up and I'm guessing this is a linker error like described in this post. However I'm coming from Python and new to C++ and just don't see what is wrong. I see that the .h files are included and in
binacpp_websocket.h
I see
typedef int (*CB)(Json::Value &json_value );
Why am I getting the error?
NOTE: When trying to run the command "make example" I got the error:
Making example
g++ -I../lib/libcurl-7.56.0/include -I../lib/jsoncpp-1.8.3/include -I../lib/libwebsockets-2.4.0/include -I../lib/libbinacpp/include \
example.cpp \
-L../lib/libcurl-7.56.0/lib \
-L../lib/libwebsockets-2.4.0/lib \
-L../lib/libbinacpp/lib \
-lcurl -ljsoncpp -lcrypto -lwebsockets -lbinacpp -o example
/usr/bin/ld: cannot find -ljsoncpp
collect2: error: ld returned 1 exit status
Makefile:25: recipe for target 'example' failed
make: *** [example] Error 1
Somewhere in the repo (I cannot find it now) it said that "-ljsoncpp" shouldn't be there. After removing this the compiler did run but it gave the linker error.

synergy 1.4.16 fails to compile - undefined reference to `pthread_xxxx'

When attempting to compile synergy 1.4.16 on a Mint 17.1 (Rebecca) I get the following error:
../../../../../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
I already tried the solution to the identical problem here but the solution of adding pthreadto the end of target_link_libraries on src/cmd/synergyd/CMakeLists.txt does not resolve my issue, it remains the same.
The only reason I'm not using pre-compiled packages is that I need to use synergy with my Raspberry Pi 3 and the packages available through the packge repos have incompatible synergy protocols - 1.4.16 on Pi vs 1.4.12 on Mint 17.1 so an alternative solution to have compatible protocols on each of the machines will also be sufficient.
Setting CMAKE_CXX_FLAGS after project definition in CMakeList.txt made it to work for me:
First, declare project (important for prerequisite checks).
project(synergy C CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03 -pthread")
Identified an alternative solution: I worked my way around this by (ab?)using the fact that the synergy server with higher protocol version seems to be backwards-compatible with older protocol versions, so I compiled the version 1.8.something and the client on my Pi with 1.4.16 is happy to connect and I can now share the keyboard and mouse connected to my Mint with the Pi.

Including c++ libraries (opencv) on remote build raspberry pi

I'm stuck trying to get some openCV code working on my raspberry pi. I'm almost certain the problem is caused by the linker not knowing where the openCV library files are but I'm unfamiliar with both Linux and Netbeans so I'm in a bit of a pickle!
So, in short, my set-up is: attempting to build my code to my raspberryPi via remote C++ build host (G++). I am writing my code in Netbeans.
The builds worked fine up until the point I wrote two new classes using the "opencv2/core/core.hpp"
Now, when I attempt to build, I get the following error/s:
Copying project files to /home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64 at pi#192.168.1.99
Building project files list...
Checking directory structure...
Checking previously uploaded files...
Checking links...
Uploading changed files:
Zipping 1 changed files...
Uploading zip to pi#192.168.1.99...
Unzipping changed files...
Checking exec permissions...
Uploading changed files finished successfully.
cd '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test'
/usr/bin/make -f Makefile CONF=Release
"/usr/bin/make" -f nbproject/Makefile-Release.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test'
"/usr/bin/make" -f nbproject/Makefile-Release.mk IOTestBuild
make[2]: Entering directory '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test'
g++ -o IOTestBuild build/Release/GNU-Linux/CommsManager.o build/Release/GNU-Linux/ImageManager.o build/Release/GNU-Linux/Server.o build/Release/GNU-Linux/main.o -L../../opencv- -lwiringPi -opencv
build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::getStoredImg()':
ImageManager.cpp:(.text+0xcc): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::ImageManager()':
ImageManager.cpp:(.text+0x134): undefined reference to `cv::VideoCapture::VideoCapture()'
ImageManager.cpp:(.text+0x1c0): undefined reference to `cv::Mat::deallocate()'
ImageManager.cpp:(.text+0x288): undefined reference to `cv::Mat::deallocate()'
ImageManager.cpp:(.text+0x2b8): undefined reference to `cv::fastFree(void*)'
ImageManager.cpp:(.text+0x2c0): undefined reference to `cv::VideoCapture::VideoCapture()'
ImageManager.cpp:(.text+0x32c): undefined reference to `cv::VideoCapture::~VideoCapture()'
ImageManager.cpp:(.text+0x344): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
ImageManager.cpp:(.text+0x350): undefined reference to `cv::Ptr<CvCapture>::delete_obj()'
ImageManager.cpp:(.text+0x358): undefined reference to `cv::fastFree(void*)'
ImageManager.cpp:(.text+0x36c): undefined reference to `cv::VideoCapture::~VideoCapture()'
ImageManager.cpp:(.text+0x388): undefined reference to `cv::VideoCapture::~VideoCapture()'
build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::~ImageManager()':
ImageManager.cpp:(.text+0x3a0): undefined reference to `cv::VideoCapture::~VideoCapture()'
ImageManager.cpp:(.text+0x404): undefined reference to `cv::fastFree(void*)'
ImageManager.cpp:(.text+0x414): undefined reference to `cv::Mat::deallocate()'
build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::getRawImg(cv::Mat*)':
ImageManager.cpp:(.text+0x43c): undefined reference to `cv::VideoCapture::open(int)'
ImageManager.cpp:(.text+0x450): undefined reference to `cv::VideoCapture::operator>>(cv::Mat&)'
ImageManager.cpp:(.text+0x494): undefined reference to `cv::VideoCapture::release()'
build/Release/GNU-Linux/ImageManager.o: In function `ImageManager::updateFrame()':
ImageManager.cpp:(.text+0x5f0): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
ImageManager.cpp:(.text+0x67c): undefined reference to `cv::fastFree(void*)'
ImageManager.cpp:(.text+0x6b8): undefined reference to `cv::Mat::deallocate()'
ImageManager.cpp:(.text+0x6c4): undefined reference to `cv::Mat::deallocate()'
build/Release/GNU-Linux/ImageManager.o: In function `cv::Mat::~Mat()':
ImageManager.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x68): undefined reference to `cv::fastFree(void*)'
ImageManager.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x74): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
nbproject/Makefile-Release.mk:65: recipe for target 'IOTestBuild' failed
make[2]: *** [IOTestBuild] Error 1
make[2]: Leaving directory '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test'
nbproject/Makefile-Release.mk:62: recipe for target '.build-conf' failed
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory '/home/pi/.netbeans/remote/192.168.1.99/desktop-g6lev01-Windows-x86_64/E/Work/RasberryPi/Code/Raspberrypi_Test'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 701ms)
Any ideas?
I'm sure I just need to point the linker to the appropriate libs but I've no idea how to specify that relative path when using a build host.
Regards
Guy

synergy won't compile -- undefined reference to `pthread_xxxx

When following the build instructions for Synergy, I get the following errors.
Is there an already-developed solution to get Synergy to build?
If not, how do I get Synergy to compile on Ubuntu 13.10?
../../../../../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: /usr/local/src/synergy-1.4.15-Source
Error: make failed: 512
SOLUTION: manually change the order of the contents of /synergy-1.4.15-Source/src/cmd/synergyd/CMakeFiles/synergyd.dir/link.txt to put -lpthread contents last.
You'd rather edit the CMakelists.txt file to add pthread at the end of the target_link_libraries command.
You may also add link_libraries(pthread).