Skip to content

[build] Fix libcurl and cross-compiling corelibs #82924

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 2 commits into from
Jul 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,12 @@ function set_build_options_for_host() {
# and it must be the same for both LLVM and Swift

if [[ "${SWIFT_HOST_TRIPLE}" ]] ; then
# Adding this until we can configure these corelibs repos with a CMake
# toolchain file
SWIFT_TARGET_CMAKE_OPTIONS+=(
-DCMAKE_Swift_COMPILER_TARGET:STRING="${SWIFT_HOST_TRIPLE}"
Copy link
Member Author

Choose a reason for hiding this comment

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

Recent corelibs changes to use CMAKE_Swift_COMPILER_TARGET broke cross-compiling with build-script. This wasn't noticed on the CI because the only one that cross-compiles the whole toolchain, the macOS CI, doesn't build corelibs like libdispatch or Foundation. I've been working around this for months on my Android CI, finagolfin/swift-android-sdk@774f3b612, but this fixes it so I can remove those.

)

llvm_cmake_options+=(
-DLLVM_HOST_TRIPLE:STRING="${SWIFT_HOST_TRIPLE}"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ def build(self, host_target):
self.cmake_options.define('ENABLE_UNIX_SOCKETS', 'NO')
self.cmake_options.define('ENABLE_THREADED_RESOLVER', 'NO')
self.cmake_options.define('USE_ECH', 'NO')
self.cmake_options.deifne('USE_HTTPSRR', 'NO')
self.cmake_options.deifne('USE_OPENSSL_QUIC', 'NO')
self.cmake_options.define('USE_HTTPSRR', 'NO')
self.cmake_options.define('USE_OPENSSL_QUIC', 'NO')

self.generate_toolchain_file_for_darwin_or_linux(host_target)

if self.args.build_zlib:
# If we're building zlib, make cmake search in the built toolchain
toolchain_path = self.host_install_destdir(host_target)
self.cmake_options.define('CMAKE_FIND_ROOT_PATH', toolchain_path)
self.build_with_cmake(['libcurl'], self.args.curl_build_variant, [])
self.build_with_cmake(['libcurl_static'], self.args.curl_build_variant, [])