Open inferrna opened 9 years ago
Looks like you do not have pthread library. I recommend do a "ldd libclblas.so" and install all the libraries clBLAS tries to link against.
Seems like it doesn't try to link against pthread.
Linking CXX shared library libclBLAS.so
[ 98%] Built target clBLAS
Linking CXX executable ../staging/clBLAS-client
../library/libclBLAS.so.2.8.0: undefined reference to `pthread_rwlock_destroy'
../library/libclBLAS.so.2.8.0: undefined reference to `pthread_rwlock_rdlock'
../library/libclBLAS.so.2.8.0: undefined reference to `pthread_rwlock_init'
../library/libclBLAS.so.2.8.0: undefined reference to `pthread_rwlock_unlock'
../library/libclBLAS.so.2.8.0: undefined reference to `pthread_rwlock_wrlock'
collect2: error: ld returned 1 exit status
client/CMakeFiles/client.dir/build.make:139: recipe for target 'staging/clBLAS-client' failed
make[2]: *** [staging/clBLAS-client] Error 1
CMakeFiles/Makefile2:77: recipe for target 'client/CMakeFiles/client.dir/all' failed
make[1]: *** [client/CMakeFiles/client.dir/all] Error 2
Makefile:136: recipe for target 'all' failed
make: *** [all] Error 2
inferno@inferno-X550LA:~/.dev/OpenCL/clBLAS/src/clblas$ ldd library/libclBLAS.so.2.8.0
linux-vdso.so.1 => (0x00007ffc48cd8000)
libOpenCL.so.1 => /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 (0x00007fb3c9085000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fb3c8d03000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb3c89fa000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb3c87e3000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb3c8419000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb3c8214000)
/lib64/ld-linux-x86-64.so.2 (0x000055e523015000)
inferno@inferno-X550LA:~/.dev/OpenCL/clBLAS/src/clblas$ nm -D /lib/x86_64-linux-gnu/libpthread.so.0 |grep pthread_rwlock_unlock
000000000000c940 T __pthread_rwlock_unlock
000000000000c940 W pthread_rwlock_unlock
Yeah, if pthread wasn't present in the system, I think the cmake step would fail, so I reckon that clBLAS is not actually trying to link with pthread at all. Also, I have the same error with my own clients, which I had to fix by linking the clients with pthread.
To follow up, from client you need to edit CMakeLists.txt in the src/client directory and change:
target_link_libraries(client ${Boost_LIBRARIES} ${OPENCL_LIBRARIES} clBLAS) to target_link_libraries(client ${Boost_LIBRARIES} ${OPENCL_LIBRARIES} clBLAS pthread)
and target_link_libraries(testPerfWrapper ${Boost_LIBRARIES}) to target_link_libraries(testPerfWrapper ${Boost_LIBRARIES} pthread)
this will allow you to build the client. A similar thing must be done to the sample CMakeLists.txt.
inferrna: that does "find /usr/lib -name "libpthread.so"" give you?
Linking CXX executable ../staging/clBLAS-client ../library/libclBLAS.so.2.8.0: undefined reference to
pthread_rwlock_destroy' ../library/libclBLAS.so.2.8.0: undefined reference to
pthread_rwlock_rdlock' ../library/libclBLAS.so.2.8.0: undefined reference topthread_rwlock_init' ../library/libclBLAS.so.2.8.0: undefined reference to
pthread_rwlock_unlock' ../library/libclBLAS.so.2.8.0: undefined reference to `pthread_rwlock_wrlock'