clMathLibraries / clBLAS

a software library containing BLAS functions written in OpenCL
Apache License 2.0
843 stars 237 forks source link

Setting BUILD_CLIENT=ON results in linker errors #308

Closed vedranmiletic closed 7 years ago

vedranmiletic commented 7 years ago

Building clBLAS master on Fedora 25 with GCC 6.3.1, Mesa 17.1 git and ocl-icd 2.2.11. When BUILD_CLIENT=ON, make results in:

CMakeFiles/client.dir/client.cpp.o: In function `xGemm<float>::validation()':
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1242: undefined reference to `cblas_sgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, float, float const*, int, float const*, int, float, float*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1244: undefined reference to `cblas_saxpy(int, float, float const*, int, float*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1245: undefined reference to `cblas_snrm2(int, float const*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1246: undefined reference to `cblas_snrm2(int, float const*, int)'
CMakeFiles/client.dir/client.cpp.o: In function `xGemm<double>::validation()':
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1260: undefined reference to `cblas_dgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, double, double const*, int, double const*, int, double, double*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1262: undefined reference to `cblas_daxpy(int, double, double const*, int, double*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1263: undefined reference to `cblas_dnrm2(int, double const*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1264: undefined reference to `cblas_dnrm2(int, double const*, int)'
CMakeFiles/client.dir/client.cpp.o: In function `xGemm<cl_float2>::validation()':
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1278: undefined reference to `cblas_cgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, void const*, void const*, int, void const*, int, void const*, void*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1281: undefined reference to `cblas_caxpy(int, void const*, void const*, int, void*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1282: undefined reference to `cblas_scnrm2(int, void const*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1283: undefined reference to `cblas_scnrm2(int, void const*, int)'
CMakeFiles/client.dir/client.cpp.o: In function `xGemm<cl_double2>::validation()':
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1297: undefined reference to `cblas_zgemm(CBLAS_ORDER, CBLAS_TRANSPOSE, CBLAS_TRANSPOSE, int, int, int, void const*, void const*, int, void const*, int, void const*, void*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1300: undefined reference to `cblas_zaxpy(int, void const*, void const*, int, void*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1301: undefined reference to `cblas_dznrm2(int, void const*,[ 66%] Building C object samples/CMakeFiles/example_strmv.dir/example_strmv.c.o
 int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xgemm.hpp:1302: undefined reference to `cblas_dznrm2(int, void const*, int)'
CMakeFiles/client.dir/client.cpp.o: In function `xTrmm<float>::validation()':
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:831: undefined reference to `cblas_strmm(CBLAS_ORDER, CBLAS_SIDE, CBLAS_UPLO, CBLAS_TRANSPOSE, CBLAS_DIAG, int, int, float, float const*, int, float*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:833: undefined reference to `cblas_saxpy(int, float, float const*, int, float*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:834: undefined reference to `cblas_snrm2(int, float const*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:835: undefined reference to `cblas_snrm2(int, float const*, int)'
CMakeFiles/client.dir/client.cpp.o: In function `xTrmm<double>::validation()':
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:851: undefined reference to `cblas_dtrmm(CBLAS_ORDER, CBLAS_SIDE, CBLAS_UPLO, CBLAS_TRANSPOSE, CBLAS_DIAG, int, int, double, double const*, int, double*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:853: undefined reference to `cblas_daxpy(int, double, double const*, int, double*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:854: undefined reference to `cblas_dnrm2(int, double const*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:855: undefined reference to `cblas_dnrm2(int, double const*, int)'
CMakeFiles/client.dir/client.cpp.o: In function `xTrmm<cl_float2>::validation()':
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:870: undefined reference to `cblas_ctrmm(CBLAS_ORDER, CBLAS_SIDE, CBLAS_UPLO, CBLAS_TRANSPOSE, CBLAS_DIAG, int, int, void const*, void const*, int, void*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:873: undefined reference to `cblas_caxpy(int, void const*, void const*, int, void*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:874: undefined reference to `cblas_scnrm2(int, void const*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:875: undefined reference to `cblas_scnrm2(int, void const*, int)'
CMakeFiles/client.dir/client.cpp.o: In function `xTrmm<cl_double2>::validation()':
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:891: undefined reference to `cblas_ztrmm(CBLAS_ORDER, CBLAS_SIDE, CBLAS_UPLO, CBLAS_TRANSPOSE, CBLAS_DIAG, int, int, void const*, void const*, int, void*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:894: undefined reference to `cblas_zaxpy(int, void const*, void const*, int, void*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:895: undefined reference to `cblas_dznrm2(int, void const*, int)'
/users/miletivn/workspace/clBLAS/src/client/clfunc_xtrmm.hpp:896: undefined reference to `cblas_dznrm2(int, void const*, int)'
collect2: error: ld returned 1 exit status
client/CMakeFiles/client.dir/build.make:151: recipe for target 'staging/clBLAS-client' failed
make[2]: *** [staging/clBLAS-client] Error 1
CMakeFiles/Makefile2:87: recipe for target 'client/CMakeFiles/client.dir/all' failed
make[1]: *** [client/CMakeFiles/client.dir/all] Error 2
tingxingdong commented 7 years ago

u need to link with cblas. see https://github.com/clMathLibraries/clBLAS/wiki/Build section: CBLAS setup

vedranmiletic commented 7 years ago

Could you improve CMake configuration so that it fails if libblas-dev or equivalent is missing?

tingxingdong commented 7 years ago

That is documented in https://github.com/clMathLibraries/clBLAS/wiki/Build-client,-samples,-gtest