我正在尝试使用ndarray
和ndarray-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"
我在一个项目中遇到了这个问题,解决方案是指示rustc链接到
lapacke
我在
build.rs
文件中添加了以下内容一旦我这样做了,我就不再得到未定义的符号错误
相关问题 更多 >
编程相关推荐