cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Wieke
Journeyman III

Error while compiling opencl samples (pthread_create and DSO related) on Ubuntu.

Hey everyone

So I've been trying to compile the opencl samples on my ubuntu laptop but I'm getting this error.


/opt/AMDAPP/samples$ cmake -G "Unix Makefiles" .
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/AMDAPP/samples
/opt/AMDAPP/samples$ make
[  1%] Built target AtomicCounters
[  2%] Built target BasicDebug
[  3%] Built target BinarySearch
[  4%] Built target BinomialOption
Linking CXX executable bin/x86_64/Release/BinomialOptionMultiGPU
/usr/bin/ld: CMakeFiles/BinomialOptionMultiGPU.dir/BinomialOptionMultiGPU.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]: *** [opencl/cl/BinomialOptionMultiGPU/bin/x86_64/Release/BinomialOptionMultiGPU] Error 1
make[1]: *** [opencl/cl/BinomialOptionMultiGPU/CMakeFiles/BinomialOptionMultiGPU.dir/all] Error 2
make: *** [all] Error 2


I've tried googling around and while this kind of error seems to occur more often I've only found questions regarding different software (not the AMD APP SDK) I couldn't figure out how to adapt their solutions to this situation. The bits that do manage to be built do appear to work, so that's good.

So does anyone here know how to fix this?

0 Likes
3 Replies
himanshu_gautam
Grandmaster

Hi

Have u got the solution for it?

0 Likes

SDK 2.9 does not build under Ubuntu, heaps of links are missing. Here's a complete list to change:

vim opencl/cl/BinomialOptionMultiGPU/CMakeLists.txt

ADDITIONAL_LIBS "rt" "pthread"

vim opencl/cl/BoxFilterGL/CMakeLists.txt

ADDITIONAL_LIBS "rt" "GLU" "X11"

vim opencl/cl/GaussianNoiseGL/CMakeLists.txt

ADDITIONAL_LIBS "rt" "GLU" "X11"

vim opencl/cl/KmeansAutoclustering/CMakeLists.txt

ADDITIONAL_LIBS "rt" "GLU"

vim opencl/cl/MonteCarloAsianMultiGPU/CMakeLists.txt

ADDITIONAL_LIBS "rt" "pthread"

vim opencl/cl/NBody/CMakeLists.txt

ADDITIONAL_LIBS "rt" "GLU"

vim opencl/cl/SimpleGL/CMakeLists.txt

ADDITIONAL_LIBS "rt" "GLU" "X11"

vim opencl/cl/SimpleMultiDevice/CMakeLists.txt

ADDITIONAL_LIBS "rt" "pthread

vim opencl/cpp_cl/URNGNoiseGL/CMakeLists.txt

ADDITIONAL_LIBS "rt" "GLU" "X11"

I do not have a solution for the Bolt samples, but it's really funny how an SDK is released, when a supported platform is just so far away from building the samples.

Hello Meteorhead,

maybe my answer is a little bit outdated - but your solution helped me a lot. Thank you!

I think your solution is for Ubuntu Linux platform. Here is a little bit more elaborated excerpt from a modified


opencl/cl/GaussianNoiseGL/CMakeLists.txt


file:


# Link GL library. cygwin, mingw names GL libs as libopengl32, linux names it as libGL


if( MINGW OR CYGWIN )


    set( ADDITIONAL_LIBRARIES ${ADDITIONAL_LIBRARIES} "opengl32" "glu32" )


else( )    # Native Linux OS


    set( ADDITIONAL_LIBRARIES ${ADDITIONAL_LIBRARIES} "GL" "rt" "GLU" "X11" )


endif( )


The unmodified line under 


# Native Linux OS


looks as follows:


set( ADDITIONAL_LIBRARIES ${ADDITIONAL_LIBRARIES} "GL" )


I think another important step is to ensure that the libs are linked (symbolic links) in the right way, e.g.


/usr/lib/x86_64-linux-gnu/libGL.so -> /usr/lib/fglrx/libGL.so.1.2


/usr/lib/x86_64-linux-gnu/libGL.so.1 -> /usr/lib/fglrx/libGL.so.1.2


in case of using an AMD GPU with Catalyst driver. Depending in which order libs or packages are installed, the symbolic links may be wrong.

Cheers,

Salamo

0 Likes