Armadillo + 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
愚蠢的错误,我知道......它只是提醒你阅读 README 是多么重要.
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.
这篇关于Armadillo + BLAS + LAPACK:链接错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!