将Rust lib.so导入Python时未定义的符号LAPACK

2024-10-01 13:27:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用ndarrayndarray-linalg等板条箱在Rust中创建一个简单的ML库,并在稍后的Python中通过ctypes利用它。在Cargo.toml中,我设置了crate-type = ["cdylib"]。我的projet是构建的,在Rust中工作得很好,但是当我尝试将output.so文件导入Python时,它生成了一个错误OSError: /home/Project/Lib/regression_simple/target/debug/libregression_simple.so: undefined symbol: LAPACKE_dgetri

我安装了所有必要的lapack和blas包,lapacke.h可以在/usr/include/lapacke.h中找到

我似乎在网上找不到任何类似的问题。当我编译Rust库时,我确实看到加载了ndarray linalg的所有依赖项包,所以我不知道这个问题是从哪里来的

我的货物.toml

[lib]
name = "regression_simple"
crate-type = ["cdylib"]

[dependencies]
ndarray = { version = "0.13.0", features = ["blas"] }
ndarray-linalg = { version = "0.12.0", features = ["openblas"] }
ndarray-rand = "0.11.0"
openblas-src = {version = "0.7", features = ["system"]}
rand = "0.7.3"

Tags: soversiontyperustsimpleblasfeaturesndarray