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

Fix naked DMD-style asm emission for non-Mac x86 Darwin targets & add prebuilt druntime/Phobos for iOS/x86_64 to macOS package #3478

Merged
merged 3 commits into from
Jun 29, 2020

Conversation

kinke
Copy link
Member

@kinke kinke commented Jun 26, 2020

@kinke kinke force-pushed the darwin_asm branch 4 times, most recently from 611531c to a9abd23 Compare June 26, 2020 20:18
@kinke kinke changed the title Fix naked DMD-style asm emission for non-Mac x86 Darwin targets Fix naked DMD-style asm emission for non-Mac x86 Darwin targets & add prebuilt druntime/Phobos for iOS/x86_64 to macOS package Jun 26, 2020
@kinke kinke force-pushed the darwin_asm branch 3 times, most recently from 77137da to e8ddb14 Compare June 27, 2020 01:15
@kinke kinke merged commit 34e3230 into ldc-developers:master Jun 29, 2020
@kinke kinke deleted the darwin_asm branch June 29, 2020 19:04
triple="arm64-apple-ios$IOS_DEPLOYMENT_TARGET"
# TODO: shared libs too, and look into `-fvisibility=hidden` requirement
triple_arm64="arm64-apple-ios$IOS_DEPLOYMENT_TARGET"
triple_x64="x86_64-apple-ios$IOS_DEPLOYMENT_TARGET"
Copy link
Contributor

Choose a reason for hiding this comment

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

I’m not sure if it matters but Xcode does not use this triple for the simulator. I’m not currently at the computer but, IIRC, it uses iphonesimulator instead of iOS.

--dFlags="-mtriple=$triple_x64;-fvisibility=hidden" \
--ldcSrcDir=$BUILD_SOURCESDIRECTORY \
CMAKE_SYSTEM_NAME=iOS \
CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk \
Copy link
Contributor

@jacob-carlborg jacob-carlborg Jul 16, 2020

Choose a reason for hiding this comment

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

Hard coding the path to the SDK should be avoided. The following command can be used retrieve the path: xcrun --show-sdk-path --sdk iphonesimulator.

\"-Xcc=$triple_x64\",
\"-Xcc=-miphoneos-version-min=$IOS_DEPLOYMENT_TARGET\",
\"-Xcc=-isysroot\",
\"-Xcc=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk\",
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 run the above mentioned command to avoid hard coding the path?

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's hardcoded just like the one for the arm64 triple, and noone has complained about that so far.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know. I'm just saying it would be better if it wasn't hard coded. Not for arm64 either. If someone only installs the command line tools and not Xcode, the path to the SDKs will be different. Also, Apple may decide to change the path. Originally when I started developing on Mac, the SDK was located somewhere in /Developer.

Copy link
Member Author

@kinke kinke Jul 16, 2020

Choose a reason for hiding this comment

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

If we wanted to do this properly for the few users who might run into troubles (and aren't able to fix it themselves by adapting ldc2.conf), we would probably have to do something similar to the MSVC toolchain setup, invoking that xcrun cmdline and parsing its result to obtain the proper path, and injecting it into the linker/clang cmdline for non-Mac Apple targets. Of course none of this would be necessary (none of these -Xcc flags) if Apple just used a little preconfigured wrapper à la x86_64-apple-i{os,phonesimulator}12.0-clang like the Android NDK or most cross-gcc toolchains.

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