Build failure with USE_BLAS=blas in Arch linux

Hi. I’m using Arch linux. With USE_BLAS=blas (and opencv enabled / cuda disabled), the build fails with the following errors

/usr/bin/ld: build/src/operator/tensor/la_op.o: undefined reference to symbol 'cblas_ssyrk'
/usr/lib/libcblas.so.3: error adding symbols: DSO missing from command line

The library file libblas.so dose not have the symbol cblas_ssyrk but libcblas.so have it. So adding -lcblas as a LDFLAGS solves the problem. I’m not sure whether this is a Arch linux specific problem. Please consider to the -lcblas flag.

I have only found sources where people had trouble with this on Arch Linux, so this may be distro specific. But according to https://aur.archlinux.org/packages/mxnet/ on page 10

petronny commented on 2018-02-10 06:06

ld: build/src/operator/tensor/la_op.o: undefined reference to symbol 'cblas_ssyrk'
/usr/lib/libcblas.so.3: error adding symbols: DSO missing from command line


with USE_BLAS=blas ADD_LDFLAGS=-lcblas USE_LAPACK=1. 
So I use openblas-lapack to build the package. And openblas-lapack doesn't break dependencies.

which might solve your issue.

Vishaal

Good day,

I have tried USE_BLAS=openblas ADD_LDFLAGS=-lcblas USE_LAPACK=1 and am still getting the same “undefined ‘cblas_ssyrk’” error.

Is there anything else I could try to get rid of the problem?

Since this is a missing symbol, it would be a good idea to double-check that you have cblas installed. It should be /usr/lib/libcblas.so. You could try using readelf for a sanity check to make sure you have a library with that symbol, and it is cblas

$ readelf -Ws * 2> /dev/null | grep cblas_ssyrk  | grep File

/usr/lib/libcblas.so(cblas_ssyrk.o)

Vishaal