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

arm64 versus aarch64 in LLVM.default_target_triple #14052

Closed
HertzDevil opened this issue Dec 5, 2023 · 1 comment · Fixed by #14466
Closed

arm64 versus aarch64 in LLVM.default_target_triple #14052

HertzDevil opened this issue Dec 5, 2023 · 1 comment · Fixed by #14466

Comments

@HertzDevil
Copy link
Contributor

This spec is still failing on my M2:

it ".default_target_triple" do
triple = LLVM.default_target_triple
{% if flag?(:darwin) %}
triple.should match(/-apple-macosx$/)

Failures:

  1) LLVM .default_target_triple
     Failure/Error: {% if flag?(:darwin) %}

       Expected: "arm64-apple-darwin23.1.0"
       to match: /-apple-macosx$/

     # spec/std/llvm/llvm_spec.cr:17

LLVM is supposed to normalize the triple by removing the version number, but this doesn't work because the triple starts with arm64 rather than aarch64:

crystal/src/llvm.cr

Lines 91 to 99 in 25d3303

def self.default_target_triple : String
chars = LibLLVM.get_default_target_triple
case triple = string_and_dispose(chars)
when .starts_with?("x86_64-apple-macosx"), .starts_with?("x86_64-apple-darwin")
# normalize on `macosx` and remove minimum deployment target version
"x86_64-apple-macosx"
when .starts_with?("aarch64-apple-macosx"), .starts_with?("aarch64-apple-darwin")
# normalize on `macosx` and remove minimum deployment target version
"aarch64-apple-macosx"

This spec passes inside a Nix shell. I don't know what is going on there.

Rust had this problem too. Apparently arm64 is preferred over aarch64 now?

@miry
Copy link
Contributor

miry commented Dec 6, 2023

I found the same thing, that LLVM supports name arm64-apple-darwin, the aarch64-apple-darwin could be replaced. (llvm-config --host-target #=> arm64-apple-darwin23.0.0)

in crystal-lang/distribution-scripts#268

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants