mirror of
https://github.com/apple/swift-nio
synced 2026-11-22 04:30:41 +00:00
android build use swift static stdlib ### Motivation: Android build fails and the guide says to use this flag https://www.swift.org/documentation/articles/swift-sdk-for-android-getting-started.html Recent failure - although weirdly it doesn't seem to happen every time: ``` error: link command failed with exit code 1 (use -v to see invocation) ld.lld: error: cannot open crtbegin_dynamic.o: No such file or directory ld.lld: error: cannot open crtend_android.o: No such file or directory clang: error: linker command failed with exit code 1 (use -v to see invocation) [558/601] Linking NIOUDPEchoClient ``` ### Modifications: android build use swift static stdlib ### Result: hopefully success - making this change locally seemed to work. This change can be seen in action here https://github.com/apple/swift-nio/actions/runs/18949279888/job/54110590743?pr=3430
35 lines
1.2 KiB
Bash
Executable File
35 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
##===----------------------------------------------------------------------===##
|
|
##
|
|
## This source file is part of the SwiftNIO open source project
|
|
##
|
|
## Copyright (c) 2025 Apple Inc. and the SwiftNIO project authors
|
|
## Licensed under Apache License v2.0
|
|
##
|
|
## See LICENSE.txt for license information
|
|
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
##
|
|
## SPDX-License-Identifier: Apache-2.0
|
|
##
|
|
##===----------------------------------------------------------------------===##
|
|
|
|
set -uo pipefail
|
|
|
|
log() { printf -- "** %s\n" "$*" >&2; }
|
|
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
|
|
fatal() { error "$@"; exit 1; }
|
|
|
|
# Parameter environment variables
|
|
swift_sdk_directory="${SWIFT_SDK_DIRECTORY:-"/tmp/swiftsdks"}"
|
|
|
|
log "Using Swift SDK directory: $swift_sdk_directory"
|
|
|
|
# Select the Swift SDK for Android
|
|
SWIFT_SDK="$(swift sdk list --swift-sdks-path "$swift_sdk_directory" | grep android | head -n1)"
|
|
if [[ -z "$SWIFT_SDK" ]]; then
|
|
fatal "No Android Swift SDK found. Please ensure you have the Android Swift SDK installed."
|
|
fi
|
|
|
|
log "Building using Swift SDK: $SWIFT_SDK"
|
|
swift build --swift-sdk "$SWIFT_SDK" --swift-sdks-path "$swift_sdk_directory" --static-swift-stdlib "${@}"
|