Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I receive the following issue during the build. Have anyone an idea what the reason is: #198

Open
bschenkelberger opened this issue Jul 3, 2023 · 3 comments

Comments

@bschenkelberger
Copy link

bschenkelberger commented Jul 3, 2023

Describe the bug
$ bazel build src/main/java/com/google/j2cl/samples/helloworld:helloworld
Starting local Bazel server and connecting to it...
Loading:
Loading: 0 packages loaded
Loading: 0 packages loaded
currently loading: src/main/java/com/google/j2cl/samples/helloworld
Analyzing: target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (1 packages loaded)
Analyzing: target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (1 packages loaded, 0 targets configured)
Analyzing: target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (9 packages loaded, 20 targets configured)
Analyzing: target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (36 packages loaded, 23 targets configured)
WARNING: C:/users/fujitsu/_bazel_fujitsu/7zwbdliw/external/bazel_tools/tools/jdk/BUILD:125: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 bazelbuild/bazel#5594)
Analyzing: target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (61 packages loaded, 496 targets configured)
Analyzing: target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (77 packages loaded, 1112 targets configured)
Analyzing: target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (114 packages loaded, 1632 targets configured)
Analyzing: target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (146 packages loaded, 2679 targets configured)
WARNING: C:/users/fujitsu/_bazel_fujitsu/7zwbdliw/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 bazelbuild/bazel#5594)
WARNING: C:/users/fujitsu/_bazel_fujitsu/7zwbdliw/external/com_google_j2cl/jre/java/BUILD:53:12: in j2cl_java_import rule @com_google_j2cl//jre/java:javaemul_internal_annotations-j2cl: target '@com_google_j2cl//jre/java: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 bazelbuild/bazel#5594)
WARNING: C:/users/fujitsu/_bazel_fujitsu/7zwbdliw/external/com_google_j2cl/jre/java/BUILD:167: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 bazelbuild/bazel#5594)
WARNING: C:/entwicklung/projekte/zuericher/j2cl/samples/helloworld/src/main/java/com/google/j2cl/samples/helloworldlib/BUILD:14: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 bazelbuild/bazel#5594)
INFO: Analyzed target //src/main/java/com/google/j2cl/samples/helloworld:helloworld (201 packages loaded, 2931 targets configured).

