first of all, thanks for creating Anki. I’ve been using it for ~6 years now, and it’s so brilliant, I can’t imagine how I would live without it!
Background:
So far I’ve used AnkiDroid on my phone, but recently I bought a Pinephone and I would like to run Anki on it. I’ve already created a package for 2.1.15 (without rust, using Makefiles) and it works really well on my phone and it’s already in the alpine repos. But since there have been >20 new versions since then, I think I’ll eventually have to support the newest build system. I haven’t worked with bazel until now, and I’m stunned by its complexity.
I’m using the latest version from git, because according to [1] you’ve already improved the support for new platforms.
Problem description:
I’m currently stuck at the very beginning. I run scripts/build but it tries to download node (npm?) from the internet. I have node and npm installed from the alpine repos, but I can’t figure out for the live of me how to convince bazel to use the local version from /usr/bin. I’ve looked at ./docs/new-platform.md and [2] but it seems that that is referring to a version that is installed in a subdirectory of bazel’s workspace, but not system-wide. Do you have any idea how this could be achieved?
The following happens, when I run bazel build -s //qt:runanki:
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
WARNING: Download from https://mirror.bazel.build/nodejs.org/dist/v12.13.0/node-v12.13.0-linux-arm64.tar.xz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 404 Not Found
INFO: Repository npm instantiated at:
/home/mo/devel/anki/anki-git/WORKSPACE:14:11: in <toplevel>
/home/mo/devel/anki/anki-git/defs.bzl:46:17: in setup_deps
/home/mo/.cache/bazel/_bazel_mo/fc6a139e9313e614fa176974ac4b2179/external/build_bazel_rules_nodejs/index.bzl:74:18: in yarn_install
Repository rule yarn_install defined at:
/home/mo/.cache/bazel/_bazel_mo/fc6a139e9313e614fa176974ac4b2179/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl:463:31: in <toplevel>
ERROR: An error occurred during the fetch of repository 'npm':
Traceback (most recent call last):
File "/home/mo/.cache/bazel/_bazel_mo/fc6a139e9313e614fa176974ac4b2179/external/build_bazel_rules_nodejs/internal/npm_install/npm_install.bzl", line 440, column 13, in _yarn_install_impl
fail("pre_process_package_json.js failed: \nSTDOUT:\n%s\nSTDERR:\n%s" % (result.stdout, result.stderr))
Error in fail: pre_process_package_json.js failed:
STDOUT:
STDERR:
ERROR: no such package '@npm//@bazel/labs': pre_process_package_json.js failed:
STDOUT:
STDERR:
INFO: Elapsed time: 53.514s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Thanks for updating the docs! It now works with my locally installed node.
But, you are right about musl and rust. And I’m afraid I’m not the one to solve that. So, I will give up for now on alpine. The way forward for me is probably to switch to a glibc based distro for my phone (Manjaro/Arch) and try building on that one.
Again: Thanks for your support and of course for the invaluable Anki itself!