-
Notifications
You must be signed in to change notification settings - Fork 10.5k
CMake: ensure Swift host tools depend on HostCompatibilityLibs target #73065
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
CMake: ensure Swift host tools depend on HostCompatibilityLibs target #73065
Conversation
9e17ac3
to
40f789b
Compare
@swift-ci please test |
@swift-ci please test WebAssembly |
@swift-ci please test Apple Silicon |
@swift-ci please build toolchain |
@swift-ci Please Test Source Compatibility Release |
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.
target_link_libraries
should almost always be universally preferred over target_link_directories
. That ensures that the dependencies are wired up properly.
I think this changes a subtle detail here and I'm still working out whether it will still be fine or not. These libraries are part of the toolchain content and should only be linked under certain circumstances as decided by the driver/compiler, including info about the minimum version of the runtime you're backdeploying to. That is, these should only be linked when the driver/compiler decides to do so. In the case where the driver/compiler decides to link them, it will do so automatically, so I don't think Now, that said, these are static archives, so if the generated binary doesn't have one of the compatibility FORCE_LOAD symbols that it needs to resolve, the lazy-link behavior of static archives should actually skip over the entire archive since it isn't needed. I think |
40f789b
to
584dd98
Compare
@swift-ci please test |
@swift-ci please test WebAssembly |
@swift-ci please test Apple Silicon |
@swift-ci please build toolchain |
@swift-ci Please Test Source Compatibility Release |
Updated the PR based on Evan's feedback. |
@@ -466,6 +466,11 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping) | |||
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS) | |||
|
|||
set(sdk_dir "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}/usr/lib/swift") | |||
get_property(compatibility_libs |
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.
Did add_dependencies(${target} HostCompatibilityLibs)
not work?
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.
In this case no, because HostCompatibilityLibs
is defined as an interface library, so its dependencies would only be expanded if I used target_link_libraries
-- this is the same approach I perused in #60728
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.
Added a comment about this in 4d14497 (as this is an aspect of interface libraries that is easy to forget)
@swift-ci please test Linux |
Source Compatibility Suite results look good -- for some reason I got only 3 failures, a subset of the 5 found in the corresponding job |
At the time I implemented swiftlang#60728, I did not realize that in all the bootstrapping mode we need to depend on the compatibility libraries we build -- otherwise when targeting a low deployment target we risk failing because we are not able to find such libraries. Addresses rdar://126552386
584dd98
to
4d14497
Compare
@swift-ci please test |
@swift-ci please test WebAssembly |
@swift-ci please test Apple Silicon |
@swift-ci please build toolchain |
@swift-ci Please Test Source Compatibility Release |
At the time I implemented #60728, I did not realize that in all the bootstrapping mode we need to depend on the compatibility libraries we build -- otherwise when targeting a low deployment target we risk failing because we are not able to find such libraries.
Addresses rdar://126552386