After I gave up last year, I have restarted efforts to build Anki Desktop for Alpine Linux (Postmarket OS). You can see my current efforts in this merge request.
After some to and fro, I decided that I’d go the same route as was taken in the FreeBSD ports:
- Build the rust part manually (i.e. without bazel).
- Use bazel for the rest.
I now have successfully built a package, but it seems to be missing the translations. When I start anki I get the following stack trace:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/aqt/main.py", line 129, in __init__
File "/usr/lib/python3.10/site-packages/aqt/main.py", line 164, in setupUI
File "/usr/lib/python3.10/site-packages/aqt/main.py", line 829, in setupMainWindow
File "/usr/lib/python3.10/site-packages/aqt/forms/main.py", line 134, in setupUi
File "/usr/lib/python3.10/site-packages/aqt/forms/main.py", line 139, in retranslateUi
AttributeError: 'Translations' object has no attribute 'qt_accel_help'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/aqt/__init__.py", line 437, in run
File "/usr/lib/python3.10/site-packages/aqt/__init__.py", line 616, in _run
mw = aqt.main.AnkiQt(app, pm, backend, opts, args)
File "/usr/lib/python3.10/site-packages/aqt/main.py", line 133, in __init__
Maybe I inadvertently patched the build step away that downloads the translations, but I don’t know where to start looking. Which folders/files should exist if the translation step was successful? Which build file is responsible for the translations?
Here are the latest (at the time of this writing) logs: logs · Artifacts · build-aarch64 (#584060) · Jobs · Frank Oltmanns / aports · GitLab
pylib/_backend/__init__.py imports a file created by
Thanks, from the logs I can see that genfluent.py is being run from bazel:
SUBCOMMAND: # //pylib/anki/_backend:fluent_gen [action 'Executing genrule //pylib/anki/_backend:fluent_gen', configuration: 78c8422d51e79bf471adddfaa0935cab02ea4b413972ddf1cd770c601dc7e331, execution platform: @local_config_platform//:host]
(cd /home/buildozer/.cache/bazel/_bazel_buildozer/b3ac9790c15d3abd0d87bb3b48528140/execroot/ankidesktop && \
exec env - \
/bin/bash -c 'source external/bazel_tools/tools/genrule/genrule-setup.sh; bazel-out/host/bin/pylib/anki/_backend/genfluent bazel-out/host/bin/rslib/i18n/strings.json bazel-out/aarch64-opt/bin/pylib/anki/_backend/fluent.py')
However, there is no
qt-accel-help in the
strings.json (and therefore also not in the resulting
My strings.json is 7659 lines. I guess, you have found the culprit. I need to dig into how the strings.json is being generated. As far as I understand that happens in the rust part, which I could not get to compile through bazel on Alpine. So I (like the people at FreeBSD) had to run the manually. I probably messed sth. up there.
I only start cargo with the
pylib/rsbridge/Cargo.toml. I assume I need to run the other
tomls as well.
19: “EXTRA_FTL_ROOT”: “$(location @extra_ftl//:l10n.toml)”,
16: “EXTRA_FTL_ROOT”: “$(location @extra_ftl//:l10n.toml)”,
9://! - EXTRA_FTL_ROOT should normally be set to the l10n.toml file inside the qt translation
Okay, I get it now. During the build you are pulling a specific commit from the anki-core-i18n and anki-desktop-ftl repos on github. I’ll try to do that manually as well.
Great! If there’s some canonical location for your patches/docs, please let me know and I’ll add a link to them in Anki’s dev docs.
I think the only complete description I have are the build-files themselves. There is quite some patching involved. Which I don’t think are worth describing, because they are alpine and/or musl specific.So I guess anyone interested in building Anki for another musl-distro should look at alpine’s build file.
Note, that the merge request is not excepted yet. But I made my reviews today on my pinephone. So, I can confirm it works.
I’ll add a link here when the merge request has been accepted.