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

macOS uname -m can lie due to Rosetta shenanigans #3438

Merged
merged 2 commits into from
Aug 15, 2023

Conversation

rami3l
Copy link
Member

@rami3l rami3l commented Aug 14, 2023

Closes #3419.

Originally provided in JuliaLang/juliaup#701, this shell script fix uses sysctl to prevent Rosetta 2 from lying about the system's actual CPU architecture.


Possibly related: #3068

@rami3l rami3l changed the title macOS uname -m can lie due to Rosetta shenanigans macOS uname -m can lie due to Rosetta shenanigans Aug 14, 2023
Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

Drive-by review: this makes sense to me.

Are the CI runs expected to be flaky?

@rami3l
Copy link
Member Author

rami3l commented Aug 14, 2023

@djc Thanks for the review!

Are the CI runs expected to be flaky?

I don't think so. The causes of 3 unsuccessful runs are completely different. What happened? 🤔️

@rami3l
Copy link
Member Author

rami3l commented Aug 15, 2023

There was indeed a tiny detail regarding sysctl's stderr output and/or exit code that might break the CI.
Now there should be no more CI-related problems related to the changes I've made :)

Copy link
Contributor

@rbtcollins rbtcollins left a comment

Choose a reason for hiding this comment

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

So it's not possible to get an i386 binary running on Apple silicon?

Perhaps querying hw.optional and grepping for the sub keys we understand would be better?

@rami3l
Copy link
Member Author

rami3l commented Aug 15, 2023

So it's not possible to get an i386 binary running on Apple silicon?

@rbtcollins No.

AFAIK Apple's transition to ARM64 happened after having explicitly banned all x86_32 binaries in a previous macOS major upgrade, so an x86_32 binary can never run on ARM64 even with Rosetta 2 enabled.

The x86_32 compatibility part is for the old macOS versions before that ban.

@rbtcollins
Copy link
Contributor

@rbtcollins No.

AFAIK Apple's transition to ARM64 happened after having explicitly banned all x86_32 binaries in a previous macOS major upgrade, so an x86_32 binary can never run on ARM64 even with Rosetta 2 enabled.

The x86_32 compatibility part is for the old macOS versions before that ban.

Great. Could you please document that in a comment - I think its sufficiently specialised knowledge that we'll forget in a few weeks :)

@rami3l
Copy link
Member Author

rami3l commented Aug 15, 2023

Great. Could you please document that in a comment - I think its sufficiently specialised knowledge that we'll forget in a few weeks :)

@rbtcollins Done.

@rbtcollins rbtcollins merged commit bd08d35 into rust-lang:master Aug 15, 2023
16 checks passed
@rami3l rami3l deleted the fix/macos-uname-lies branch August 15, 2023 22:52
@rami3l rami3l mentioned this pull request Sep 3, 2023
AJ-Ianozi pushed a commit to AJ-Ianozi/getada-download that referenced this pull request Oct 12, 2023
macOS `uname -m` can lie due to Rosetta shenanigans
@rami3l rami3l mentioned this pull request Jan 29, 2024
1 task
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.

Upstream a bug fix for platform detection on MacOS
3 participants