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

[improve/nativelib] Better detection of LinktimeInfo.isMac #4051

Merged

Conversation

WojciechMazur
Copy link
Contributor

Support alternative 'macosxOS naming convention. Handleunknown` vendor for custom builds

…onvention. Handle `unknown` vendor for custom builds
Copy link
Member

@tanishiking tanishiking left a comment

Choose a reason for hiding this comment

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

I'm wondering what motivates this change?
It seems that clang computes the more specific target triple shiika-lang/shiika#281, but the vendor should be still apple(?)

@WojciechMazur
Copy link
Contributor Author

I'm wondering what motivates this change? It seems that clang computes the more specific target triple shiika-lang/shiika#281, but the vendor should be still apple(?)

os == macosx was introduced to handle cases when on some devices it's used instead of darwin. There was an issue with that recently reported on the Discord channel.

The vendor == unknown is my additional initiative. The purpose was to handle cases when using a custom target triple without setting vendor == apple. I'm not sure if it would be really useful

@tanishiking
Copy link
Member

tanishiking commented Sep 19, 2024

Thanks, okay this conversation 👀

Reid — 昨日 10:32
clang --version
Homebrew clang version 18.1.8
Target: arm64-apple-darwin23.6.0
Thread model: posix
InstalledDir: /opt/homebrew/opt/llvm/bin
However, based on documentation, I have set my target in the sbt build to arm64-apple-macosx11.0.0 - should I change it to the darwin23.6.0 suffix?
Did LLVM change the target name (macosx versus darwin)?
https://discord.com/channels/632150470000902164/635668881951686686/1285775392644534302

Wojciech Mazur — 昨日 17:14
Thanks, based on that I've spotted 1 bug. I'll fix it soon. Changing it back to darwing should make it work as a workaround.
In general if your not cross-compiling for some different target you can leave the target triple empty, it would use the default one.

It seems like the he set the target triple, as described in the document. I think we should update the documentation to use arm64-apple-darwin23.2.0 or something, because it's common to say darwin over macosx AFAIK.

Accepting target.os == "macosx" looks good to me 👍, since LLVM does the same (https://github.com/llvm/llvm-project/blob/ed8f78827895050442f544edef2933a60d4a7935/llvm/include/llvm/TargetParser/Triple.h#L520-L524). However, I'm not sure if it's a good idea to accept unknown as the vendor 🤔 (FYI rustup target list doesn't seem to support the unknown vendor for Darwin/iOS.)

Copy link
Member

@tanishiking tanishiking left a comment

Choose a reason for hiding this comment

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

LGTM 👏

@WojciechMazur WojciechMazur merged commit 0fbce90 into scala-native:main Sep 19, 2024
34 checks passed
@WojciechMazur WojciechMazur deleted the fix/LinktimeInfo-isMaco branch September 19, 2024 13:23
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.

2 participants