Items with no label
3335 Discussions

Cant compile realsense viewer/tools

RTasa
New Contributor I
1,669 Views

I was able to build the examples and see the camera functions.

I went to build the tools and this is the error I received.

/usr/bin/x86_64-linux-gnu-ld: CMakeFiles/realsense-viewer.dir/realsense-viewer.cpp.o: undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'

//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line

collect2: error: ld returned 1 exit status

realsense-viewer/CMakeFiles/realsense-viewer.dir/build.make:227: recipe for target 'realsense-viewer/realsense-viewer' failed

make[2]: *** [realsense-viewer/realsense-viewer] Error 1

CMakeFiles/Makefile2:250: recipe for target 'realsense-viewer/CMakeFiles/realsense-viewer.dir/all' failed

make[1]: *** [realsense-viewer/CMakeFiles/realsense-viewer.dir/all] Error 2

Makefile:129: recipe for target 'all' failed

make: *** [all] Error 2

0 Kudos
1 Solution
RTasa
New Contributor I
605 Views

Answering my own question.

A file named CMakeLists.txt

contains line

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

and it needs to be

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")

Adding the pthread option fixes the error.

View solution in original post

0 Kudos
1 Reply
RTasa
New Contributor I
606 Views

Answering my own question.

A file named CMakeLists.txt

contains line

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

and it needs to be

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")

Adding the pthread option fixes the error.

0 Kudos
Reply