犰狳+ BLAS + LAPACK:链接错误? [英] Armadillo + BLAS + LAPACK: Linking error?
问题描述
当我尝试编译Armadillo 2.4.2随附的example1.cpp时,我不断收到以下链接错误:
When I try to compile example1.cpp that comes with Armadillo 2.4.2, I keep getting the following linking error:
/tmp/ccbnLbA0.o: In function `double arma::blas::dot<double>(unsigned int, double const*, double const*)':
main.cpp:(.text._ZN4arma4blas3dotIdEET_jPKS2_S4_[double arma::blas::dot<double>(unsigned int, double const*, double const*)]+0x3b): undefined reference to `wrapper_ddot_'
/tmp/ccbnLbA0.o: In function `void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)':
main.cpp:(.text._ZN4arma4blas4gemvIdEEvPKcPKiS5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemv<double>(char const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x68): undefined reference to `wrapper_dgemv_'
/tmp/ccbnLbA0.o: In function `void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)':
main.cpp:(.text._ZN4arma4blas4gemmIdEEvPKcS3_PKiS5_S5_PKT_S8_S5_S8_S5_S8_PS6_S5_[void arma::blas::gemm<double>(char const*, char const*, int const*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, int const*)]+0x7a): undefined reference to `wrapper_dgemm_'
collect2: ld returned 1 exit status
有人可以帮忙吗?我是手动安装的
Can someone help? I manually installed
- BLAS的最新版本
- lapack-3.4.0
- boost-1.48.0
- ATLAS的最新版本
我在MacBook Pro 7,1型号上使用Ubuntu 11.04
I'm using Ubuntu 11.04 on the MacBook Pro 7,1 model
推荐答案
非常感谢osgx!阅读他的评论后,我再次查看了README文件!原来我在命令中缺少'-O1 -larmadillo'!
Thank you so much to osgx! After reading his comment, I took a second look at the README file! It turns out I was missing '-O1 -larmadillo' in the command!
这是我用来使其正常运行的命令:
Here's the command I used to get it working:
g++ example1.cpp -o example1 -O1 -larmadillo
我知道这是愚蠢的错误....这只是提醒您阅读自述文件的重要性.
Stupid mistake, I know.... It just goes to remind you how important it is to read the README.
自述文件还提到:
如果出现链接错误,或者手动安装了Armadillo 并且您指定了LAPACK和BLAS可用,您将 需要显式链接到LAPACK和BLAS(或其等效项), 例如:
If you get linking errors, or if Armadillo was installed manually and you specified that LAPACK and BLAS are available, you will need to explicitly link with LAPACK and BLAS (or their equivalents), for example:
g++ example1.cpp -o example1 -O1 -llapack -lblas
我不必添加'-llapack -lblas',但这也许会帮助遇到类似问题的其他人.
I didn't have to include '-llapack -lblas' but maybe this will help anyone else who's having similar problems.
这篇关于犰狳+ BLAS + LAPACK:链接错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!