Skip to content

Add zippering support #62712

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 3 commits into from
Jan 4, 2023
Merged

Conversation

etcwilde
Copy link
Member

Setting the SWIFT_ENABLE_MACCATALYST flag will build the compatibility libraries with zippering enabled.

Note that AppleClang and LLVM Clang use different flags to write zippered files. The Swift stdlib build doesn't know what clang we're using, so we can't ask it for the compiler ID to determine which whether we're using AppleClang or LLVM clang, hence the nasty execute_process trick to figure out whether the compiler that's actually compiling the stdlib knows about the flag or not.

This should fix #61418.

@etcwilde etcwilde requested a review from compnerd December 20, 2022 18:41
@etcwilde
Copy link
Member Author

@compnerd I'm pretty sure that this shouldn't break Windows since the runtimes should only be built with the special clang, which will know about the catalyst bundling and because we can't build for catalyst on Windows anyway. But I'm not 100% certain. I'd appreciate your input.

@etcwilde
Copy link
Member Author

@swift-ci please test

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

This should be safe for Windows, but this is still pretty terrible. The compiler swap occurs at stdlib build time right?

# Check if the C compiler supports `-target-variant` flag
# TODO (etcwilde): This is a massive hack to deal with the fact that we
# are lying to cmake about what compiler is being used. Normally we could
# use `check_cxx_compiler_flag` here. Unfortunately, that uses a different
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# use `check_cxx_compiler_flag` here. Unfortunately, that uses a different
# use `check_c_compiler_flag` here. Unfortunately, that uses a different

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's check_compiler_flag(<lang> ...) now anyway. Will fix comment.

RESULT_VARIABLE
SUPPORTS_TARGET_VARIANT)

if(SUPPORTS_TARGET_VARIANT EQUAL 0)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if(SUPPORTS_TARGET_VARIANT EQUAL 0)
if(NOT SUPPORTS_TARGET_VARIANT)

# TODO (etcwilde): This is a massive hack to deal with the fact that we
# are lying to cmake about what compiler is being used. Normally we could
# use `check_cxx_compiler_flag` here. Unfortunately, that uses a different
# compiler since we swap out the C compiler part way through the build.
Copy link
Member

Choose a reason for hiding this comment

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

I really wish that we would stop doing this ...

Copy link
Member Author

Choose a reason for hiding this comment

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

I do too. I do too.

Upstream build system zippering support.

Setting the `SWIFT_ENABLE_MACCATALYST` flag will build the compatibility
libraries with zippering enabled.

Note that AppleClang and LLVM Clang use different flags to write
zippered files. The Swift stdlib build doesn't know what clang we're
using, so we can't ask it for the compiler ID to determine which whether
we're using AppleClang or LLVM clang, hence the nasty `execute_process`
trick to figure out whether the compiler that's actually compiling the
stdlib knows about the flag or not.
@etcwilde
Copy link
Member Author

The compiler swap occurs at stdlib build time right?

It happens in a couple of places. We swap the compilers for the stdlib, but it's also done in the bootstrap IIRC.

Adding maccatalyst support to the osx nightly package.
@etcwilde
Copy link
Member Author

This is looking pretty good now. My local test with catalyst enabled is linking correctly but I'm still missing the catalyst swift modules. I'll keep digging.

This patch goes through and adds zippering and the swift module
dependencies to a bunch of pieces of the swift runtimes. Here's to
hoping I hit everything that needed to be hit. :D

With this patch, I'm seeing the appropriate modules under
lib/swift/maccatalyst, so things seem to be working right.
@etcwilde etcwilde force-pushed the ewilde/zipping-zippers-zip branch from 4482922 to f8a5418 Compare December 22, 2022 21:49
@etcwilde
Copy link
Member Author

@swift-ci please test

@etcwilde
Copy link
Member Author

@swift-ci please macOS toolchain build

@etcwilde
Copy link
Member Author

@swift-ci Please Build Toolchain macOS Platform

@etcwilde
Copy link
Member Author

etcwilde commented Jan 3, 2023

@swift-ci please test

@etcwilde
Copy link
Member Author

etcwilde commented Jan 3, 2023

Linux failure:

warning: 'swift-llbuild': skipping cache due to an error: Failed to clone repository https://github.com/apple/swift-llbuild.git:
    Cloning into bare repository '/home/build-user/build/buildbot_linux/.cache/org.swift.swiftpm/repositories/swift-llbuild-0f2964f9'...
    fatal: unable to access 'https://github.com/apple/swift-llbuild.git/': Failed to connect to github.com port 443: Connection timed out

Unrelated CI failure.

@etcwilde
Copy link
Member Author

etcwilde commented Jan 3, 2023

@swift-ci please test Linux

@etcwilde etcwilde merged commit e88e947 into swiftlang:main Jan 4, 2023
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.

Open source builds do not support MacCatalyst target
2 participants