Next try: Packaging Anki Desktop for aarch64 Alpine Linux (Postmarket OS)

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:

  1. Build the rust part manually (i.e. without bazel).
  2. 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/", line 129, in __init__
  File "/usr/lib/python3.10/site-packages/aqt/", line 164, in setupUI
  File "/usr/lib/python3.10/site-packages/aqt/", line 829, in setupMainWindow
  File "/usr/lib/python3.10/site-packages/aqt/forms/", line 134, in setupUi
  File "/usr/lib/python3.10/site-packages/aqt/forms/", 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/", line 437, in run
  File "/usr/lib/python3.10/site-packages/aqt/", line 616, in _run
    mw = aqt.main.AnkiQt(app, pm, backend, opts, args)
  File "/usr/lib/python3.10/site-packages/aqt/", 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?

For reference:
Here are the latest (at the time of this writing) logs: logs · Artifacts · build-aarch64 (#584060) · Jobs · Frank Oltmanns / aports · GitLab

pylib/_backend/ imports a file created by

Thanks, from the logs I can see that 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 - \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
    PYTHON_SITE_PACKAGES=/usr/lib/python3.10/site-packages \
  /bin/bash -c 'source external/bazel_tools/tools/genrule/; bazel-out/host/bin/pylib/anki/_backend/genfluent bazel-out/host/bin/rslib/i18n/strings.json bazel-out/aarch64-opt/bin/pylib/anki/_backend/')

However, there is no qt_accel_help or 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
109: std::env::var(“EXTRA_FTL_ROOT”)

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.

Thanks! It works now.

1 Like

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. :slight_smile:

I’ll add a link here when the merge request has been accepted.

1 Like