Skip to content
This repository has been archived by the owner on Aug 14, 2022. It is now read-only.

Question about build process #134

Open
NikolayJuly opened this issue Dec 1, 2021 · 6 comments
Open

Question about build process #134

NikolayJuly opened this issue Dec 1, 2021 · 6 comments

Comments

@NikolayJuly
Copy link

I'm new to build swift on android and only started to checking how it works
I have a few questions about the way you build your toolchain.

  1. I saw that swift repo has 2 instructions - windows and linux. And looks like they didn't add most obv how build swift for android from macOS. Did you try replicate same instructions as they provide and may be add it to repo?
  2. I see that you use node for automation. While scripts in swift repo are python. Any reason why js? Asking because I was interested in check how it works and gives me problem to find all needed information in scripts, becasue I simple can't find some 🙈
  3. How often you do releases? I see that 5.5.1 is out, but latest is 5.5.0
    Thank you for your help
@vgorloff
Copy link
Owner

vgorloff commented Dec 1, 2021

  1. The official instruction for building Swift on Android available at https://github.com/apple/swift/blob/main/docs/Android.md. This toolchain uses mix of instructions found for Linux, Windows and Android in Swift repository. Also incorporated some knowledge from https://github.com/readdle/swift-android-toolchain.

    It is not possible to grab build steps from this toolchain builder and put them into document https://github.com/apple/swift/blob/main/docs/Android.md for simple reason – the Swift repository not containing all needed dependencies to build for Android on macOS. See: https://github.com/apple/swift/blob/main/utils/update_checkout/update-checkout-config.json. As you may see there is no dependencies such as Curl and OpenSSL there.

  2. Simple because VSCode.app shows completions for JS "out of the box". Plus JS widely used language. Previously this toolchan was written on Ruby :0.

  3. Toolchain updated for every Swift release in sync with Xcode releases. Say, 5.5.1 will be released after Xcode 13.2 release (see status here: https://xcodereleases.com/). The reason to release after related Xcode.app release – simply because it Linux, Windows and macOS versions are final and ready, thus Android build patches need to be adjusted only once. Such approach will require rebuild toolchain (which takes ~1.5h) only once.

@NikolayJuly
Copy link
Author

Thank you very much for your reply.
I got point about release after xcode and point about JS.
But still, I'm struggling to understand point that it is impossible to make an easy instruction to build.

Instruction for linux, has extra steps, like install NDK. Shouldn't this to be the same? Add extra steps. And step about SSL might be obv extra link to repo, as last time I build it for iOS, I suffered a lot. But idea that having it in written form with more explanation will help community. And people like me specifically, to understand complexity of it.

@vgorloff
Copy link
Owner

vgorloff commented Dec 1, 2021

btw: I missed that Swift 5.5.1 was already released with Xcode 13.1. Will plan Toolchain update.

Instruction for linux, has extra steps, like install NDK. Shouldn't this to be the same? Add extra steps. And step about SSL might be obv extra link to repo, as last time I build it for iOS, I suffered a lot.

You mean to have e.g. Quick Start Guide in this repo? Or you mean adding extra information into Swift repository, into file https://github.com/apple/swift/blob/main/docs/Android.md?

@NikolayJuly
Copy link
Author

There is also: https://github.com/apple/swift/blob/main/docs/AndroidBuild.md with steps for android SDK on windows

So ideal would be to have document there, but it will require approve from them and plus, they might actually require to have all steps fully reproducabe, so no way to have easy line like: TBD: provide steps to build ssl for android later. But have it in swift repo would be ideal

Having here document, which will describe steps, which need to be taken to build toolchain and may be links to js files, which do it, would be also good. So if someone later will decide to add document to swift repo, will have a good start.

@vgorloff
Copy link
Owner

vgorloff commented Dec 1, 2021

Anybody can update Docs in Swift repo :)

In order to see which Cmake commands executed during build you can try to launch build in --dry-run mode: node main.js build --dry-run

$ node main.js build --dry-run

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"llvm-project" Configure [host] is started.
mkdir -p "/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-host/llvm-project"
cd /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-host/llvm-project && cmake \
   -G Ninja \
   -S /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Sources/llvm-project/llvm \
   -B /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-host/llvm-project \
   -D CMAKE_BUILD_TYPE=Release \
   -D LLVM_INCLUDE_EXAMPLES=false \
   -D LLVM_INCLUDE_TESTS=false \
   -D LLVM_INCLUDE_DOCS=false \
   -D LLVM_BUILD_TOOLS=false \
   -D LLVM_INSTALL_BINUTILS_SYMLINKS=false \
   -D LLVM_ENABLE_LIBXML2=FALSE \
   -D LLVM_TARGETS_TO_BUILD="ARM;AArch64;X86" \
   -D LLVM_ENABLE_ASSERTIONS=TRUE \
   -D LLVM_BUILD_EXTERNAL_COMPILER_RT=TRUE \
   -D CMAKE_INSTALL_PREFIX=/ \
   -D LLVM_ENABLE_PROJECTS="clang" \
   -D HAVE_CXX_ATOMICS64_WITHOUT_LIB=TRUE \
   -D HAVE_CXX_ATOMICS_WITHOUT_LIB=TRUE
"llvm-project" Configure [host] is completed.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<


>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
"llvm-project" Build [host] is started.
mkdir -p "/Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-host/llvm-project"
cd /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-host/llvm-project && ninja -C /Volumes/Shared/Git/MyProjects/swift-everywhere-toolchain/ToolChain/Build/darwin-host/llvm-project -j5 clang llvm-tblgen clang-tblgen llvm-libraries clang-libraries
"llvm-project" Build [host] is completed.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

# And many more commands . . .

This will give you information similar to one written in https://github.com/apple/swift/blob/main/docs/AndroidBuild.md

@NikolayJuly
Copy link
Author

Thank you, this is kind of information I was looking for. Just didn't run build from JS on my own yet.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants