首页 > 解决方案 > 与 BLAS 和 LAPACK Eclipse IDE 链接的犰狳交叉编译错误

问题描述

我正在尝试使用犰狳库在 Eclipse IDE 上交叉编译(从ix86到)代码。ARM

我正在使用来自linaro.orgarm-linux-gnueabihf的编译器。我已经在 Eclipse 上设置了所有内容,并且可以成功交叉编译 c++ 代码。

遵循本教程后,我可以生成liblapack.a,libf2c.aliblas.a交叉编译的库。

我想我在 Eclipse 上正确链接:

跨 G++ 链接器 -> 库 ->

库 (-l)

拉帕克

f2c

布拉斯

库搜索路径 (-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*, int const*, double const*, double const*, int const*, double 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*, int const*, int const*, double const*, double const*, int const*, double const*, int const*, double const*, double*, 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,但在我的情况下,编译每次都会崩溃。

我已经再次交叉编译了这些库,看看这是否是问题所在,但没有成功。

标签: c++cross-compilingeclipse-cdtarmadillo

解决方案


推荐阅读