Armadillo与BLAS和LAPACK Eclipse IDE的交叉编译错误链接

问题描述

我正在尝试使用 armadillo 库在Eclipse IDE上交叉编译(从ix86ARM)代码。

我正在使用linaro.org中的arm-linux-gnueabihf编译器。 我已经在Eclipse上进行了所有设置,并且可以成功地交叉编译c ++代码。

遵循this tutorial之后,我可以生成liblapack.alibf2c.aliblas.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 (将#修改为@)