Open aquynh opened 3 years ago
The development environment on which the Google support team works on closure-compiler is using JDK 11.
$ java --version
openjdk 11.0.10 2021-02-27
OpenJDK Runtime Environment (build 11.0.10+9-google-release-359977778)
OpenJDK 64-Bit Server VM (build 11.0.10+9-google-release-359977778, mixed mode, sharing)
Hmmm.... it looks like it's actually bazelisk or bazel that failed. Maybe bazel has a problem with Java 14? It might be better to file a bug with the bazel project.
i tried to build with yarn, but also get error like below.
$ yarn build
yarn run v1.22.10
$ clean && mvn -DskipTests
/bin/sh: 1: clean: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
perhaps you do not have javac
on your $PATH? i.e. you need to install a JDK that has the java compiler binary javac
.
I got a very similar looking error message, with openjdk 11 installed on my Fedora 34 system:
INFO: Analyzed target //:compiler_unshaded_deploy.jar (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/neek/.cache/bazel/_bazel_neek/ca9166dfb359be451c95c9d1c6288e98/external/bazel_tools/tools/jdk/BUILD:314:1: Action external/bazel_tools/tools/jdk/platformclasspath.jar failed (Exit 1): java failed: error executing command
(cd /home/neek/.cache/bazel/_bazel_neek/ca9166dfb359be451c95c9d1c6288e98/execroot/com_google_javascript_jscomp && \
exec env - \
external/remotejdk11_linux/bin/java -XX:+IgnoreUnrecognizedVMOptions '--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED' -cp bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath_classes:external/remotejdk11_linux/lib/tools.jar DumpPlatformClassPath bazel-out/k8-fastbuild/bin/external/bazel_tools/tools/jdk/platformclasspath.jar external/local_jdk)
Execution platform: @local_config_platform//:host
Exception in thread "main" java.lang.IllegalArgumentException: external/local_jdk
at jdk.compiler/com.sun.tools.javac.file.Locations$SystemModulesLocationHandler.update(Locations.java:1853)
at jdk.compiler/com.sun.tools.javac.file.Locations$SystemModulesLocationHandler.handleOption(Locations.java:1798)
I thought perhaps it was my java version number at fault, from this output I thought I had a full JDK installed:
$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment 18.9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9, mixed mode, sharing)
Just to try something, I downloaded JDK 16 following these insturctions https://www.techtransit.org/install-and-upgrade-java-version-on-centos-redhat-and-fedora-linux/ (untar the JDK and use alternatives
to point /usr/bin links to them, and I found that javac
had not been set to anything previously, and sure enough my Fedora package java-11-openjdk-headless doesn't have a javac
binary in it.
After installing a "proper" JDK and setting up javac
on my $PATH, the bazel build completes OK.
Bazel appears to have poor error reporting going back a few years, see https://github.com/google/j2cl/issues/34
I am trying to build the latest code from github on Ubuntu 20.04, and get the following error.
Here is my java version:
Any ideas on how to fix this issue?