-
Notifications
You must be signed in to change notification settings - Fork 10.5k
build: make swift_lib_add_single more amenable to cross-compilation #3068
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
Conversation
CC @gribozavr |
CC @modocache |
"${SWIFTLIB_SINGLE_SDK}" STREQUAL "TVOS" OR | ||
"${SWIFTLIB_SINGLE_SDK}" STREQUAL "TVOS_SIMULATOR" OR | ||
"${SWIFTLIB_SINGLE_SDK}" STREQUAL "WATCHOS" OR | ||
"${SWIFTLIB_SINGLE_SDK}" STREQUAL "WATCHOS_SIMULTOR") |
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.
This duplication is error-prone. (We also have another copy in _add_variant_c_compile_link_flags
.) Would you mind adding a helper function?
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.
Actually, that was something that I was thinking of. Would you like to make that a part of this PR or commit or a follow up? Ignoring the duplication in this file, there is at least one other site where this exact check is made. Its getting slightly annoying to see this duplicated, so I too would like to replace it with a helper function.
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.
typo: WATCHOS_SIMULTOR
=> WATCHOS_SIMULATOR
Not related to current failure though.
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.
Fixed.
LGTM modulo comments. @swift-ci Please test |
@compnerd Could you also take a look at the CI issues? |
The Linux failure seems unrelated? (it seems like a swiftpm build failure). However, it seems that the OSX failures are much more interesting. Im not sure I fully understand whats happening there. Isnt ${CMAKE_BUILD_SYSTEM} STREQUAL "Darwin" the check for any {mac,i,tv,watch}OS build? The error seems oddly like a LC_DYLIB in libswiftCore.dylib is referencing a dylib which is not available. |
Re-running Linux: @swift-ci Please test Linux platform |
@compnerd Yes, they should be equivalent. I'm afraid I don't immediately see what is wrong here. Do you have access to a macOS machine to debug? |
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") | ||
if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "OSX" OR | ||
"${SWIFTLIB_SINGLE_SDK}" STREQUAL "IOS" OR | ||
"${SWIFTLIB_SINGLE_SDK} "STREQUAL "IOS_SIMULATOR" OR |
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.
extra space:
- "${SWIFTLIB_SINGLE_SDK} "STREQUAL "IOS_SIMULATOR" OR
+ "${SWIFTLIB_SINGLE_SDK}" STREQUAL "IOS_SIMULATOR" OR
^^
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.
Ugh, thanks for that. Fixed that.
c9d8fe6
to
05ccd6a
Compare
@swift-ci Please test |
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR | ||
"${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD") | ||
if("${SWIFTLIB_SINGLE_SDK}" STREQUAL "Linux" OR | ||
"${SWIFTLIB_SINGLE_SDK}" STREQUAL "FreeBSD") |
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.
STREQUAL
is case-sensitive. @rintaro is right, string constants should be uppercase.
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.
Updated.
05ccd6a
to
36d6193
Compare
set_target_properties("${target}" | ||
PROPERTIES | ||
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/linux") | ||
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Cygwin") | ||
elseif("${SWIFTLIB_SINGLE_SDK}" STREQUAL "Cygwin") |
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.
One more: Cygwin
=> CYGWIN
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.
Oops. Good eye :-). Done.
Use the SWIFTLIB_SINGLE_SDK variable rather than the CMAKE_BUILD_SYSTEM variable to determine the target type. This allows us to use the logic for adding libraries for foreign OSes on a build host. This is needed to pave the road to cross-crompiling the standard library for different targets.
36d6193
to
b3ba457
Compare
@swift-ci Please test and merge |
Merge main 2021-05-06
What's in this pull request?
Resolved bug number: (SR-)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
Validation Testing
Lint Testing
Note: Only members of the Apple organization can trigger swift-ci.
Use the SWIFTLIB_SINGLE_SDK variable rather than the CMAKE_BUILD_SYSTEM variable
to determine the target type. This allows us to use the logic for adding
libraries for foreign OSes on a build host. This is needed to pave the road to
cross-crompiling the standard library for different targets.