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

Azure CI: Include macOS arm64 libraries in prebuilt Mac package #3583

Merged
merged 1 commit into from
Oct 23, 2020

Conversation

kinke
Copy link
Member

@kinke kinke commented Oct 9, 2020

For simple cross-compilation via -mtriple=arm64-apple-macos as long as a suited Xcode version >= 12.0 (?) is installed.

@kinke kinke force-pushed the macos_aarch64 branch 6 times, most recently from f58711c to cc9d205 Compare October 9, 2020 21:20
@kinke
Copy link
Member Author

kinke commented Oct 10, 2020

@p0nce: This should be usable now; you can download an artifact from https://dev.azure.com/ldc-developers/ldc/_build/results?buildId=2232&view=artifacts&type=publishedArtifacts.

There are gazillions of linker warnings like

ld: warning: direct access in function 'ltmp2' from file 'objects-debug-shared/core/demangle.o' to global weak symbol '__D4core8demangle__T8DemangleTSQBcQBa7NoHooksZQBa15parseSymbolNameMFNaNlNfZv' from file 'objects-debug-shared/core/demangle.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

They happened for iOS too, but have been suppressed by compiling the libs with -fvisibility=hidden. For macOS arm64 here, the object files are used for the shared libs too (not just static libs as for iOS), so that's not an option, and -fvisibility-inlines-hidden neither due to D's template emission (edit: well, not supported by LDC anyway). I think these warnings can be safely ignored and just mean that there might be multiple identical symbol definitions in a process (defined in different .dylibs / executable); actual weak symbols (@weak) are hopefully not accessed directly and can still be overridden.

Anyway, this shouldn't be related in any way to LDC itself, as the IR should be equivalent in this regard for macOS on x64 and arm64 (weak_odr for templated symbols). After a quick search, I couldn't find a way to suppress the linker warning.

\"-Xcc=-target\",
\"-Xcc=$triple_arm64\",
\"-Xcc=-isysroot\",
\"-Xcc=/Applications/Xcode_12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk\",
Copy link
Member Author

Choose a reason for hiding this comment

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

It would be good to know whether this -isysroot ... is really required for linking when using an Xcode with SDK >= 11.0, or whether it's better to leave it out and just assume the user uses an appropriate default Xcode version.

Copy link
Contributor

@p0nce p0nce Oct 10, 2020

Choose a reason for hiding this comment

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

Hello, I'll get back to you this evening (I'm in CEST) about testing this.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also get the gazillions of such warning, and I had assumed -fvisibility=hidden would be possible. Well I trust your judgement on this. :)

@p0nce
Copy link
Contributor

p0nce commented Oct 10, 2020

  • I'm able to use the CI compiler for arm64 without problems except the linker warnings. It behave similarly to the one I had modified here.
  • the -isysroot parameters doesn't seem to be needed. My Xcode here is named Xcode-beta.app and possibly has a slightly different SDK. Behaviour is the same with and without the -isysroot flags.
  • I was able to build an arm64 shared library (that doesn't enable the D runtime) and call it like a C lib. Haven't tried enabling the runtime from a shared library.

@kinke
Copy link
Member Author

kinke commented Oct 10, 2020

the -isysroot parameters doesn't seem to be needed

Tested on native arm64, right? Well, I'll just try it here too with Azure on native x64, we'll see...

@p0nce
Copy link
Contributor

p0nce commented Oct 10, 2020

Tested on native arm64, right?

Yes.

@kinke kinke force-pushed the macos_aarch64 branch 2 times, most recently from 9f3ab0b to 5add58a Compare October 11, 2020 00:13
For simple cross-compilation via `-mtriple=arm64-apple-macos` as long as
a suited Xcode version >= 12.0 is installed.
@kinke
Copy link
Member Author

kinke commented Oct 11, 2020

Specifying the sysroot is needed for Azure at least; not sure if that's because it's native x64 or because it has something like 10 installed Xcode versions.

@kinke kinke merged commit 2e006d1 into ldc-developers:master Oct 23, 2020
@kinke kinke deleted the macos_aarch64 branch October 23, 2020 17:02
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