c++ - 与 BLAS 和 LAPACK Eclipse IDE 链接的犰狳交叉编译错误
问题描述
我正在尝试使用犰狳库在 Eclipse IDE 上交叉编译(从ix86
到)代码。ARM
我正在使用来自linaro.orgarm-linux-gnueabihf
的编译器。我已经在 Eclipse 上设置了所有内容,并且可以成功交叉编译 c++ 代码。
遵循本教程后,我可以生成liblapack.a
,libf2c.a
和liblas.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,但在我的情况下,编译每次都会崩溃。
我已经再次交叉编译了这些库,看看这是否是问题所在,但没有成功。
解决方案
推荐阅读
- .net-core - 未为 dotnet 核心项目生成 Coverlet lcov.info 文件
- java - com.google.firebase.internal.api.FirebaseNoSignedInUserException:请先登录,然后再尝试获取令牌
- php - PSR-12 是否说明了命名空间导入和别名应该如何分组和排序?
- java - 在 MacOS 上将 spatialite 与 xerial/sqlite-jdbc 一起使用
- c++ - 打印 2D int 数组时从 'int' 到 'int**' [-fpermissive] 的无效转换
- react-native - 将 this.state 值转移到其他类 [React Native]
- azure - Azure Powershell 作业引发错误:操作返回了无效的状态代码“禁止”
- python - Python将XML解析为缺少元素的DataFrame
- ionic-framework - Formgroup 无法在表单提交 IONIC 5 上检索用户输入和页面重新加载的值
- scala - 数据框过滤掉包含指定单词的行(字符串)