Reputation: 179
I am using Visual Studio to remotely build and debug code for my BeagleBoneBlack (BBB). I have connected to it using remote connection session using SSH as in this image -
When I build the code, all the files get copied to my BBB as expected. But when I build the code, I get a bunch of linker errors, particularly for the pthread
library.
1>Linking objects
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/BoxMapperII.o: in function `GetNextVial(_VIAL_TAG_&)':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\BoxMapperII.cpp(2529): error : undefined reference to `pthread_mutex_trylock'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/BoxMapperII.o: in function `SetNextVial(_VIAL_TAG_)':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\BoxMapperII.cpp(2551): error : undefined reference to `pthread_mutex_trylock'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/Hardware.o: in function `CHardware::ShutDownMon()':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\Hardware.cpp(333): error : undefined reference to `pthread_create'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/LED_Control.o: in function `CLED_Control::InitLED_Control()':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\LED_Control.cpp(44): error : undefined reference to `pthread_create'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/ListenSocket.o: in function `CListenSocket::Close()':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\ListenSocket.cpp(64): error : undefined reference to `pthread_cancel'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/ListenSocket.cpp:66: undefined reference to `pthread_join'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/ListenSocket.o: in function `CListenSocket::Init(_SERVICE_CONFIG const&)':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\ListenSocket.cpp(186): error : undefined reference to `pthread_create'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/ServerSocket.o: in function `CServerSocket::Close()':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\ServerSocket.cpp(84): error : undefined reference to `pthread_cancel'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/ServerSocket.cpp:87: undefined reference to `pthread_join'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/ServerSocket.o: in function `CServerSocket::Init(unsigned int)':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\ServerSocket.cpp(101): error : undefined reference to `pthread_create'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/UARTCommunication.o: in function `CUARTCommunication::InitUART(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned int)':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\UARTCommunication.cpp(59): error : undefined reference to `pthread_create'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/UARTCommunication.o: in function `boost::asio::detail::posix_event::posix_event()':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\boost\asio\detail\impl\posix_event.ipp(44): error : undefined reference to `pthread_condattr_setclock'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/UARTCommunication.o: in function `boost::asio::detail::posix_thread::~posix_thread()':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\boost\asio\detail\impl\posix_thread.ipp(35): error : undefined reference to `pthread_detach'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/UARTCommunication.o: in function `boost::asio::detail::posix_thread::join()':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\boost\asio\detail\impl\posix_thread.ipp(42): error : undefined reference to `pthread_join'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/UARTCommunication.o: in function `boost::asio::detail::posix_thread::start_thread(boost::asio::detail::posix_thread::func_base*)':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\boost\asio\detail\impl\posix_thread.ipp(59): error : undefined reference to `pthread_create'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/UARTCommunication.o: in function `boost::asio::detail::posix_signal_blocker::posix_signal_blocker()':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\boost\asio\detail\posix_signal_blocker.hpp(43): error : undefined reference to `pthread_sigmask'
1>/usr/bin/ld : error : /home/debian/projects/BM_II/obj/ARM/Debug/UARTCommunication.o: in function `boost::asio::detail::posix_signal_blocker::~posix_signal_blocker()':
1>C:\Users\ColdSIGHT II\OneDrivem\Documents\BM_II\BM_II\BM_II\boost\asio\detail\posix_signal_blocker.hpp(50): error : undefined reference to `pthread_sigmask'
1>collect2 : error : ld returned 1 exit status
1>Done building project "BM_II.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 5:13 PM and took 04:56.379 minutes ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
========== Deploy started at 5:13 PM and took 04:56.379 minutes ==========
I see that my pthread.h
is located in the local folder - C:\Users\ColdSIGHTII\AppData\Local\Microsoft\Linux\HeaderCache\1.0\-689744971\usr\include\linux
. I don't understand why pthead.h
is the only library that is not linked. There are other libraries such as stdio.h
that my source code uses and they are located in the same folder as well.But they do not give the linker errors. Please let me know what I am doing wrong. Thank you.
Edit - My configuration for linker looks like this -
Upvotes: 0
Views: 35