需要外部库时使用 Maturin
Using Maturin when external library is needed
我正在尝试用我正在制作的 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 library
python3.6m
, perhaps an -L flag is missing
我在这里缺少什么?任何形式的帮助将不胜感激
正如一位用户在 this issue, there was a problem with the installed GSL version: I was using a function which was added in the last release of the library. Also I have to user the command wheel-repair
to include some missing .so
files. The entire process is in this issue
中指出的那样
我正在尝试用我正在制作的 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, there was a problem with the installed GSL version: I was using a function which was added in the last release of the library. Also I have to user the command wheel-repair
to include some missing .so
files. The entire process is in this issue