# Issue building 2.1.50beta3

**URL:** <https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630>\
**Category:** Beta Testing\
**Created:** [February 13, 2022, 2:16pm UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630 "2022-02-13T14:16:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![nwwt](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@nwwt](https://forums.ankiweb.net/u/nwwt)\
**Post date:** [February 12, 2022, 6:26pm UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/1 "2022-02-12T18:26:20Z")

</div>

Dunno if this should go into a dev thread, but with the recent changes to how bazel now called via `./tools/bazel`, the build instantly breaks for me:

```auto
INFO: Repository python instantiated at:
  /tmp/anki-git/WORKSPACE:14:11: in <toplevel>
  /tmp/anki-git/defs.bzl:27:23: in setup_deps
Repository rule setup_local_python defined at:
  /tmp/anki-git/python/python.bzl:100:37: in <toplevel>
ERROR: An error occurred during the fetch of repository 'python':
   Traceback (most recent call last):
	File "/tmp/anki-git/python/python.bzl", line 60, column 33, in _impl
		platform = _get_platform(rctx)
	File "/tmp/anki-git/python/python.bzl", line 42, column 26, in _get_platform
		arch = _unix_arch(rctx)
	File "/tmp/anki-git/python/python.bzl", line 29, column 13, in _unix_arch
		fail("invoking arch failed", result.stderr)
Error in fail: invoking arch failed src/main/tools/process-wrapper-legacy.cc:80: "execvp(uname, ...)": No such file or directory
ERROR: /tmp/anki-git/WORKSPACE:14:11: fetching setup_local_python rule //external:python: Traceback (most recent call last):
	File "/tmp/anki-git/python/python.bzl", line 60, column 33, in _impl
		platform = _get_platform(rctx)
	File "/tmp/anki-git/python/python.bzl", line 42, column 26, in _get_platform
		arch = _unix_arch(rctx)
	File "/tmp/anki-git/python/python.bzl", line 29, column 13, in _unix_arch
		fail("invoking arch failed", result.stderr)
Error in fail: invoking arch failed src/main/tools/process-wrapper-legacy.cc:80: "execvp(uname, ...)": No such file or directory
ERROR: error loading package '': at /tmp/anki-git/late_deps.bzl:3:6: Encountered error while reading extension file 'requirements.bzl': no such package '@py_deps//': no such package '@python//': invoking arch failed src/main/tools/process-wrapper-legacy.cc:80: "execvp(uname, ...)": No such file or directory

```

This with bazel 5.0.0 on Linux x64, with `~/.config/bazel*` and traces of the previous builds in Anki’s git folder deleted (IOW, `git status` is clean).

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [February 13, 2022, 12:37am UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/2 "2022-02-13T00:37:50Z")

</div>

Please add an ‘echo $PATH’ line before and after the ‘export PATH’ line in tools/bazel - it seems like the folder that contains uname is accidentally being stripped from the path.

---

<div class="post-metadata">

**Author:** ![nwwt](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@nwwt](https://forums.ankiweb.net/u/nwwt)\
**Post date:** [February 13, 2022, 2:16pm UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/3 "2022-02-13T14:16:25Z")

</div>

before yields

`/usr/lib/ccache/bin:/usr/lib/colorgcc/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/emulator:/opt/android-sdk/cmdline-tools/latest/bin:/opt/android-sdk/platform-tools:/opt/dotnet/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl`

after yields

`/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl`

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [February 14, 2022, 3:10am UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/4 "2022-02-14T03:10:08Z")

</div>

Does replacing the export PATH line with these two lines fix it?

```auto
toolsPath=$(dirname $0)
export PATH=$(echo "$PATH" | sed "s@${toolsPath}:@@")

```

---

<div class="post-metadata">

**Author:** ![nwwt](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@nwwt](https://forums.ankiweb.net/u/nwwt)\
**Post date:** [February 14, 2022, 10:59pm UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/5 "2022-02-14T22:59:53Z")

</div>

Yields a different error, unfortunately:

```auto
  /tmp/anki-git/WORKSPACE:14:11: in <toplevel>
  /tmp/anki-git/defs.bzl:35:14: in setup_deps
  /home/me/.cache/bazel/_bazel_me/2db475aa49d0f71ae9f0fe14cd4f9406/external/rules_python/python/pip.bzl:184:19: in pip_parse
Repository rule pip_repository defined at:
  /home/me/.cache/bazel/_bazel_me/2db475aa49d0f71ae9f0fe14cd4f9406/external/rules_python/python/pip_install/pip_repository.bzl:276:33: in <toplevel>
ERROR: An error occurred during the fetch of repository 'py_deps':
   Traceback (most recent call last):
	File "/home/me/.cache/bazel/_bazel_me/2db475aa49d0f71ae9f0fe14cd4f9406/external/rules_python/python/pip_install/pip_repository.bzl", line 171, column 13, in _pip_repository_impl
		fail("rules_python failed: %s (%s)" % (result.stdout, result.stderr))
Error in fail: rules_python failed: (/home/me/.cache/bazel/_bazel_me/2db475aa49d0f71ae9f0fe14cd4f9406/external/python/python: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
)
ERROR: /tmp/anki-git/WORKSPACE:14:11: fetching pip_repository rule //external:py_deps: Traceback (most recent call last):
	File "/home/me/.cache/bazel/_bazel_me/2db475aa49d0f71ae9f0fe14cd4f9406/external/rules_python/python/pip_install/pip_repository.bzl", line 171, column 13, in _pip_repository_impl
		fail("rules_python failed: %s (%s)" % (result.stdout, result.stderr))
Error in fail: rules_python failed: (/home/me/.cache/bazel/_bazel_me/2db475aa49d0f71ae9f0fe14cd4f9406/external/python/python: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
)
ERROR: no such package '@py_deps//': rules_python failed: (/home/me/.cache/bazel/_bazel_me/2db475aa49d0f71ae9f0fe14cd4f9406/external/python/python: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory
)

```

Same as when I now try to run `bazel build` directly.

… though in fact, if I try to run `./tools/bazel` directly / outside Arch makepkg’s chroot, it does / outputs nothing at all

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [February 16, 2022, 3:40am UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/6 "2022-02-16T03:40:24Z")

</div>

What distro are you using? If you’re on Fedora, maybe you need to install libxcrypt-compat.

---

<div class="post-metadata">

**Author:** ![nwwt](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@nwwt](https://forums.ankiweb.net/u/nwwt)\
**Post date:** [February 16, 2022, 6:12am UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/7 "2022-02-16T06:12:50Z")

</div>

It’s Arch. Is python bundled now or did something chance in the way it’s invoked? Building Anki from git never had this issue.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [February 17, 2022, 9:33am UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/8 "2022-02-17T09:33:15Z")

</div>

It was changed in Oct, and it allows the build to work even if the user’s distro uses an older or newer Python version. Python links to libcrypt by default. Libcrypt was traditionally distributed with glibc, but they decided to split it off, and this has broken a bunch of stuff that assume it will be available. Presumably arch has some compat package you can install for now, and I will see if I can exclude it from the binary when I have a chance.

---

<div class="post-metadata">

**Author:** ![nwwt](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@nwwt](https://forums.ankiweb.net/u/nwwt)\
**Post date:** [February 17, 2022, 10:49am UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/9 "2022-02-17T10:49:44Z")

</div>

Thank you for that hint: Arch recently updated its glibc after months of maintainer troubles. Looking through the changes, [libcrypt.so.1 was removed](https://github.com/archlinux/svntogit-packages/commit/f1aeeaf4a3fabd9b5f8186005066e04f1aa7c672). So the python error is indeed not directly related.

---

<div class="post-metadata">

**Author:** ![nwwt](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@nwwt](https://forums.ankiweb.net/u/nwwt)\
**Post date:** [February 17, 2022, 10:48pm UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/10 "2022-02-17T22:48:30Z")

</div>

Ah, the maintainer of anki-git AUR buildscript [added a workaround of their own](https://aur.archlinux.org/cgit/aur.git/commit/?h=anki-git&id=481c510c88b5c6b697c11fa22bd9a091bdc06463):

`echo "build --action_env=PYO3_PYTHON=/usr/bin/python3" > "$srcdir/$pkgname/user.bazelrc"`

(Also, there was a typo in my previous comment.)

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [February 18, 2022, 8:43am UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/11 "2022-02-18T08:43:39Z")

</div>

Yes, that approach is documented in docs/linux.md. It uses the system Python, which may or may not work depending on the distro.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [May 1, 2023, 2:55am UTC](https://forums.ankiweb.net/t/issue-building-2-1-50beta3/17630/12 "2023-05-01T02:55:05Z")

</div>

Closed on May 1, 2023, 2:55am UTC


