
Patrick Perry wrote:
Xiao-Yong Jin wrote:
Apart from some warnings, the library compiles fine in my system. But there is a minor issue about the library it links against when `./Setup test'. I need to use `-lcblas' instead of `-lblas' to get it to link to correct libraries. I don't know other people's system. But in my system, Gentoo Linux, I use blas library provided by atlas, and libblas.so is a fortran library and libcblas.so is for C.
I don't know of a good way to get around this. It seems like every system has a different convention for the location and name of the cblas libraries. So, everyone has to edit the "extra-libraries" and the "extra-lib-dirs" field in the blas.cabal file. Does anyone know of a better way of doing this?
A possible solution is using flags in the cabal configuration file. For instance, I have this in hmatrix.cabal: if flag(mkl) if arch(x86_64) extra-libraries: gsl mkl_lapack mkl_intel_lp64 mkl_sequential mkl_core else extra-libraries: gsl mkl_lapack mkl_intel mkl_sequential mkl_core else extra-libraries: gsl blas lapack so if I want to link with Intel's MKL optimized blas/lapack instead of ATLAS I simply add the -fmkl flag: runhaskell Setup.lhs configure -fmkl etc. or even cabal install hmatrix -fmkl Other flags can be added to support different distributions. We could have something like cabal install package -ffedora or cabal install package -fcblas etc. Alberto