Search code examples
c++macoslapack

undefined reference _cblas_dgemm in Mac OS X


I have installed the shark machine learning library on Ubuntu and linked it with libshark_debug.so and liblapack_atlas.so. liblapack_atlas.so was in libatlas-base-dev package. Now I want to do the same on Mac OS X, but I can not find liblapack_atlas.so. Linker stops with this error:

undefined symbols for architecture x86_64:
"_cblas_dgemm", reference from:
shark::blas::binding::gemm()

Which package should I install (using brew for instance) to be able to link my C++ program with liblapack_atlas.so.


Solution

  • OS X already provides a .dylib for BLAS, on my system it's located at /usr/lib/libblas.dylib but YMMV for location. A quick check of it's exported symbols gives me this:

    nm -gU /usr/lib/libblas.dylib | grep dgemm
    ...
    000000000016e454 T _cblas_dgemm
    

    Also provides a liblapack library as well, which is at: /usr/lib/liblapack.dylib.