andriydruk / swift-weather-app

Cross-platform Swift application for iOS/Mac/Android/Windows
MIT License
48 stars 10 forks source link

Process 'command '/Users/userA/swift-android-5.0-r13/build-tools/1.9.6-swift5/swift-build'' finished with non-zero exit value 134 #20

Open EddieMeng opened 3 years ago

EddieMeng commented 3 years ago

Hello, I'm very appreciated the swift-android toolchain you guys built. So I want to build and run this project personally, after set up the environment like the project said (https://github.com/readdle/swift-android-toolchain) , when I started build this project, I meet this error: Process 'command '/swift-android-5.0-r13/build-tools/1.9.6-swift5/swift-build'' finished with non-zero exit value 134. I fail to resolve this issue after many attempts, so here I come to ask you help, could you help me to check what's went wrong.

I list all the related information below:

  1. MacOS Version: Catalina version 10.15.4
  2. Android Studio Version: 4.2.2
  3. Gradle Version: 6.7.1, Android Studio Gradle plugin Version: 4.2.0
  4. swift-android-toolchain: 5.0-r13

Here is the build error I meet:

Task :app:installSwiftTools Installing Swift Build Tools v1.9.6-swift5 fatal: unable to access 'https://github.com/readdle/swift-android-buildtools/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 Swift Build Tools v1.9.6-swift5 installed

Task :app:swiftBuildArm64Debug FAILED Swift PM flags: --configuration debug -Xswiftc -DDEBUG EMBEDDED_CONTENT_CONTAINS_SWIFT=YES dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /Users/userA/swift-android-5.0-r13/toolchain/usr/bin/swift-build Reason: image not found /Users/userA/swift-android-5.0-r13/build-tools/1.9.6-swift5/swift-build: line 58: 3229 Abort trap: 6 $SWIFT_ANDROID_HOME/toolchain/usr/bin/swift-build --destination=<($SELF_DIR/generate-destination-json.sh) $flags "$@"

FAILURE: Build failed with an exception.

Here is my environment variable setting in case you want to check it.

Screen Shot 2021-07-05 at 01 13 36

I'm looking forward for your reply

andriydruk commented 3 years ago

Hi,

  1. Do you install the proper version of swift on your mac?
    [IMPORTANT] Install Swift 5.0.3 toolchain for Xcode https://swift.org/builds/swift-5.0.3-release/xcode/swift-5.0.3-RELEASE/swift-5.0.3-RELEASE-osx.pkg

I don't see export TOOLCHAINS=org.swift.50320190830a in your environment setup Looks like you try to use the android toolchain with your current XCode Swift 5.4. Please follow instructions from the readme.

  1. Also, it's weird that you can't clone our project from Github
    fatal: unable to access 'https://github.com/readdle/swift-android-buildtools/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

    Please try to clone in separately:

    git clone https://github.com/readdle/swift-android-buildtools

    Seems like you have some SSL issues on your machine.

EddieMeng commented 3 years ago

Hello, I did set export TOOLCHAINS=org.swift.50320190830a, but the screenshot above is not complete, here is the completed info

export TOOLCHAINS=org.swift.50320190830a

NDK=17c export ANDROID_NDK_HOME=/Users/Eddie/Downloads/Android/NDK/android-ndk-r$NDK

export NDK_ROOT=$ANDROID_NDK_HOME export ANDROID_NDK=$ANDROID_NDK_HOME export ANDROID_NDK_ROOT=$ANDROID_NDK_HOME

export SWIFT_ANDROID_HOME=$HOME/android/swift-android-current export PATH=$ANDROID_NDK_HOME:$PATH export PATH=$SWIFT_ANDROID_HOME/bin:$SWIFT_ANDROID_HOME/build-tools/current:$PATH

OH, yes, I have no idea why I got the ssl issue, but looks like the log tell me swift build tools completed regardless of the ssl issue fatal: unable to access 'https://github.com/readdle/swift-android-buildtools/': LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 Swift Build Tools v1.9.6-swift5 installed

EddieMeng commented 3 years ago

I found that ssl issue is the network issue, the latest build info don't report the ssl issue again

Task :app:installSwiftTools Installing Swift Build Tools v1.9.6-swift5 Swift Build Tools v1.9.6-swift5 installed

Task :app:swiftBuildArm64Debug FAILED Swift PM flags: --configuration debug -Xswiftc -DDEBUG dyld: Library not loaded: @rpath/libswiftCore.dylib Referenced from: /Users/userA/swift-android-5.0-r13/toolchain/usr/bin/swift-build Reason: image not found /Users/userA/swift-android-5.0-r13/build-tools/1.9.6-swift5/swift-build: line 58: 5412 Abort trap: 6 $SWIFT_ANDROID_HOME/toolchain/usr/bin/swift-build --destination=<($SELF_DIR/generate-destination-json.sh) $flags "$@"

FAILURE: Build failed with an exception.

By the way I build this project by this command: ./gradlew aseembleDebug, is that okay? @andriydruk

andriydruk commented 3 years ago

Yes, it's ok. We use Gradle build in our CI

Toolchain somewhy can't find your swift installation Could you check your swift version?

swift --version
EddieMeng commented 3 years ago
Screen Shot 2021-07-05 at 00 54 52

please check @andriydruk

EddieMeng commented 3 years ago

is it matter with the mac os version, what's your build server mac os version? I don't have clue about why this build error occur. @andriydruk

andriydruk commented 3 years ago

Hmm, the swift version looks ok. It should work with BigSur and Catalina. We use macos-latest on Github CI which is Catalina for now https://github.com/actions/virtual-environments

Maybe try to clean up the project/environment. Check our CI script maybe it will help you https://github.com/andriydruk/swift-weather-app/blob/master/.github/workflows/android-ui.yml

EddieMeng commented 3 years ago

Is your build server build the app by android studio or just gradle? and by the way, what the CI software are you using? @andriydruk

EddieMeng commented 3 years ago

I wanna confirm that is this project build by the github CI server?

andriydruk commented 3 years ago

We use Gradle in this CI script. But should work with Android Studio as well. And yes it's public Github CI without any priority servers https://docs.github.com/en/actions

EddieMeng commented 3 years ago

@andriydruk Hello andriydruk, thanks for your patient help. I tried the script in github server, it did build successfully. But when I tried to build the project in two different mac os machines, both met this error. Besides, I think I'm not the only one met this error refer to https://github.com/readdle/swift-android-toolchain/issues/20 , so it is probably a common issue in local build. I wanna know had this project ever built successfully in your guys mac os machine? so that I can figure out what went wrong.

EddieMeng commented 3 years ago

Sir, any update on this? @andriydruk

andriydruk commented 3 years ago

I have one more assumption: maybe problem with the macOS version. In Readdle everybody uses the latest version of Big Sur. Github CI provides macOS 10.15.7 and macOS 11.4 I will add one more CI script to double-check that everything works on both Catalina and Big Sur

EddieMeng commented 3 years ago

@andriydruk Sir, your assumption is correct, after I upgrade the system to latest version of Big Sur, I built the app successfully. I'm very appreciated this toolchain your guys created, the idea is awesome, please keep making it better and better. Besides, I am a fans of Spark email, which is powerful and intelligent, saving me lots of time. is the toolchain was applied in all the projects in Readdle?

andriydruk commented 3 years ago

@EddieMeng thank you for so warm words! We do our best to provide a good experience for all our users. And we are glad to share our expertise with the developer community.

Currently, we use the Swift Android toolchain only in Spark because it's the only Readdle's app on the Android platform 🙃