Pyo3: PyO3 is not supported on Alpine Linux

Created on 10 Sep 2019  路  5Comments  路  Source: PyO3/pyo3

馃悰 Bug Reports

When attempting to compile a PyO3 library I get the following:
error: cannot produce proc-macro for `ctor v0.1.10` as the target `x86_64-unknown-linux-musl` does not support these crate types

馃實 Environment

  • Your operating system and version: Alpine Linux 3.10.2
  • Your python version: Python 3.7.3
  • How did you install python (e.g. apt or pyenv)? Did you use a virtualenv?: using apk, no.
  • Your rust version (rustc --version): rustc 1.39.0-nightly (0b36e9dea 2019-09-09)
  • Are you using the latest pyo3 version? Have you tried using latest master (replace version = "0.x.y" with git = "https://github.com/PyO3/pyo3")? Yes. No.

馃挜 Reproducing

sudo docker pull alpine:latest
sudo docker run -it /bin/sh
apk add --update libgcc python3-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly
git clone https://github.com/thedrow/fastuuid.git
cd fastuuid
cargo build

Most helpful comment

As a heads up, I was able to make use of ctor on musl via cross - this might work for PyO3 as well. The important thing is that you build on a platform that supports dynamic linking!

All 5 comments

So what I can say is

  1. It's not our problem(maybe because of ctor?)
  2. x86_64-unknown-linux-musl is tier-2 support so, yeah, please don't expect everything works fine on this

If we can consider to drop ctor and/or replace it this issue becomes actionable.
If not, we should simply document the fact that we don't support Alpine.

If we can consider to drop ctor and/or replace it this issue becomes actionable.

From the error message, I'd say that x86_64-unknown-linux-musl doesn't support any proc-macros crate, and given that PyO3 heavily uses proc-macros, I don't know how it could work with that target.

@althonos
You're right, I found that we cannot do that by googling.
https://github.com/rust-lang/rust/issues/40174
Looks like there's an issue around dynamic loading.

As a heads up, I was able to make use of ctor on musl via cross - this might work for PyO3 as well. The important thing is that you build on a platform that supports dynamic linking!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jamesray1 picture jamesray1  路  3Comments

vorner picture vorner  路  7Comments

konstin picture konstin  路  5Comments

ametisf picture ametisf  路  3Comments

davidhewitt picture davidhewitt  路  6Comments