INFO: Found 1 target...
[0 / 21] [Prepa] BazelWorkspaceStatusAction stable-status.txt
[4 / 36] [Prepa] Extracting interface @com_google_code_findbugs_jsr305//:com_google_code_findbugs_jsr305 ... (2 actions, 1 running)
[16 / 105] [Scann] Compiling src/google/protobuf/api.pb.cc
[18 / 105] Compiling src/google/protobuf/api.pb.cc; 2s local ... (4 actions, 3 running)
[20 / 105] Compiling src/google/protobuf/wire_format.cc; 3s local ... (4 actions running)
[24 / 105] Compiling src/google/protobuf/util/internal/protostream_objectsource.cc; 2s local ... (4 actions running)
[27 / 105] Compiling src/google/protobuf/util/internal/protostream_objectwriter.cc; 4s local ... (4 actions running)
[33 / 105] Compiling src/google/protobuf/util/internal/object_writer.cc; 2s local ... (4 actions running)
[39 / 105] Compiling src/google/protobuf/util/internal/datapiece.cc; 2s local ... (4 actions running)
[45 / 105] Compiling src/google/protobuf/text_format.cc; 4s local ... (4 actions running)
[53 / 105] Compiling src/google/protobuf/io/printer.cc; 2s local ... (4 actions running)
[59 / 105] Compiling src/google/protobuf/compiler/parser.cc; 5s local ... (4 actions running)
[67 / 187] Compiling src/google/protobuf/descriptor.cc; 5s local ... (4 actions running)
[73 / 187] Compiling src/google/protobuf/compiler/cpp/cpp_message.cc; 7s local ... (4 actions running)
[77 / 187] Compiling src/google/protobuf/compiler/command_line_interface.cc; 11s local ... (4 actions running)
[89 / 187] Compiling src/google/protobuf/compiler/cpp/cpp_helpers.cc; 5s local ... (4 actions running)
[107 / 187] Compiling src/google/protobuf/compiler/java/java_message_builder.cc; 1s local ... (4 actions running)
[124 / 187] Compiling src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc; 2s local ... (4 actions running)
[140 / 187] Compiling src/google/protobuf/compiler/php/php_generator.cc; 3s local ... (4 actions running)
[167 / 217] Compiling src/google/protobuf/arenastring.cc; 1s local ... (4 actions running)
[227 / 336] Compiling src/google/protobuf/compiler/python/python_generator.cc [for host]; 3s local ... (4 actions running)
[253 / 336] Compiling src/google/protobuf/compiler/java/java_generator.cc [for host]; 3s local ... (4 actions running)
[288 / 336] Compiling src/google/protobuf/compiler/cpp/cpp_message.cc [for host]; 4s local ... (4 actions running)
[342 / 419] Compiling src/google/protobuf/compiler/parser.cc [for host]; 5s local ... (4 actions running)
[399 / 454] Linking external/com_google_protobuf/protoc.exe [for host]; 1s local ... (2 actions running)
[442 / 499] Building external/com_google_protobuf/java/core/libcore.jar (37 source files, 1 source jar); 36s multiplex-worker ... (4 actions running)
INFO: From Executing genrule @io_bazel_rules_kotlin//src/main/kotlin/io/bazel/kotlin/builder:builder_kt_jar [for host]:
external\io_bazel_rules_kotlin\src\main\kotlin\io\bazel\kotlin\builder\tasks\BazelWorker.kt:121:9: warning: unreachable code
throw RuntimeException("drop through")
^
external\io_bazel_rules_kotlin\src\main\kotlin\io\bazel\kotlin\builder\tasks\KotlinBuilder.kt:142:64: warning: 'toUpperCase(): String' is deprecated. Use uppercase() instead.
platform = checkNotNull(Platform.valueOf(it[1].toUpperCase())) {
^
external\io_bazel_rules_kotlin\src\main\kotlin\io\bazel\kotlin\builder\tasks\KotlinBuilder.kt:145:64: warning: 'toUpperCase(): String' is deprecated. Use uppercase() instead.
ruleKind = checkNotNull(RuleKind.valueOf(it[2].toUpperCase())) {
^
external\io_bazel_rules_kotlin\src\main\kotlin\io\bazel\kotlin\builder\utils\BazelUtils.kt:26:59: warning: 'toLowerCase(): String' is deprecated. Use lowercase() instead.
private val isWindows = System.getProperty("os.name").toLowerCase().indexOf("win") >= 0
^
external\io_bazel_rules_kotlin\src\main\kotlin\io\bazel\kotlin\builder\utils\TaskUtils.kt:24:75: warning: 'toLowerCase(): String' is deprecated. Use lowercase() instead.
val CompilationTaskInfo.bazelRuleKind: String get() = "kt_${platform.name.toLowerCase()}${ruleKind.name.toLowerCase()}"
^
external\io_bazel_rules_kotlin\src\main\kotlin\io\bazel\kotlin\builder\utils\TaskUtils.kt:24:106: warning: 'toLowerCase(): String' is deprecated. Use lowercase() instead.
val CompilationTaskInfo.bazelRuleKind: String get() = "kt
${platform.name.toLowerCase()}_${ruleKind.name.toLowerCase()}"
^
INFO: From Building external/com_google_j2cl/transpiler/java/com/google/j2cl/transpiler/ast/libast.jar (112 source files) and running annotation processors (AutoAnnotationProcessor, AutoOneOfProcessor, AutoValueProcessor, J2clAstProcessor):
warning: File for type 'com.google.j2cl.transpiler.ast.AbstractVisitor' created in the last round will not be subject to annotation processing.
warning: File for type 'com.google.j2cl.transpiler.ast.AbstractRewriter' created in the last round will not be subject to annotation processing.
warning: File for type 'com.google.j2cl.transpiler.ast.ProcessorPrivate' created in the last round will not be subject to annotation processing.
[473 / 503] Building external/com_google_j2cl/transpiler/java/com/google/j2cl/transpiler/passes/libpasses.jar (153 source files) and running annotation processors (AutoAnnotationProcessor, AutoOneOfProcessor, AutoValueProcessor, J2clAstProcessor); 10s multiplex-worker
ERROR: C:/users/fujitsu/_bazel_fujitsu/7zwbdliw/external/com_google_j2cl/jre/java/BUILD:167:13: Transpiling to JavaScript @com_google_j2cl//jre/java:jre failed: (Exit 1): BazelJ2clBuilder.exe failed: error executing command bazel-out\x64_windows-opt-exec-2B5CBBC6\bin\external\com_google_j2cl\transpiler\java\com\google\j2cl\transpiler\BazelJ2clBuilder.exe ... (remaining 1 argument skipped)
Error: Unused native file 'java/lang/Class.native.js'.
Error: Unused native file 'java/lang/IntegralToString.native.js'.
Error: Unused native file 'javaemul/internal/Casts.native.js'.
Error: Unused native file 'javaemul/internal/ConsoleLogger.native.js'.
Error: Unused native file 'javaemul/internal/HashCodes.native.js'.
Error: Unused native file 'javaemul/internal/JsUtils.native.js'.
Error: Unused native file 'javaemul/internal/Objects.native.js'.
Error: Unused native file 'javaemul/internal/ThrowableUtils.native.js'.
Error: Unused native file 'javaemul/internal/ValueType.native.js'.
9 error(s), 0 warning(s).
Target //src/main/java/com/google/j2cl/samples/helloworld:helloworld failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 487.683s, Critical Path: 107.17s
INFO: 490 processes: 9 internal, 440 local, 41 worker.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

To Reproduce
I have checked out the master an tried to run bazel build src/main/java/com/google/j2cl/samples/helloworld:helloworld

@nasir-hussain-swat
Copy link

It seems that you are encountering an error while running the Bazel build command for the helloworld target in the com/google/j2cl/samples/helloworld package. The error message suggests that there are unused native files causing the build failure.

Here are a few suggestions to troubleshoot the issue:

Check the build configuration: Ensure that you have the correct dependencies and build settings configured for the J2CL project. Make sure that all required dependencies are correctly specified in the BUILD files and that your Bazel workspace is set up properly.

Verify the J2CL version: Ensure that you are using a compatible version of the J2CL transpiler. Check if there are any specific version requirements or compatibility issues mentioned in the project's documentation or release notes. You might need to update or adjust the J2CL version accordingly.

Clean and rebuild: Try cleaning the Bazel build cache and performing a clean build. Run bazel clean --expunge to remove any cached build artifacts and then try building again using the bazel build command.

Check for unused native files: The error message indicates that there are unused native files causing the build failure. Review the J2CL project's configuration and make sure that the native files are correctly included or excluded as needed. You might need to update the build configuration to address this issue.

Enable verbose output: If the issue persists, you can use the --verbose_failures flag with the bazel build command to get more detailed information about the failed build steps. This can help you identify the specific cause of the failure.

If none of these suggestions resolve the issue, I recommend consulting the J2CL project's documentation, issue tracker, or community forums for further assistance. They may have specific recommendations or workarounds for the problem you are facing.

@bschenkelberger
Copy link
Author

bschenkelberger commented Jul 3, 2023

Thank you for your quick reply. But to be honest. I expect that the master contains all the appropriate dependencies. Because that is the getting started part.

I did the baszel clean and also added --verbose_failures, but the result is the same.

ERROR: C:/users/fujitsu/_bazel_fujitsu/7zwbdliw/external/com_google_j2cl/jre/java/BUILD:167:13: Transpiling to JavaScript @com_google_j2cl//jre/java:jre failed: (Exit 1): BazelJ2clBuilder.exe failed: error executing command
cd /d C:/users/fujitsu/_bazel_fujitsu/7zwbdliw/execroot/com_google_j2cl_samples_helloworld
SET LANG=en_US.UTF-8
bazel-out\x64_windows-opt-exec-2B5CBBC6\bin\external\com_google_j2cl\transpiler\java\com\google\j2cl\transpiler\BazelJ2clBuilder.exe @bazel-out/x64_windows-fastbuild/bin/external/com_google_j2cl/jre/java/jre.js-0.params

  • Configuration: 2877ba0b561476092d5c4022bf856304f1e5dc1625249de071df1a06df98703b
  • Execution platform: @local_config_platform//:host
    Error: Unused native file 'java/lang/Class.native.js'.
    Error: Unused native file 'java/lang/IntegralToString.native.js'.
    Error: Unused native file 'javaemul/internal/Casts.native.js'.
    Error: Unused native file 'javaemul/internal/ConsoleLogger.native.js'.
    Error: Unused native file 'javaemul/internal/HashCodes.native.js'.
    Error: Unused native file 'javaemul/internal/JsUtils.native.js'.
    Error: Unused native file 'javaemul/internal/Objects.native.js'.
    Error: Unused native file 'javaemul/internal/ThrowableUtils.native.js'.
    Error: Unused native file 'javaemul/internal/ValueType.native.js'.
    9 error(s), 0 warning(s).
    Target //src/main/java/com/google/j2cl/samples/helloworld:helloworld failed to build
    INFO: Elapsed time: 492.668s, Critical Path: 123.29s
    INFO: 551 processes: 42 internal, 455 local, 54 worker.
    FAILED: Build did NOT complete successfully

@tbroyer
Copy link
Contributor

tbroyer commented Jul 3, 2023

Works for me on Linux. Could it be because you're using Windows, and outside WSL? (see https://github.com/google/j2cl#caveat-emptor)

(note: I do have the same warnings about @local_jdk//:jar and the Kotlin toUpperCaseuppercase et al., but not the libast ones about annotation processing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants