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

clang-14: Fix build under Xcode 15, re-enabling sanitizers on macOS 14 #20625

Merged
merged 1 commit into from Sep 28, 2023

Conversation

markmentovai
Copy link
Contributor

This also reverts the following as they relate to clang-14:

370d81a llvm-14: Allow build on darwin23 but disable sanitizers
0c2af47 llvm-{10-14}: Restrict to darwin < 23

Note that the actual incompatibility was not strictly between clang-14 and Darwin 23 (macOS 14) as these previous commits suggest. The incompatibility existed between clang-14 and the macOS 14 SDK, which is part of Xcode 15. The incompatibility equally affected clang-14 on macOS 13 (Darwin 22) using Xcode 15.

This also makes the compiler-rt build for various runtimes targeting iOS and iOS Simulator work correctly by removing the macOS SDK -syslibroot when linking, allowing the platform-specific SDK provided by the Clang build to be effective.

Fixes: https://trac.macports.org/ticket/68257

Description

Type(s)
  • bugfix
  • enhancement
  • security fix
Tested on

macOS 14.0 23A344 arm64
Xcode 15.0 15A240d

Verification

Have you

  • followed our Commit Message Guidelines?
  • squashed and minimized your commits?
  • checked that there aren't other open pull requests for the same change?
  • referenced existing tickets on Trac with full URL?
  • checked your Portfile with port lint --nitpick?
  • tried existing tests with sudo port test?
  • tried a full install with sudo port -vst install?
  • tested basic functionality of all binary files?
  • checked that the Portfile's most important variants haven't been broken?

@cjones051073

This also reverts the following as they relate to clang-14:

370d81a llvm-14: Allow build on darwin23 but disable sanitizers
0c2af47 llvm-{10-14}: Restrict to darwin < 23

Note that the actual incompatibility was not strictly between clang-14
and Darwin 23 (macOS 14) as these previous commits suggest. The
incompatibility existed between clang-14 and the macOS 14 SDK, which is
part of Xcode 15. The incompatibility equally affected clang-14 on macOS
13 (Darwin 22) using Xcode 15.

This also makes the compiler-rt build for various runtimes targeting iOS
and iOS Simulator work correctly by removing the macOS SDK -syslibroot
when linking, allowing the platform-specific SDK provided by the Clang
build to be effective.

Fixes: https://trac.macports.org/ticket/68257
foreach rtl_dir {asan lsan stats tsan/rtl ubsan ubsan_minimal} {
set rtl [lindex [split ${rtl_dir} /] 0]
foreach rtl_os {ios iossim} {
reinplace "s|-Wl,-syslibroot,${configure.sdkroot}||" "${workpath}/build/projects/compiler-rt/lib/${rtl_dir}/CMakeFiles/clang_rt.${rtl}_${rtl_os}_dynamic.dir/link.txt"
Copy link
Member

Choose a reason for hiding this comment

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

Is this something that we should also do for clang-15 and newer ?

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 ports for clang-15 and newer don’t build runtime libraries for ios and iossim at the moment, because

# Disable iOS support
# To Be reviewed with later versions
# https://reviews.llvm.org/D133273
configure.args-append -DCOMPILER_RT_ENABLE_IOS=OFF

I’m not sure exactly why this was disabled—if it was for this reason, then yes, sure. But I don’t know whether there’s another reason standing in the way. That’s why I only did it for clang-14.

Copy link
Member

Choose a reason for hiding this comment

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

Ah yes, good point. It would be good to review that at some point but its not required for this PR. Thanks for your contribution...

@cjones051073 cjones051073 merged commit 93df941 into macports:master Sep 28, 2023
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants