Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: maturin develop can compile on macOS with M1/M2 chip #1015

Closed
wants to merge 1 commit into from

Conversation

dzvon
Copy link

@dzvon dzvon commented Jul 19, 2022

#1013

This fix can make maturin develop compile successfully in my local environment.

@netlify
Copy link

netlify bot commented Jul 19, 2022

Deploy Preview for maturin-guide canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit f3a5827
🔍 Latest deploy log https://app.netlify.com/sites/maturin-guide/deploys/62d65ddccca6200008852646

src/develop.rs Show resolved Hide resolved
@@ -35,9 +35,9 @@ pub fn develop(
Ok(output) if output.status.success() => {
let platform = String::from_utf8_lossy(&output.stdout);
if platform.contains("macos") {
if platform.contains("x86_64") && target.target_arch() != Arch::X86_64 {
if platform.contains("x86_64") && target.target_arch() == Arch::X86_64 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L38 and L40 change is wrong. We want to respect Python architecture to fix #982 and #979. target is default Rust target we get from rustc -vV.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the discussion in #1013, can you add a debug print here and paste the output here.

println!("{} {:?}", platform, target.target_arch());

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macosx-10.14.6-arm64 Aarch64

@messense

This comment was marked as off-topic.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the offending code shouldn't be these two I think? It might be related to the target_triple variable, can you try #1016 ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if I append --target aarch64-apple-darwin, it works fine.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then you have to debug further, based on the macosx-10.14.6-arm64 Aarch64 output it shouldn't reach these two lines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try add println!("{:#?}", build_options); just above

let build_context = build_options.into_build_context(release, strip, true)?;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BuildOptions {
    platform_tag: [
        Linux,
    ],
    interpreter: [
        "/Users/pvon/Documents/string_sum/.env/bin/python",
    ],
    find_interpreter: false,
    bindings: None,
    out: Some(
        "/var/folders/0r/tkx69nhn6vg6sr0w1c6nnsxr0000gn/T/.tmpAolWXa",
    ),
    skip_auditwheel: false,
    zig: false,
    universal2: false,
    cargo: CargoOptions {
        quiet: false,
        jobs: None,
        profile: None,
        features: [],
        all_features: false,
        no_default_features: false,
        target: None,
        target_dir: None,
        manifest_path: None,
        ignore_rust_version: false,
        verbose: 0,
        color: None,
        frozen: false,
        locked: false,
        offline: false,
        config: [],
        unstable_flags: [],
        timings: None,
        future_incompat_report: false,
        args: [],
    },
}

Copy link
Member

@messense messense Jul 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing seems wrong, I can't reproduce this issue, so you have to debug on your own.

Try to track down where did the target triple changed to x86_64.

@dzvon dzvon changed the title fix: maturin develop can compile on MacOS with M1/M2 chip fix: maturin develop can compile on macOS with M1/M2 chip Jul 19, 2022
@dzvon dzvon closed this Jul 19, 2022
@dzvon dzvon deleted the fix-maturin-develop-macos branch July 19, 2022 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants