Skip to content

Compilation in setuptools_rust fails with 1.70.0-nightly toolchain #320

@yasuo-ozu

Description

@yasuo-ozu

Assumptions

  • problematic toolchain
    -- rustc 1.70.0-nightly (db0cbc48d 2023-03-26)
    -- rustc 1.70.0-nightly (478cbb42b 2023-03-28)
  • toolchain not affected
    -- rustc 1.68.0-stable

Description

wheel package generation fails with latest toolchain, when crate-type = ["cdylib"] is not contained in Cargo.toml.

Cause

The following command in build process will not work:

cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features 'python pyo3/extension-module' --no-default-features -- --crate-type cdylib

Instead, following works:

cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features 'python pyo3/extension-module' --no-default-features --crate-type cdylib

Workaround

any of the following avoids the bug:

  • Write crate-type = ["cdylib"] in Cargo.toml
  • Write args=["--crate-type", "cdylib"] in initializer of RustExtension

Sample:

                RustExtension(
                    'namespace.package', 'Cargo.toml',
                    binding = Binding.PyO3,
                    args = ["--crate-type", "cdylib"],
                )

I will create PRs later.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions