google / j2cl

Java to Closure JavaScript transpiler
Apache License 2.0
1.23k stars 144 forks source link

OpenSUSE Leap 15.2. Building helloworld was unsuccessful #138

Closed pflagerd closed 2 years ago

pflagerd commented 2 years ago

Describe the bug Executing the Getting Started instructions verbatim from the README results in a "Build did NOT complete successfully" message.

To Reproduce master = ab0a3569c08f94b43c5be0cd684a46b5adf9d48c

oy753c@DELL7720:~/Documents/LearnJ2CL/j2cl/samples/helloworld> java --version
openjdk 11.0.12 2021-07-20
OpenJDK Runtime Environment (build 11.0.12+7-suse-lp152.2.18.1-x8664)
OpenJDK 64-Bit Server VM (build 11.0.12+7-suse-lp152.2.18.1-x8664, mixed mode)

Bazel version Please include version of Bazel that you are running J2CL with:

[LearnJ2CL] oy753c@DELL7720:~/Documents/LearnJ2CL/j2cl/samples/helloworld> bazel version
Bazelisk version: v1.10.1
Build label: 3.3.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Wed Jun 17 12:55:32 2020 (1592398532)
Build timestamp: 1592398532
Build timestamp as int: 1592398532

Expected behavior A successful build.

[LearnJ2CL] oy753c@DELL7720:~/Documents/LearnJ2CL/j2cl/samples/helloworld> bazel build --verbose_failures src/main/java/com/google/j2cl/samples/helloworld:helloworld WARNING: Download from https://mirror.bazel.build/repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 404 Not Found WARNING: /home/oy753c/.cache/bazel/_bazel_oy753c/82ac54ca3072cd6d37d8bf404f360186/external/bazel_tools/tools/jdk/BUILD:161:6: in alias rule @bazel_tools//tools/jdk:jar: target '@bazel_tools//tools/jdk:jar' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594) WARNING: Download from https://mirror.bazel.build/repo1.maven.org/maven2/com/google/guava/guava/30.1.1-jre/guava-30.1.1-jre.jar failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 404 Not Found WARNING: /home/oy753c/.cache/bazel/_bazel_oy753c/82ac54ca3072cd6d37d8bf404f360186/external/com_google_jsinterop_annotations-j2cl/java/jsinterop/annotations/BUILD:18:12: in j2cl_java_import rule @com_google_jsinterop_annotations-j2cl//java/jsinterop/annotations:annotations-j2cl: target '@com_google_jsinterop_annotations-j2cl//java/jsinterop/annotations:annotations-j2cl' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594) WARNING: /home/oy753c/.cache/bazel/_bazel_oy753c/82ac54ca3072cd6d37d8bf404f360186/external/com_google_j2cl/third_party/BUILD:186:12: in j2cl_java_import rule @com_google_j2cl//third_party:gwt-javaemul-internal-annotations-j2cl: target '@com_google_j2cl//third_party:gwt-javaemul-internal-annotations-j2cl' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594) WARNING: /home/oy753c/.cache/bazel/_bazel_oy753c/82ac54ca3072cd6d37d8bf404f360186/external/com_google_j2cl/jre/java/BUILD:141:13: in j2cl_library rule @com_google_j2cl//jre/java:jre: target '@com_google_j2cl//jre/java:jre' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594) WARNING: /home/oy753c/Documents/LearnJ2CL/j2cl/samples/helloworld/src/main/java/com/google/j2cl/samples/helloworldlib/BUILD:13:13: in j2cl_library rule //src/main/java/com/google/j2cl/samples/helloworldlib:helloworldlib: target '//src/main/java/com/google/j2cl/samples/helloworldlib:helloworldlib' depends on deprecated target '@local_jdk//:jar': Don't depend on targets in the JDK workspace; use @bazel_tools//tools/jdk:current_java_runtime instead (see https://github.com/bazelbuild/bazel/issues/5594) INFO: Analyzed target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (1 packages loaded, 47 targets configured). INFO: Found 1 target... ERROR: /home/oy753c/.cache/bazel/_bazel_oy753c/82ac54ca3072cd6d37d8bf404f360186/external/bazel_tools/tools/jdk/BUILD:346:14: Action external/bazel_tools/tools/jdk/platformclasspath.jar failed (Exit 1): java failed: error executing command (cd /home/oy753c/.cache/bazel/_bazel_oy753c/82ac54ca3072cd6d37d8bf404f360186/execroot/com_google_j2cl_samples_helloworld && \ 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) at jdk.compiler/com.sun.tools.javac.file.Locations.handleOption(Locations.java:2062) at jdk.compiler/com.sun.tools.javac.file.BaseFileManager.handleOption(BaseFileManager.java:269) at jdk.compiler/com.sun.tools.javac.file.BaseFileManager$2.handleFileManagerOption(BaseFileManager.java:222) at jdk.compiler/com.sun.tools.javac.main.Option.process(Option.java:1138) at jdk.compiler/com.sun.tools.javac.main.Option.handleOption(Option.java:1086) at jdk.compiler/com.sun.tools.javac.file.BaseFileManager.handleOption(BaseFileManager.java:232) at jdk.compiler/com.sun.tools.javac.main.Arguments.doProcessArgs(Arguments.java:390) at jdk.compiler/com.sun.tools.javac.main.Arguments.processArgs(Arguments.java:347) at jdk.compiler/com.sun.tools.javac.main.Arguments.init(Arguments.java:246) at jdk.compiler/com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:185) at DumpPlatformClassPath.dumpJDK9AndNewerBootClassPath(DumpPlatformClassPath.java:106) at DumpPlatformClassPath.main(DumpPlatformClassPath.java:67) Target //src/main/java/com/google/j2cl/samples/helloworld:helloworld failed to build INFO: Elapsed time: 0.573s, Critical Path: 0.41s INFO: 0 processes. FAILED: Build did NOT complete successfully

pflagerd commented 2 years ago

Update.

Created a project "activate/deactivate" script (a .bashrc in the project directory), and explicitly specified a hotspot jdk 1.8:

export bashrc_directory=$(realpath $(dirname "$(readlink -f "$BASH_SOURCE[0]")"))

...

export PATH="${bashrc_directory}/jdk1.8.0_212/jre/bin${PATH:+:}${bashrc_directory}/jdk1.8.0_212/bin${PATH:+:}${PATH:-}"

Build was successful.