-
Notifications
You must be signed in to change notification settings - Fork 32
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
[4.0] fix -fnative
linking on macOS
#223
Conversation
-fnative
linking on macOS-fnative
linking on macOS
@@ -546,14 +547,31 @@ static void GetLdDefaults(std::vector<std::string>& ldopts) { | |||
} else { | |||
#ifdef __APPLE__ | |||
ldopts.insert(ldopts.end(), {"-arch", "x86_64", "-macosx_version_min", "10.13", "-framework", "Foundation", "-framework", "System"}); | |||
|
|||
llvm::SmallString<256> Output; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please keep naming according to the file. Rest of file has snake case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call; it's a tough mix because LLVM's naming standard is different than ours..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
disappointed to discover this only resolves building on macOS up through Xcode 13.4. Xcode 14 & 15 will not build cdt due to other issues (unrelated to anything macOS related, but rather clang compiler related). oh well, at least it is an improvement |
When building cdt on macOS, it would error out about not being able to find the Foundation framework. This was because when cdt's ld driver was run with
-fnative
it didn't tellld
the system's SDK path.The current SDK can be discovered via
xcrun --show-sdk-path
. I'm not sure any other way, so call off to that when creating the command line arguments to pass told
. You can find something a little similar when cmake initializes its environment, so I'm not completely out of whack: https://github.com/Kitware/CMake/blob/123cdf981661c8ae32335d4ae7e1ddcbcffd09cc/Modules/Platform/Darwin-Initialize.cmake#L144I also removed
-Bstatic
as that isn't accepted by macOS's linker any longer. afaict that is unneeded since-static
will be passed anyways.