ARM64 Compilation Error

I finally got this to work on Debian. Here’s some Debian-specific tips:

  • My approach was build from source using ./run, I was not trying to build a binary bundle.
  • I followed these instructions: anki/docs/linux.md at 8f77e5198b2e0a3019fa143e621a80ae62961f20 · ankitects/anki · GitHub
  • It was critical to export those environment variables.
  • Do not use conda. This was hell. I recommend deactivating your environment or removing it entirely before attempting this.
  • Make sure you know that the venv and python binary that the build process is using is in out/pyenv/bin, it is not the system python. However, because of the exports above, it can see the system python packages. Use these binaries to check that the imports work before re-attempting the build.
  • I ran into a bunch of PtQt6 import errors. Probably you want to install things with pip unless they start trying to build qt6 stuff from source with qmake. Don’t actually let pip do this, it’s also hell. If you see it trying, search for the appropriate package name in the Debian sources and install that with apt instead. E.g. python3-pyqt6.qtwebengine.
mal@debian:~/pkgs/anki/out/pyenv/bin$ ./pip install PyQt6-WebEngine
Collecting PyQt6-WebEngine
  Downloading PyQt6_WebEngine-6.6.0.tar.gz (31 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      pyproject.toml: line 7: using '[tool.sip.metadata]' to specify the project metadata is deprecated and will be removed in SIP v7.0.0, use '[project]' instead
      Traceback (most recent call last):
        File "/usr/lib/python3/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/lib/python3/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/usr/lib/python3/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/tmp/pip-build-env-tmyncimq/overlay/lib/python3.9/site-packages/sipbuild/api.py", line 46, in build_wheel
          project = AbstractProject.bootstrap('wheel',
        File "/tmp/pip-build-env-tmyncimq/overlay/lib/python3.9/site-packages/sipbuild/abstract_project.py", line 87, in bootstrap
          project.setup(pyproject, tool, tool_description)
        File "/tmp/pip-build-env-tmyncimq/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 587, in setup
          self.apply_user_defaults(tool)
        File "/tmp/pip-build-env-tmyncimq/overlay/lib/python3.9/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
          super().apply_user_defaults(tool)
        File "/tmp/pip-build-env-tmyncimq/overlay/lib/python3.9/site-packages/sipbuild/project.py", line 237, in apply_user_defaults
          self.builder.apply_user_defaults(tool)
        File "/tmp/pip-build-env-tmyncimq/overlay/lib/python3.9/site-packages/pyqtbuild/builder.py", line 69, in apply_user_defaults
          raise PyProjectOptionException('qmake',
      sipbuild.pyproject.PyProjectOptionException
      [end of output]

The above error is pip complaining, "I can’t see qmake on the PATH. As mentioned above, you could install qmake6 and then symlink it, but don’t. Trying to build things from source via pip is very annoying and the Debian packagers have already done all that work for you.

sudo apt-get install python3-pyqt6.qtwebengine python3-pyqt6.qtwebchannel python3-pyqt6.qtquick pyqt6-dev-tools

Pretty sure I installed PyQt6-sip (PyQt6-sip · PyPI) via the pip binary in the venv.