我正在尝试用我正在制作的Rust Crate制作一个Python包。问题是我需要RGSL crate,它需要在系统中安装libgsl0-dev
。
我正在尝试使用Maturin which uses Manylinux Docker镜像进行发布,以构建适用于Linux的所有内容。问题是该图像未安装libgsl0-dev
,因此我添加了一行来制作了一个自定义图像:
FROM konstin2/maturin
# To solve problems with CentOS 6 EOL
RUN echo "https://vault.centos.org/6.10/os/x86_64/" > /var/cache/yum/x86_64/6/base/mirrorlist.txt
RUN echo "http://vault.centos.org/6.10/extras/x86_64/" > /var/cache/yum/x86_64/6/extras/mirrorlist.txt
RUN echo "http://vault.centos.org/6.10/updates/x86_64/" > /var/cache/yum/x86_64/6/updates/mirrorlist.txt
RUN echo "http://vault.centos.org/6.10/sclo/x86_64/rh" > /var/cache/yum/x86_64/6/centos-sclo-rh/mirrorlist.txt
RUN echo "http://vault.centos.org/6.10/sclo/x86_64/sclo" > /var/cache/yum/x86_64/6/centos-sclo-sclo/mirrorlist.txt
# Installs needed library
RUN yum install -y libgsl0-dev
ENTRYPOINT ["/usr/bin/maturin"]
但是当我尝试构建时:docker run --rm -v $(pwd):/io custom-image build --cargo-extra-args="--no-default-features"
⚠ Warning: You're building a library without activating pyo3's
extension-module
feature. See https://pyo3.rs/v0.12.4/building_and_distribution.html#linking 🔗 Found pyo3 bindings 🐍 Found CPython 3.6m at python3.6, CPython 3.7m at python3.7, CPython 3.8 at python3.8, CPython 3.9 at python3.9
Compiling pyo3 v0.12.4 error: could not find native static librarypython3.6m
, perhaps an -L flag is missing
我在这里想念的是什么?任何形式的帮助将非常感激
最佳答案
正如用户在this issue中指出的那样,已安装的GSL版本存在问题:我使用的是库的最新版本中添加的函数。另外,我必须使用命令wheel-repair
来包含一些缺少的.so
文件。整个过程在this issue中
关于python - 需要外部库时使用Maturin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65186014/