Trying to Install anki-git Fails Due to Non Set Java_Home?

I’m trying to install anki-git for flashcards (default Anki is too dated), but can’t seem to do so due to a non set JAVA_HOME.

Error Message:

Building anki-git...
==> Making package: anki-git 2.1.46-2 (Sat 28 Aug 2021 02:30:14 PM EDT)
==> Checking runtime dependencies...
warning: config file /etc/pacman.conf, line 37: directive 'TotalDownload' in section 'options' not recognized.
==> Checking buildtime dependencies...
warning: config file /etc/pacman.conf, line 37: directive 'TotalDownload' in section 'options' not recognized.
==> Retrieving sources...
  -> Cloning anki-git git repo...
Cloning into bare repository '/var/tmp/pamac-build-sarah/anki-git/anki-git'...
==> Validating source files with sha512sums...
    anki-git ... Skipped
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Creating working copy of anki-git git repo...
Cloning into 'anki-git'...
done.
==> Starting prepare()...
==> Starting pkgver()...
==> Updated version: anki-git r8306.3077a1f98-1
==> Starting build()...
Extracting Bazel installation...
FATAL: Could not find system javabase. Ensure JAVA_HOME is set, or javac is on your PATH.
==> ERROR: A failure occurred in build().
    Aborting...

echo $JAVA_HOME' return nothing as expected, but I'm not sure what to set it to. I have JDK 16 installed and java --version` returns a string as expected.

There is also a valid install:

root@MidnightStarSign:/home/sarah# whereis javac
javac: /usr/bin/javac

This is what the system Java configuration looks like:

sarah@MidnightStarSign:~$ whereis java
java: /usr/bin/java /usr/share/java /usr/lib/jvm/java-16-jdk/bin/java
sarah@MidnightStarSign:~$ ls /usr/bin/java
/usr/bin/java
sarah@MidnightStarSign:~$ ls /usr/share/java  
bsh.jar           libbluray-awt-j2se-1.3.0.jar  opencv4     pmdefaults.jar
jxrlib-0.2.1.jar  libbluray-j2se-1.3.0.jar      opencv.jar  turbojpeg.jar
sarah@MidnightStarSign:~$ ls /usr/lib/jvm/java-16-jdk/bin/java
/usr/lib/jvm/java-16-jdk/bin/java
sarah@MidnightStarSign:~$ whereis javac
javac: /usr/bin/javac

How should I set the java home variable with this install of Java?

Please be advised: I’m not at all qualified to assist you. These are just findings while reading and searching and learning about issues.

There is a user with the same problem as you in the comments of the AUR package. It seems there might be a issue with dependencies that are not resolved.

One thing I find strange while reading the anki & bazel documentation is the languages used, there is no java listed.

Installing the base-devel group might help on manjaro?

1 Like

base-devel already installed :smiley:

Thanks for the post!

1 Like

As the comment on the AUR page mentions, we don’t use JAVA_HOME. See Java - ArchWiki

❯ pacman -Si bazel | grep "Depends On"
Depends On      : java-environment=11  libarchive  zip  unzip

:wink:

2 Likes

Ah, so do I have to install JDK11 for it to work?

Or does this package simply not work on Manjaro?

That will happen automatically while installing the build dependencies. jdk11-openjdk will be pulled in as the java-environment=11 dependency of bazel.

Try building it manually:

sudo pacman -Syu --needed base-devel git
git clone https://aur.archlinux.org/anki-git
cd anki-git
makepkg -srcif

Got his error. Might be URL related :smiley:

sarah@MidnightStarSign:~$ git clone https://aur.archlinux.org/packages/anki-git
Cloning into 'anki-git'...
fatal: https://aur.archlinux.org/packages/anki-git/info/refs not valid: could not determine hash algorithm; is this a git repository?

Oops. Post edited. :point_up:

Same error:

FATAL: Could not find system javabase. Ensure JAVA_HOME is set, or javac is on your PATH.
==> ERROR: A failure occurred in build().
    Aborting...

Apparently you have something misconfigured, but I’m not sure what. Building in a clean chroot should do the trick as it will not use user variables.

Before you begin, you’ll want to be in the directory above your anki-git folder from earlier:

sudo pacman -Syu manjaro-chrootbuild
sudo chrootbuild -p anki-git -c -b stable

The built package will be in /var/cache/manjaro-tools/pkg/stable/x86_64/. Install it with pacman -U; i.e.,

sudo pacman -U /var/cache/manjaro-tools/pkg/stable/x86_64/anki-git-r8315.9a27e44ff-1-any.pkg.tar.zst

There was a lot of text when I ran that command, but there was an error on Bazel (aparrantly trying to build the wheel failed)(yes, I was in the directory above anki-git :smiley: ):

==> Starting prepare()...
==> Starting pkgver()...
==> Updated version: anki-git r8315.9a27e44ff-1
==> Starting build()...
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Analyzed target //:dist (676 packages loaded, 29689 targets configured).
INFO: Found 1 target...
ERROR: /build/anki-git/src/anki-git/qt/aqt/data/web/js/BUILD.bazel:12:11: Compiling TypeScript (devmode) //qt/aqt/data/web/js:aqt failed: Worker process did not return a WorkResponse:

---8<---8<--- Start of log, file at /build/.cache/bazel/_bazel_builduser/116c99ede22396e48537dd52ab68397f/bazel-workers/worker-4-TypeScriptCompile.log ---8<---8<---
Error: Cannot find module '../tsetse/runner'
Require stack:
- /build/.cache/bazel/_bazel_builduser/116c99ede22396e48537dd52ab68397f/execroot/ankidesktop/node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/build/.cache/bazel/_bazel_builduser/116c99ede22396e48537dd52ab68397f/execroot/ankidesktop/node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js:7:18)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
---8<---8<--- End of log ---8<---8<---
Target //:dist failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /build/anki-git/src/anki-git/qt/aqt/BUILD.bazel:91:9 Building wheel failed: Worker process did not return a WorkResponse:

---8<---8<--- Start of log, file at /build/.cache/bazel/_bazel_builduser/116c99ede22396e48537dd52ab68397f/bazel-workers/worker-4-TypeScriptCompile.log ---8<---8<---
Error: Cannot find module '../tsetse/runner'
Require stack:
- /build/.cache/bazel/_bazel_builduser/116c99ede22396e48537dd52ab68397f/execroot/ankidesktop/node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/build/.cache/bazel/_bazel_builduser/116c99ede22396e48537dd52ab68397f/execroot/ankidesktop/node_modules/@bazel/typescript/internal/tsc_wrapped/tsc_wrapped.js:7:18)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
---8<---8<--- End of log ---8<---8<---
INFO: Elapsed time: 49.617s, Critical Path: 2.57s
INFO: 201 processes: 188 internal, 9 processwrapper-sandbox, 4 worker.
FAILED: Build did NOT complete successfully
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Building package [anki-git] failed.
      Cleaning up.

I just tried it with the same result. I’m not familiar with Bazel, so I’m not sure why it failed to build. I guess you’ll have to wait until the AUR package maintainer fixes it.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.