bgaster / opencl-book-samples

Automatically exported from code.google.com/p/opencl-book-samples
162 stars 108 forks source link

failed to build #82

Open ghost opened 6 years ago

ghost commented 6 years ago

trying to build examples

mkdir build cd build cmake .. make

Unfortunately end up with build errors, can you help what might go wrong?

[ 77%] Linking CXX executable Dijkstra
/usr/lib/gcc/aarch64-poky-linux/6.2.0/../../../../aarch64-poky-linux/bin/ld: CMakeFiles/Dijkstra.dir/oclDijkstraKernel.cpp.o: undefined reference to symbol 'pthread_join@@GLIBC_2.17'
//lib/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [src/Chapter_16/Dijkstra/CMakeFiles/Dijkstra.dir/build.make:123: src/Chapter_16/Dijkstra/Dijkstra] Error 1
make[1]: *** [CMakeFiles/Makefile2:537: src/Chapter_16/Dijkstra/CMakeFiles/Dijkstra.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
aforembs commented 5 years ago

You can fix this error by adding -lpthread to Chapter_16/Djikstra/CMakeLists.txt

target_link_libraries( Dijkstra ${OPENCL_LIBRARIES} ${Boost_LIBRARIES} -lpthread )