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 xctoolchain AppleClang to corrrectly use -isysroot #703

Merged
merged 2 commits into from
Sep 23, 2023

Conversation

youknowone
Copy link
Contributor

@youknowone youknowone commented Jul 26, 2022

The first commit is #708 but unseparatable.

Fix AppleClang build for -apple-darwin to add -isysroot for MacOSX.sdk correctly when cc is under xctoolchain.
Becasue -isysroot priors to $SDKROOT env variable, the original ad-hoc fix is not required anymore.

@youknowone youknowone force-pushed the apple-clang branch 7 times, most recently from f55cce3 to 6498d9c Compare July 26, 2022 15:26
@youknowone youknowone changed the title Fix AppleClang darwin build & AppleTVOS support Fix AppleClang darwin build & MACOSX_DEPLOYMENT_TARGET Jul 27, 2022
@youknowone youknowone force-pushed the apple-clang branch 2 times, most recently from 80aa69d to f066b3a Compare July 30, 2022 20:21
@youknowone youknowone marked this pull request as ready for review July 30, 2022 20:21
@youknowone youknowone changed the title Fix AppleClang darwin build & MACOSX_DEPLOYMENT_TARGET Fix xctoolchain AppleClang to corrrectly use -isysroot Jul 30, 2022
@youknowone youknowone force-pushed the apple-clang branch 2 times, most recently from ce58a7c to 221cf31 Compare July 31, 2022 21:48
@thomcc thomcc added the O-apple Apple targets and toolchains label Oct 26, 2022
Copy link
Member

@thomcc thomcc left a comment

Choose a reason for hiding this comment

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

This looks like a good idea to me, but I'm not sure this is the way to go about it. I've left some comments but will need to do further investigation of what's expected here (and review some of the work by @indygreg in apple-sdk).

src/lib.rs Outdated
"macosx",
"",
std::env::var("MACOSX_DEPLOYMENT_TARGET")
.unwrap_or_else(|_| (if self.cpp { "10.9" } else { "10.4" }).into()),
Copy link
Member

Choose a reason for hiding this comment

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

cmd.args.push(sdk_path);
}

if !is_mac {
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why this is conditional now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The whole function apple_flags - which was previously ios_watchos_flags was not called from macos target before. I'd like to keep the previous behavior for macos target in this PR. If you'd like to add this to macos too, I will remove it.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, good catch.

src/lib.rs Outdated
@@ -2103,12 +2111,23 @@ impl Build {
None => false,
};

let is_sim = match target.split('-').nth(3) {
let is_arm_sim = match target.split('-').nth(3) {
Copy link
Member

Choose a reason for hiding this comment

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

This should still be named is_sim -- As it is, further down we have x86-specific logic in an if is_arm_sim branch.

@youknowone
Copy link
Contributor Author

The first commit is #708

@youknowone
Copy link
Contributor Author

@thomcc rebase done, could you review it again?

src/lib.rs Outdated
/// Whether the tool is AppleClang under .xctoolchain
#[cfg(target_vendor = "apple")]
fn is_xctoolchain_clang(&self) -> bool {
let path = self.path.to_str().unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

This has bitten us before, it should probably be to_string_lossy.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I fixed it.

Copy link
Member

@thomcc thomcc left a comment

Choose a reason for hiding this comment

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

Thanks.

@thomcc thomcc merged commit 0fc8091 into rust-lang:main Sep 23, 2023
16 checks passed
@youknowone youknowone deleted the apple-clang branch September 23, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
O-apple Apple targets and toolchains
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants