Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' #3

Closed
jasjuang opened this issue Jul 26, 2016 · 8 comments
Closed

undefined reference to symbol 'pthread_create@@GLIBC_2.2.5' #3

jasjuang opened this issue Jul 26, 2016 · 8 comments

Comments

@jasjuang
Copy link

I am on Ubuntu 14.04 LTS. I followed the exact same steps listed in the Readme file in surround360_render. When compiling the below error shows

[ 42%] Building CXX object CMakeFiles/LibVrCamera.dir/source/util/CvUtil.cpp.o
[ 46%] Building CXX object CMakeFiles/LibVrCamera.dir/source/util/JsonUtil.cpp.o
[ 50%] Building CXX object CMakeFiles/LibVrCamera.dir/source/util/StringUtil.cpp.o
Linking CXX static library lib/libLibVrCamera.a
[ 50%] Built target LibVrCamera
[ 53%] Building CXX object CMakeFiles/Raw2Rgb.dir/source/camera_isp/Raw2Rgb.cpp.o
Linking CXX executable bin/Raw2Rgb
/usr/bin/ld: CMakeFiles/Raw2Rgb.dir/source/camera_isp/Raw2Rgb.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
make[2]: *** [bin/Raw2Rgb] Error 1
make[1]: *** [CMakeFiles/Raw2Rgb.dir/all] Error 2
make: *** [all] Error 2

This is tested in both release mode and debug mode

@apparrapo
Copy link

Hi @jasjuang, can you try replacing line 31 in

https://github.com/facebook/Surround360/blob/master/surround360_render/CMakeLists.txt

with

SET(PLATFORM_SPECIFIC_LIBS "-lpthread")

and see if that solves the problem?

Thanks :)

@jasjuang
Copy link
Author

It doesn't. However I figured out if I edit line 21 to be

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

It compiles fine for me.

ghost pushed a commit that referenced this issue Jul 27, 2016
Summary:
Ref: #3

`undefined reference to symbol 'pthread_create@GLIBC_2.2.5'` when compiling rendering software.

We explicitly add `pthread` to make sure it's used. clang doesn't use this argument, so we only apply it if not `APPLE`

No need to use `PLATFORM_SPECIFIC_LIBS`.

Differential Revision: D3625661

fbshipit-source-id: c95df0c41cfdb1482fd4ec30e0e0327158f4923a
@ghost
Copy link

ghost commented Nov 13, 2018

Tanks, it is a perfect idea for my question.

@mosjin
Copy link

mosjin commented Dec 11, 2018

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

also works for me.

@kamdoumloich
Copy link

Adding -pthread to C++ compiler flags worked for me

@edisonlo
Copy link

edisonlo commented Mar 5, 2019

Adding -pthread to C++ compiler flags worked for me

this solved the problem!!!

@jxzeng-git
Copy link

Adding -pthread to C++ compiler flags worked for me

it works for me too!thank you!

@ruiyuanlu
Copy link

It doesn't. However I figured out if I edit line 21 to be

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

It compiles fine for me.

It works for me too, thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants