Error when compiling Anki in fedora (arm64) docker image on arm64 host (drone ci)

I am getting the following error :

1745	2021/05/26 17:18:07 Downloading https://releases.bazel.build/4.0.0/release/bazel-4.0.0-linux-arm64...
166s
1746	Extracting Bazel installation...
168s
1747	Starting local Bazel server and connecting to it...
177s
1748	Loading:  (1 packages loaded)
185s
1749	Loading: 1 packages loaded
185s
1750	Analyzing: target //:dist (2 packages loaded, 0 targets configured)
185s
1751	Analyzing: target //:dist (39 packages loaded, 79 targets configured)
186s
1752	Analyzing: target //:dist (73 packages loaded, 602 targets configured)
187s
1753	Analyzing: target //:dist (85 packages loaded, 1007 targets configured)
189s
1754	Analyzing: target //:dist (93 packages loaded, 1330 targets configured)
190s
1755	Analyzing: target //:dist (94 packages loaded, 1435 targets configured)
192s
1756	Analyzing: target //:dist (94 packages loaded, 1435 targets configured)
194s
1757	Analyzing: target //:dist (94 packages loaded, 1435 targets configured)
196s
1758	Analyzing: target //:dist (94 packages loaded, 1435 targets configured)
198s
1759	Analyzing: target //:dist (94 packages loaded, 1435 targets configured)
203s
1760	Analyzing: target //:dist (94 packages loaded, 1435 targets configured)
208s
1761	Analyzing: target //:dist (94 packages loaded, 1435 targets configured)
214s
1762	Analyzing: target //:dist (94 packages loaded, 1435 targets configured)
219s
1763	INFO: Repository protoc_bin_linux_arm64 instantiated at:
223s
1764	  /drone/src/anki/WORKSPACE:14:11: in <toplevel>
223s
1765	  /drone/src/anki/defs.bzl:30:26: in setup_deps
223s
1766	  /drone/src/anki/protobuf.bzl:51:10: in setup_protobuf_binary
223s
1767	  /root/.cache/bazel/_bazel_root/427733825c6d4fe4ec1bea5e464b135b/external/bazel_tools/tools/build_defs/repo/utils.bzl:201:18: in maybe
223s
1768	Repository rule http_archive defined at:
223s
1769	  /root/.cache/bazel/_bazel_root/427733825c6d4fe4ec1bea5e464b135b/external/bazel_tools/tools/build_defs/repo/http.bzl:336:31: in <toplevel>
223s
1770	ERROR: While resolving toolchains for target //ts/reviewer:reviewer_extras: no matching toolchains found for types @esbuild_toolchain//:toolchain_type
225s
1771	ERROR: Analysis of target '//:dist' failed; build aborted: no matching toolchains found for types @esbuild_toolchain//:toolchain_type
225s
1772	INFO: Elapsed time: 56.559s
225s
1773	INFO: 0 processes.
225s
1774	FAILED: Build did NOT complete successfully (126 packages loaded, 1485 targets configured)
225s
1775	FAILED: Build did NOT complete successfully (126 packages loaded, 1485 targets configured)
225s

The build takes place in drone ci using fedora 34 docker image.

Github repository : qubist-pixel-ux/anki-arm64-builder (github.com)
Build log : Build #8.1.2 - qubist-pixel-ux/anki-arm64-builder - Drone CI

esbuild_toolchain/esbuild_repo.bzl at toolchain · ankitects/esbuild_toolchain · GitHub will need to be updated with a link to the arm64 binary. To avoid it getting lost when I update esbuild again in the future, if you’d like to submit a PR, please include a small python or shell script that automatically sets the shas from a provided version number.

There may be other arm64 issues that need resolving as well - it’s not tested as part of Anki’s CI.

I opened a pull request. Are the changes sufficient to add arm64 toolchain ?

Add arm64 binary and script to update sha256sum by qubist-pixel-ux · Pull Request #1 · ankitects/esbuild_toolchain (github.com)

Thanks for support.

The pr did not fix it.

Build log : Build #31.1.2 - qubist-pixel-ux/anki-arm64-builder - Drone CI

what does this show?

bazel build --toolchain_resolution_debug=true …

1869 INFO: ToolchainResolution: Type @esbuild_toolchain//:toolchain_type: execution platform @local_config_platform//:host: Rejected toolchain @esbuild_toolchain//:esbuild_linux_arm64; mismatching values: arm64

Build #32.1.2 - qubist-pixel-ux/anki-arm64-builder - Drone CI

Nodej uses aarch64

Created PR : Pull requests · ankitects/esbuild_toolchain (github.com)

Build #33.1.2 - qubist-pixel-ux/anki-arm64-builder - Drone CI

The esbuild url for arm64 binary was incorrect. I created another pr.

Fix esbuild url for arm64 by qubist-pixel-ux · Pull Request #3 · ankitects/esbuild_toolchain (github.com)

New logs :

Thankfully the esbuild toolchain has been resolved :slight_smile:

You could try building with -k, and running the build a couple of times to rule out race conditions. No solution jumps out at me though I’m afraid.

It works with -k but some builds still fail due to different errors related to compiling rust libraries.

qubist-pixel-ux/anki-arm64-builder - Drone CI

See builds 43-55. Many builds succeed though.

Unfortunately the Bazel JS rules are flaky. You might want to invoke bazel build a few times in a loop; it should pick up where it left off.

hmm ok :slight_smile:

I built Anki against qt and pyqt installed by system package. If I install the built python wheels on different system will it require qt and pyqt installed ? How are the standalone tar.gz anki releases on GitHub built ?

The wheels will use whichever PyQt is installed in the Python environment, which is probably what you want if you are building a distro package. The packaged builds are built with pyinstaller, but I have no idea if that works on arm64 or not.

Ok thanks. Right now I’ll leave it at compiling anki for aarch64. Maybe I’ll look into creating flatpak. Thank you very much.