如何解决Armadillo与BLAS和LAPACK Eclipse IDE的交叉编译错误链接
我正在尝试使用 armadillo 库在Eclipse IDE上交叉编译(从ix86
到ARM
)代码。
我正在使用linaro.org中的arm-linux-gnueabihf
编译器。
我已经在Eclipse上进行了所有设置,并且可以成功地交叉编译c ++代码。
遵循this tutorial之后,我可以生成liblapack.a
,libf2c.a
和liblas.a
交叉编译的库。
我认为我在Eclipse上正确链接:
跨G ++链接器->库->
库(-l)
lapack
f2c
blas
库搜索路径(-L)
将路径添加到liblapack.a,libf2c.a和liblas.a文件。
我可以运行以下类似的简单代码,而不会出现任何问题。我认为这是因为像这样的简单程序不需要交叉编译的库,而只需要犰狳。
#include <armadillo>
#include <iostream>
using namespace std;
using namespace arma;
int main() {
mat A = randu(4,4);
cout << "A:\n" << A << "\n";
return 0;
}
但是,当我尝试使用矩阵乘法或使用交叉编译库中的功能的任何其他函数来编译我的代码时,例如:
#define ARMA_DONT_USE_WRAPPER
#define ARMA_USE_LAPACK
#define ARMA_USE_BLAS
#include <armadillo>
#include <iostream>
using namespace std;
using namespace arma;
int main() {
mat A = randu(4,4);
mat B = randu(4,4);
cout << "A:\n" << A << "\n";
//Matrices multiplication
cout << A*B << endl;
return 0;
}
我收到以下错误:
'Building target: test'
'Invoking: Cross G++ Linker'
arm-linux-gnueabihf-g++ -L"[path to the liblapack.a,liblas.a and libf2c.a files]" -o "test" ./src/test.o -llapack -lf2c -lblas
./src/test.o: In function `void arma::blas::gemv<double>(char const*,int const*,double const*,double*,int const*)':
[path to the armadillo library]\include/armadillo_bits/translate_blas.hpp:36: undefined reference to `dgemv_'
./src/teste.o: In function `void arma::blas::gemm<double>(char const*,char const*,int const*)':
[path to the armadillo library]\include/armadillo_bits/translate_blas.hpp:62: undefined reference to `dgemm_'
collect2.exe: error: ld returned 1 exit status
makefile:45: recipe for target 'test' failed`
make: *** [test] Error 1
"make all" terminated with exit code 2. Build might be incomplete
与这里的问题非常相似:Armadillo + BLAS + LAPACK,但就我而言,编译每次都崩溃。
我已经对库进行了另一次交叉编译,以查看这是否是问题所在,但没有成功。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。