You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Set up community build bot for Linux/Aarch64 builds #547
Per recent email list discussion I've proposed setting up a community-run build bot for Linux/Aarch64 (ARM64) builds of LLVM + binaryen that can be downloaded by emsdk for direct installation on compatible machines.
(This is a niche platform today but we can expect it to become big as Apple is planning to convert their entire Mac line over to ARM64 CPUs in the next two years. Macs will eventually want native macOS/ARM64 builds too but Linux/ARM64 builds will also be used there in things like Docker or other virtualized Linux environments too, and it's easier to bootstrap now with easy availability of Linux server VMs)
I'm seeing a small regression in building with emsdk on ARM64 that I'll check over, then I'll see if I can build using the same tool that's used for the CI builds that emsdk downloads and make sure we've got something compatible.
Reacted by Ryan Lester, Nils Hjelte, Damian, Fathy Boundjadj and Agriya Khetarpal
Talking to @Brion , wasm2c may be able to help here. While we don't like the idea of end users needing to build C builds, if the main infra produces C builds then those could be built by @Brion on an ARM machine, which as a single C file is much simpler than LLVM with the whole build system there. And then those builds would be uploaded, so end users get fully compiled builds, and wasm2c is just a step in the middle.
This will still have some downsides (like there is no simd or pthreads in wasm2c builds atm), so it would be best to get normal builds up. But I think it's worth seeing about wasm2c builds on the main bots - just one more build target, and it doesn't need a special machine to do so (the fast Linux machines can do it).
The problem not that that target machine can't build llvm from source (its full linux/arm installation). He can build the whole SDK just fine. The problem @Brion wants to solve is having a pre-built set of binaries uploaded by the bots. So it mostly about infa maintenance. Converting to wasm2c doesn't seem to solve this specific problem AFAICT.
Bit wait, I though the original discussion for this issue came of out request to have pre-built binaries because building from source was too slow? Am I remembering wrong?
If the problem is "I can't build from source on arm linux", then that seems like something that should be solvable. I'm sure llvm itself must be buildable on arm linux.
Maybe @Brion you can elaborate on the specific issues you ran into, that you referred to in the tweet?
In general, I think it is useful to make things simpler. If we emit a C build that makes setting up community bots as easy as "create a VM, clang clang.c, clang wasm-opt.c etc." then that's helpful - no build systems, no need to install anything. As we have more platforms (not just ARM Linux but also ARM MacOS etc.) the easier we make this the more helpful it will be.
on Linux/arm64, ready-to-run release binaries cannot be installed with emsdk, requiring slow memory and disk-intensive local compilation of LLVM and binaryen before one is able to use emcc
Proposed solution is:
provide community-buillt Linux/arm64 binaries alongside the official Linux/x86_64 and other binaries, so emsdk can download and install them without local compilation
There seem to be two ways to compile emscripten's dependencies:
compile through emsdk (not used by the production releases, so may not be tested or reliable or compatible with binary downloads)
compile through waterfall (used by the production releases, so is tested and reliable and will produce builds configured the same way as the release builds)
I've previously done patches to emsdk to allow building on Linux/arm & Linux/arm64 so once I fixed a small recent regression, building with emsdk does seem to work. However I'm not certain if it's the recommended way to be building for release packaging.
I made an attempt to build with waterfall as well, however quickly discovered that it hardcodes x86_64 as the architecture to build for, so when it fetches prebuilt dependencies like cmake or virtualenv they fail to execute on a Linux/arm64 system.
So there are three ways forward I think:
go ahead and use emsdk as a meta-build tool, at the risk of divergence from the release builds
modify waterfall to be aware of multiple architectures and either download native binaries for deps or require them to be installed in the environment
modify waterfall to produce a wasm2c build of all the output binaries and then on the community-run build bots do an intermediate stage build from the C source files into native Linux/arm64 (etc) binaries
There would additionally need to be agreement on how to store & distribute the community binaries and change emsdk to point at them.
I think (2) would b easiest of all those options (and depending on the system tools seeems find to me).
Side note: I'm not sure what you mean by virtualenv.. as far as I know we don't use that in the waterfall. Do do download cmake binaries though.
I wish (1) was easier and it make be pretty sad that we have two completely different ways to build the SDK and the results look quite different. I would actually love to go back to shipping separate packages for llvm, binarien and emscripten like the emsdk does, but its fair bit of work, and probably not worth it right now.
Linux raspberrypi 5.10.63-v8+ #1496 SMP PREEMPT Wed Dec 1 15:59:46 GMT 2021 aarch64 GNU/Linux
./emsdk install 2.0.33
Resolving SDK version '2.0.33' to 'sdk-releases-upstream-cef8850d57278271766fb2163eebcb07354018e7-64bit'
error: tool or SDK not found: 'sdk-releases-upstream-cef8850d57278271766fb2163eebcb07354018e7-64bit'
@sbc100@Brion@kripken Hi! I'm with the Graviton team at AWS. We'd like to provide resources to the project so that it can be built on arm64. I'm happy to carry water and chop wood as needed.
What's the best way to get started?
You can also reach me at my email address, is the first 4 letters of my last name (fisc), followed by the first 2 letters of my first name (mi), at amazon.com.
On each commit run the ./src/build.py script from that repo
Upload the results to some publicly accessible storage bucket
Point emsdk at the uploaded assets
For (2) you might need to do some hacking to get the ./src/build.py to run on your infra
For (4) we might need/want to modify the emsdk/scripts/create_release.py script, or create a separate process for injecting the arm64 binaries into the emscripten-releases-tags.json file.
The build.py script appears to download a number of prebuilt binaries including CMake, Node.JS, and Java from https://wasm.storage.googleapis.com/ -- I assume this is to ensure reproducible builds vs. relying on whatever the distro may provide. These prebuilt binaries don't seem to be available for Linux/arm64, so the script terminates quickly.
Is this strictly required, as opposed to, say, using a Docker image?
If it's strictly required, how do we make those prerequisites available?
We could modify the build.py such that it assume the presence of system installs of all of those things.
We run this script on chromium infrastruce over which we have limited control so its usefull for us that it is hermetic in the way. I don't believe using docker is an option for us, and also need to continue to run on both macOS and windows.
But modifying the script to also run on your infrastructure is fine... including avoiding those specific versions of the tools.
BTW I think it should be possible to test there binaries using docker + qemu on your linux x84_64 machine. (See WebAssembly/wabt#2380 for an example how to do this).
Hmm, that may be an artifact of the previous emsdk linux/arm version being installed [for the emscripten components]. But I don't know how to get another version except by installing from source or going over to an x86 machine.
Ok I manually copied over the latest release emscripten from an x86_64 VM, plus the latest version of the aarch64 wasm tools build, and it works :D
brooke@bookworm:~/src/test$ uname -a
Linux bookworm 6.6.12-linuxkit #1 SMP Thu Feb 8 06:36:34 UTC 2024 aarch64 GNU/Linux
brooke@bookworm:~/src/test$ emcc --version
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.56 (cf90417346b78455089e64eb909d71d091ecc055)
Copyright (C) 2014 the Emscripten authors (see AUTHORS.txt)
This is free and open source software under the MIT license.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
brooke@bookworm:~/src/test$ emcc -o test.js test.c && node ./test.js
Hello, world
It would be good to some very minimal testing the of the arm64 binaryen on the x86_64 build host. If that is not possible we can also take are of that on the emsdk and emscripten builders which have access that arm64 circleci bots.
If this is something it would be easy to do in a github action on the emsdk side, that's probably going to be easier in the short run that setting it up in Chromium. I'm not sure Chromium's infrastructure has a convenient emulator install.
Activity
kripken commentedon Jul 15, 2020
Talking to @Brion , wasm2c may be able to help here. While we don't like the idea of end users needing to build C builds, if the main infra produces C builds then those could be built by @Brion on an ARM machine, which as a single C file is much simpler than LLVM with the whole build system there. And then those builds would be uploaded, so end users get fully compiled builds, and wasm2c is just a step in the middle.
This will still have some downsides (like there is no simd or pthreads in wasm2c builds atm), so it would be best to get normal builds up. But I think it's worth seeing about wasm2c builds on the main bots - just one more build target, and it doesn't need a special machine to do so (the fast Linux machines can do it).
sbc100 commentedon Jul 15, 2020
The problem not that that target machine can't build llvm from source (its full linux/arm installation). He can build the whole SDK just fine. The problem @Brion wants to solve is having a pre-built set of binaries uploaded by the bots. So it mostly about infa maintenance. Converting to wasm2c doesn't seem to solve this specific problem AFAICT.
kripken commentedon Jul 15, 2020
@sbc100 See https://twitter.com/brionv/status/1283165113248133121 and earlier tweets right before it - my understanding is that there are some difficulties with building from source.
It would be much easier to just build a C file -
clang clang.cand that's it.sbc100 commentedon Jul 15, 2020
Bit wait, I though the original discussion for this issue came of out request to have pre-built binaries because building from source was too slow? Am I remembering wrong?
If the problem is "I can't build from source on arm linux", then that seems like something that should be solvable. I'm sure llvm itself must be buildable on arm linux.
kripken commentedon Jul 16, 2020
Maybe @Brion you can elaborate on the specific issues you ran into, that you referred to in the tweet?
In general, I think it is useful to make things simpler. If we emit a C build that makes setting up community bots as easy as "create a VM,
clang clang.c,clang wasm-opt.cetc." then that's helpful - no build systems, no need to install anything. As we have more platforms (not just ARM Linux but also ARM MacOS etc.) the easier we make this the more helpful it will be.bvibber commentedon Jul 16, 2020
The original problem is roughly:
Proposed solution is:
There seem to be two ways to compile emscripten's dependencies:
I've previously done patches to emsdk to allow building on Linux/arm & Linux/arm64 so once I fixed a small recent regression, building with emsdk does seem to work. However I'm not certain if it's the recommended way to be building for release packaging.
I made an attempt to build with waterfall as well, however quickly discovered that it hardcodes x86_64 as the architecture to build for, so when it fetches prebuilt dependencies like cmake or virtualenv they fail to execute on a Linux/arm64 system.
So there are three ways forward I think:
There would additionally need to be agreement on how to store & distribute the community binaries and change emsdk to point at them.
I hope this clarifies what I'm thinking. Thanks!
sbc100 commentedon Jul 16, 2020
I think (2) would b easiest of all those options (and depending on the system tools seeems find to me).
Side note: I'm not sure what you mean by virtualenv.. as far as I know we don't use that in the waterfall. Do do download cmake binaries though.
I wish (1) was easier and it make be pretty sad that we have two completely different ways to build the SDK and the results look quite different. I would actually love to go back to shipping separate packages for llvm, binarien and emscripten like the emsdk does, but its fair bit of work, and probably not worth it right now.
CarloCattano commentedon Feb 7, 2022
Also unable to build emscripten on pi 64 bit
mifisignal commentedon Mar 16, 2022
@sbc100 @Brion @kripken Hi! I'm with the Graviton team at AWS. We'd like to provide resources to the project so that it can be built on arm64. I'm happy to carry water and chop wood as needed.
What's the best way to get started?
You can also reach me at my email address, is the first 4 letters of my last name (fisc), followed by the first 2 letters of my first name (mi), at amazon.com.
sbc100 commentedon Mar 16, 2022
Awesome! Thanks for the offer to help out.
As far as I understand these are roughly the steps that need to happen:
./src/build.pyscript from that repoFor (2) you might need to do some hacking to get the
./src/build.pyto run on your infraFor (4) we might need/want to modify the
emsdk/scripts/create_release.pyscript, or create a separate process for injecting the arm64 binaries into theemscripten-releases-tags.jsonfile.@Brion does that sounds about right to you?
mifisignal commentedon Mar 16, 2022
The
build.pyscript appears to download a number of prebuilt binaries including CMake, Node.JS, and Java from https://wasm.storage.googleapis.com/ -- I assume this is to ensure reproducible builds vs. relying on whatever the distro may provide. These prebuilt binaries don't seem to be available for Linux/arm64, so the script terminates quickly.sbc100 commentedon Mar 16, 2022
We could modify the
build.pysuch that it assume the presence of system installs of all of those things.We run this script on chromium infrastruce over which we have limited control so its usefull for us that it is hermetic in the way. I don't believe using docker is an option for us, and also need to continue to run on both macOS and windows.
But modifying the script to also run on your infrastructure is fine... including avoiding those specific versions of the tools.
sbc100 commentedon Mar 16, 2022
BTW, would you be prepared to setup and instance that emscripten/emsdk developers could have SSH access too?
sbc100 commentedon Mar 16, 2022
(BTW I think we no longer need the Java install at all: https://chromium-review.googlesource.com/c/emscripten-releases/+/3529671)
mifisignal commentedon Mar 16, 2022
👍🏻
I think we can get you remote access somehow. Not sure whether that'll be via SSH or SSM Session Manager, but some way.
68 remaining items
sbc100 commentedon Mar 28, 2024
BTW I think it should be possible to test there binaries using docker + qemu on your linux x84_64 machine. (See WebAssembly/wabt#2380 for an example how to do this).
dschuff commentedon Mar 28, 2024
Oops, I think I uploaded the wrong archive. I think I fixed, you can try again.
bvibber commentedon Mar 28, 2024
Good news is the binaries run, bad news is emscripten seems to want a much newer version of clang:
dschuff commentedon Mar 28, 2024
Sorry, another misconfiguration on my local machine... Should be good now.
bvibber commentedon Mar 29, 2024
[updated: worked around this, it was bad matching version of emscripten]
We're getting warmer! :D Now llvm/clang and binaryen are too new ;)
bvibber commentedon Mar 29, 2024
[update: yep, that was my fault lol]
Hmm, that may be an artifact of the previous emsdk linux/arm version being installed [for the emscripten components]. But I don't know how to get another version except by installing from source or going over to an x86 machine.
bvibber commentedon Mar 29, 2024
WE HAVE LIFTOFF :D
Ok I manually copied over the latest release emscripten from an x86_64 VM, plus the latest version of the aarch64 wasm tools build, and it works :D
sbc100 commentedon Mar 29, 2024
This is awesome news! Great works @dschuff
It would be good to some very minimal testing the of the arm64 binaryen on the x86_64 build host. If that is not possible we can also take are of that on the emsdk and emscripten builders which have access that arm64 circleci bots.
dschuff commentedon Mar 29, 2024
If this is something it would be easy to do in a github action on the emsdk side, that's probably going to be easier in the short run that setting it up in Chromium. I'm not sure Chromium's infrastructure has a convenient emulator install.
mifisignal commentedon Mar 29, 2024
sbc100 commentedon Mar 29, 2024
We already have linux arm64 testing as part of emsdk (via circleci):
emsdk/.circleci/config.yml
Lines 91 to 98 in e10826f
plasticalligator commentedon Apr 12, 2024
sbc100 commentedon Apr 12, 2024
This is now fixed and we build linux/arm64 binaries continuously on the main waterfall now: https://ci.chromium.org/p/emscripten-releases/g/main/console
Add a warning when trying to install linux-arm64 binaries (emscripten…