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

CI: Always include macOS version in explicit triples #4553

Merged
merged 2 commits into from
Jan 21, 2024

Conversation

kinke
Copy link
Member

@kinke kinke commented Jan 6, 2024

Wrt. issue #4501.

llvm::SmallString<16> osname;
osname += "macosx";
osname += "macos";
Copy link
Member Author

Choose a reason for hiding this comment

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

I've stripped off the x; Apple uses macos{10.12,11} in https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary, and Google yields 4-5x more results for arm64-apple-macos11 than arm64-apple-macosx11.

Copy link
Member

Choose a reason for hiding this comment

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

tested locally: works.

@kinke kinke force-pushed the macos_explicit_version branch from 476c67a to 1126e66 Compare January 6, 2024 23:20
…et …` for clang linker driver

In order not to have to hardcode an explicit macOS version.
@kinke kinke force-pushed the macos_explicit_version branch from b9893fb to 1650a5f Compare January 7, 2024 19:41
\"-Xcc=-target\",
\"-Xcc=x86_64-apple-macos\",
\"-Xcc=-arch\",
\"-Xcc=x86_64\",
Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is better than specifying a full triple with some hardcoded macOS version.

Copy link
Member

Choose a reason for hiding this comment

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

This change leads to a problem on my mac. The compiler does not recognize -arch (it wants -march).
I'm testing what works best...

Copy link
Member

@JohanEngelen JohanEngelen Feb 29, 2024

Choose a reason for hiding this comment

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

ah cool... clang wants -arch and c++ wants -march ...
The problem is that -arch= is not accepted by c++ (I think kinke mentioned this before somewhere).
The fix in PR #4431 only works because -target= is accepted.

Copy link
Member

Choose a reason for hiding this comment

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

And everything works when the target_link_options version of #4431 is used.

Copy link
Member

Choose a reason for hiding this comment

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

(the solution with -target works, but runs into an annoying warning about unused -arch arm64 warning when linking LDC; so trying to find other solution)

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to get the full triple that was matched and then insert it with the -target flag?

Another idea would be to not specify this flag in the config file and instead let LDC get the operating system version at runtime and use the full triple including the version. It's more flexible than a config file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh right - we could simply have LDC always add an appropriate -target option when linking an Apple target. Then we only need the -isysroot option in the config file, for iOS targets.

Copy link
Member

Choose a reason for hiding this comment

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

#4431 now resolves building LDC with this, so from my side no change is needed (and I think the arch flag is better than triple, because the arch flag can't be wrong here)

@JohanEngelen JohanEngelen merged commit 8264f97 into ldc-developers:master Jan 21, 2024
22 checks passed
@JohanEngelen
Copy link
Member

@jacob-carlborg Can you verify that this now works for you? You can grab the package from https://github.com/ldc-developers/ldc/releases/tag/CI (wait until rebuild with this PR included)

@jacob-carlborg
Copy link
Contributor

@JohanEngelen how do I know if this PR is included in the CI release?

@jacob-carlborg
Copy link
Contributor

@JohanEngelen Seems to be working. I don't get any warnings and the object files contains the correct sections.

@JohanEngelen
Copy link
Member

@jacob-carlborg Thanks for confirming the fix. (the 8264f97 binaries contain this PR, Github says they were uploaded ~8hours ago)

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.

3 participants