Skip to content

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

Merged
merged 1 commit into from
Jun 20, 2016

Conversation

compnerd
Copy link
Member

What's in this pull request?

Resolved bug number: (SR-)


Before merging this pull request to apple/swift repository:

  • Test pull request on Swift continuous integration.

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

Platform Comment
All supported platforms @swift-ci Please smoke test
All supported platforms @swift-ci Please smoke test and merge
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
All supported platforms @swift-ci Please test and merge
OS X platform @swift-ci Please test OS X platform
OS X platform @swift-ci Please benchmark
Linux platform @swift-ci Please test Linux platform

Lint Testing

Language Comment
Python @swift-ci Please Python lint

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.

@compnerd
Copy link
Member Author

CC @gribozavr

@compnerd
Copy link
Member Author

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")
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@gribozavr
Copy link
Contributor

LGTM modulo comments.

@swift-ci Please test

@gribozavr
Copy link
Contributor

@compnerd Could you also take a look at the CI issues?

@compnerd
Copy link
Member Author

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.

@gribozavr
Copy link
Contributor

Re-running Linux:

@swift-ci Please test Linux platform

@gribozavr
Copy link
Contributor

@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
Copy link
Member

@rintaro rintaro Jun 20, 2016

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
                         ^^

Copy link
Member Author

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.

@compnerd compnerd force-pushed the single-is-crossed branch from c9d8fe6 to 05ccd6a Compare June 20, 2016 04:58
@gribozavr
Copy link
Contributor

@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")
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

@compnerd compnerd force-pushed the single-is-crossed branch from 05ccd6a to 36d6193 Compare June 20, 2016 05:13
set_target_properties("${target}"
PROPERTIES
INSTALL_RPATH "$ORIGIN:/usr/lib/swift/linux")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Cygwin")
elseif("${SWIFTLIB_SINGLE_SDK}" STREQUAL "Cygwin")
Copy link
Member

Choose a reason for hiding this comment

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

One more: Cygwin => CYGWIN

Copy link
Member Author

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.
@compnerd compnerd force-pushed the single-is-crossed branch from 36d6193 to b3ba457 Compare June 20, 2016 05:22
@gribozavr
Copy link
Contributor

@swift-ci Please test and merge

@swift-ci swift-ci merged commit 7575e66 into swiftlang:master Jun 20, 2016
@compnerd compnerd deleted the single-is-crossed branch July 3, 2016 17:22
kateinoigakukun added a commit to kateinoigakukun/swift that referenced this pull request Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants