Skip to content

Fix build-script for macOS-Android cross-compilation SDK #164

Open
@marcprux

Description

@marcprux

PR #162 adds building and testing the Android SDK on macOS. It currently just re-uses the Ubuntu SDK that is created and cached in the CI. Ideally, we would also be able to build the SDK from macOS by running build-script in the macOS CI job.

However, there are various errors when running the build script. One such error (from a CI Run) is:

FAILED: lib/swift/android/x86_64/libswiftRemoteMirror.so 
: && /Users/runner/work/swift-android-sdk/swift-android-sdk/sdk-config/swift-5.10.1-RELEASE/usr/bin/clang -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -fPIC -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -O3 -DNDEBUG    -shared -Wl,-soname,libswiftRemoteMirror.so -target x86_64-unknown-linux-android24 --sysroot=/Users/runner/Library/Android/sdk/ndk/26.3.11579264/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -B /Users/runner/Library/Android/sdk/ndk/26.3.11579264/toolchains/llvm/prebuilt/darwin-x86_64/bin -lm -resource-dir= -fuse-ld=lld -Wl,-dead_strip -o lib/swift/android/x86_64/libswiftRemoteMirror.so   stdlib/public/LLVMSupport/CMakeFiles/swiftLLVMSupport-android-x86_64.dir/ErrorHandling.cpp.o stdlib/public/LLVMSupport/CMakeFiles/swiftLLVMSupport-android-x86_64.dir/Hashing.cpp.o stdlib/public/LLVMSupport/CMakeFiles/swiftLLVMSupport-android-x86_64.dir/MemAlloc.cpp.o stdlib/public/LLVMSupport/CMakeFiles/swiftLLVMSupport-android-x86_64.dir/SmallPtrSet.cpp.o stdlib/public/LLVMSupport/CMakeFiles/swiftLLVMSupport-android-x86_64.dir/SmallVector.cpp.o stdlib/public/LLVMSupport/CMakeFiles/swiftLLVMSupport-android-x86_64.dir/StringRef.cpp.o stdlib/public/SwiftRemoteMirror/CMakeFiles/swiftRemoteMirror-android-x86_64.dir/SwiftRemoteMirror.cpp.o -L/Users/runner/work/swift-android-sdk/swift-android-sdk/sdk-config/build/Ninja-Release/llvm-android-x86_64/./lib   -L/Users/runner/work/swift-android-sdk/swift-android-sdk/sdk-config/build/Ninja-Release/swift-android-x86_64/./lib/swift/android/x86_64   -L/Users/runner/work/swift-android-sdk/swift-android-sdk/sdk-config/swift-5.10.1-RELEASE/usr/bin/../lib/swift/android/x86_64   -L/Users/runner/work/swift-android-sdk/swift-android-sdk/sdk-config/swift-5.10.1-RELEASE/usr/bin/../lib/swift/android   -L/Users/runner/Library/Android/sdk/ndk/26.3.11579264/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/swift -Wl,-rpath,"\$ORIGIN"  lib/swift/android/x86_64/libswiftRemoteInspection.a  -ldl  -llog  /Users/runner/Library/Android/sdk/ndk/26.3.11579264/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++abi.a  /Users/runner/Library/Android/sdk/ndk/26.3.11579264/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/lib/x86_64-linux-android/libc++_shared.so && :
ld.lld: error: unknown argument '-dead_strip'
ld.lld: error: cannot open lib/linux/libclang_rt.builtins-x86_64-android.a: No such file or directory
ld.lld: error: unable to find library -l:libunwind.a
ld.lld: error: cannot open lib/linux/libclang_rt.builtins-x86_64-android.a: No such file or directory
ld.lld: error: unable to find library -l:libunwind.a

I suspect that many of these come from cmake checking whether the host system is Darwin without accounting for the destination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions