-
-
Notifications
You must be signed in to change notification settings - Fork 25
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 macos triple #296
Fix macos triple #296
Conversation
706af64
to
43148be
Compare
With the release of Xcode 15, a new linker was introduced and with it came warnings from the linker. It appears that the new linker is stricter in which target triples it considers valid. Specifically, it looks like the minimum deployment target is required. E.g., `aarch64-apple-darwin23.3.0` is valid, while `aarch64-apple-darwin` is not. See also: * https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking * crystal-lang/crystal#13846
43148be
to
d1173d6
Compare
@straight-shoota would be possible to run a test build with these changes to see how the default target triple comes out? |
Seems like it's working! Here's the output of the generated artefact: $ crystal -v
Crystal 1.12.0-dev [2800d9462] (2024-04-06) LLVM: 15.0.7
Default target: aarch64-apple-macosx11.0 It subsequently also silences the warning messages as the default target triple is @straight-shoota like you mentioned in crystal-lang/crystal#13846 (comment), we should probably discuss whether or not it makes sense to keep the normalization done in |
@hovsater as far as I recall the normalization was meant to 1. make sure we use a single flag, whatever the triple name (e.g. Now, forcing the normalization of the actual elements was probably not a good idea. We might want to have |
@ysbaddaden that makes sense. We do make some normalization in Of course, this is only applicable on macOS currently, since the |
FTR: This change only affects the ARM build of the compiler. It's not expected to remove linker warnings on Intel macs. |
Yeah, you're right. We do not set the target triple explicitly for |
Updates `distribution-scripts` dependency to crystal-lang/distribution-scripts@46c295d This includes the following changes: * crystal-lang/distribution-scripts#296 * crystal-lang/distribution-scripts#297 * crystal-lang/distribution-scripts#294 * crystal-lang/distribution-scripts#291 * crystal-lang/distribution-scripts#274 * crystal-lang/distribution-scripts#286 * crystal-lang/distribution-scripts#281 * crystal-lang/distribution-scripts#270 * crystal-lang/distribution-scripts#263 * crystal-lang/distribution-scripts#273
Starting with Xcode 15, the minimum deployment target is required in the target triple. See also: * crystal-lang/distribution-scripts#296
Starting with Xcode 15, the minimum deployment target is required in the target triple. See also: * crystal-lang/distribution-scripts#296
Starting with Xcode 15, the minimum deployment target is required in the target triple. With the release of Xcode 15, a [new linker was introduced](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking) and with it came warning messages like this: ld: warning: no platform load command found in '/Users/pascal/.cache/crystal/Users-pascal-Documents-tutorials-crystal-hello_world.cr/F-loat32.o', assuming: macOS It appears that the new linker is stricter in which target triples it considers valid. Specifically, it looks like the minimum deployment target is required. E.g., `aarch64-apple-darwin23.3.0` is valid, while `aarch64-apple-darwin` is not. See #13846 (comment) for details. This patch removes code which strips the minimum deployment target in `LLVM.default_target_triple` as an effort for standardization. See also: crystal-lang/distribution-scripts#296
I've been investigating this issue and it's related to the default target triple produced by Crystal during compilation. It seems like in order to fix a bug back in 2015, we stripped the minimum deployment target from the target triple in this commit. With the release of Xcode 15, a new linker was introduced and with it came these warning messages. It appears that the new linker is stricter in which target triples it considers valid. Specifically, it looks like the minimum deployment target is required. E.g.,
aarch64-apple-darwin23.3.0
is valid, whileaarch64-apple-darwin
is not.We still need to handle the issue of normalization that's happening here, probably by not normalizing the macOS target triple at all and I'll do that in a follow up pull request.