I’m trying to compile anki from source, but I keep getting the following error message:
ERROR: /home/b3nj4m1n/Documents/Github/anki/pylib/anki/BUILD.bazel:111:9: Action pylib/anki/backend_pb2.py failed: (Exit 1): protoc_wrapper failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/pylib/tools/protoc_wrapper external/protoc_bin_linux_x86_64/bin/protoc bazel-out/k8-opt-exec-2B5CBBC6/bin/pylib/tools/protoc-gen-mypy ... (remaining 20 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox
Traceback (most recent call last):
File "/home/b3nj4m1n/.cache/bazel/_bazel_b3nj4m1n/ee6625df9ac32592700069683600f2ec/sandbox/linux-sandbox/288/execroot/ankidesktop/bazel-out/k8-opt-exec-2B5CBBC6/bin/pylib/tools/protoc_wrapper.runfiles/ankidesktop/pylib/tools/protoc_wrapper.py", line 23, in <module>
subprocess.run(
File "/home/b3nj4m1n/.cache/bazel/_bazel_b3nj4m1n/ee6625df9ac32592700069683600f2ec/external/python/lib/python3.9/subprocess.py", line 528, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['external/protoc_bin_linux_x86_64/bin/protoc', '--plugin=protoc-gen-mypy=bazel-out/k8-opt-exec-2B5CBBC6/bin/pylib/tools/protoc-gen-mypy', '--python_out=bazel-out/k8-fastbuild/bin/pylib', '--mypy_out=bazel-out/k8-fastbuild/bin/pylib', '-Iproto/', '-Iexternal/ankidesktop/proto/', 'proto/anki/backend.proto', 'proto/anki/card_rendering.proto', 'proto/anki/cards.proto', 'proto/anki/collection.proto', 'proto/anki/config.proto', 'proto/anki/deckconfig.proto', 'proto/anki/decks.proto', 'proto/anki/generic.proto', 'proto/anki/i18n.proto', 'proto/anki/import_export.proto', 'proto/anki/links.proto', 'proto/anki/media.proto', 'proto/anki/notes.proto', 'proto/anki/notetypes.proto', 'proto/anki/scheduler.proto', 'proto/anki/search.proto', 'proto/anki/stats.proto', 'proto/anki/sync.proto', 'proto/anki/tags.proto']' returned non-zero exit status 1.
Target //qt:runanki failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /home/b3nj4m1n/Documents/Github/anki/qt/BUILD.bazel:123:10 Middleman _middlemen/qt_Srunanki-runfiles failed: (Exit 1): protoc_wrapper failed: error executing command bazel-out/k8-opt-exec-2B5CBBC6/bin/pylib/tools/protoc_wrapper external/protoc_bin_linux_x86_64/bin/protoc bazel-out/k8-opt-exec-2B5CBBC6/bin/pylib/tools/protoc-gen-mypy ... (remaining 20 arguments skipped)
Unfortunately, I don’t know anything about bazel, so I’m not sure how to debug this.
I’ve tried deleting bazels cache, and I’ve gone over all the dependencies several times.
I also created a docker file to set up a fresh arch environment, install all dependencies and built anki, that is working fine, so I suspect this is due to something like a preexisting package or something like that.
Here’s the dockerfile:
FROM archlinux:base-devel-20220821.0.76637
RUN sudo pacman -S --needed --noconfirm base-devel git wget unzip
RUN useradd -m anki
RUN echo "anki ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER anki
ENTRYPOINT ["sleep"]
CMD ["1000"]
RUN cd / && sudo mkdir -p "/anki" && sudo chown "anki" -R "/anki" && git clone "https://github.com/ankitects/anki"
RUN cd /anki && git checkout 2.1.54
RUN sudo pacman -S --needed --noconfirm \
autoconf \
curl \
findutils \
gcc \
git \
grep \
make \
rsync \
zstd \
pkgconf \
portaudio \
python
RUN sudo curl -L https://github.com/bazelbuild/bazelisk/releases/download/v1.7.4/bazelisk-linux-amd64 \
-o /usr/local/bin/bazel \
&& sudo chmod +x /usr/local/bin/bazel
RUN sudo pacman -S --needed --noconfirm libglvnd
RUN sudo pacman -S --needed --noconfirm fontconfig
RUN sudo pacman -S --needed --noconfirm gstreamer gst-plugins-good gst-plugins-base-libs gst-plugins-base
RUN sudo pacman -S --needed --noconfirm nss
RUN sudo pacman -S --needed --noconfirm libpulse
RUN sudo pacman -S --needed --noconfirm openssl
RUN sudo pacman -S --needed --noconfirm libxcomposite
RUN sudo pacman -S --needed --noconfirm libxcursor
RUN sudo pacman -S --needed --noconfirm libxi
RUN sudo pacman -S --needed --noconfirm libxkbcommon-x11 libxkbcommon libxkbfile
RUN sudo pacman -S --needed --noconfirm libxrandr
RUN sudo pacman -S --needed --noconfirm libxrender
RUN sudo pacman -S --needed --noconfirm libxtst
RUN sudo pacman -S --needed --noconfirm dbus
RUN cd /anki && ./run
I’ve done every command from this dockerfile in order on my main machine, but I still get the same error.