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

How to fix the error: unused native file on Windows 11? #192

Closed
PetrVachal opened this issue Apr 14, 2023 · 1 comment
Closed

How to fix the error: unused native file on Windows 11? #192

PetrVachal opened this issue Apr 14, 2023 · 1 comment

Comments

@PetrVachal
Copy link

Hello IT ladies and IT gentlemen.

I followed the instructions for build webapp helloworld based on J2CL, built by Bazel on page: https://github.com/google/j2cl/blob/master/docs/getting-started.md

So, my input:
bazel build src/main/java/com/google/j2cl/samples/helloworld:helloworld --verbose_failures

An error occured at the end of build J2CL at the transpiling Java to JS: (total of 9 errors)
Error: Unused native file: some_file.js

My configuration: Win11, JDK 11.0.16, Bazel 5.1.0

I tried to build hello_world app in git bash, Windows Powershell and MSYS2 but same error occured in all these terminals

My output:
...
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_def.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_undef.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/map_field.h
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/map_entry.h
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/reflection_ops.h
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_def.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_undef.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_def.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_undef.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_def.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_undef.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/text_format.h
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_def.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_undef.inc
Poznámka: Včetně souboru: external/com_google_protobuf/src\google/protobuf/port_def.inc
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.
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 jarjar @io_bazel_rules_kotlin//src/main/kotlin:builder_jar_jar [for host]:
Fully-qualified classname does not match jar entry:
jar entry: META-INF/versions/9/module-info.class
class name: module-info.class
Omitting META-INF/versions/9/module-info.class.
INFO: From Compiling Kotlin to JVM @com_google_j2cl//transpiler/java/com/google/j2cl/transpiler/backend/kotlin/common:common { kt: 7, java: 0, srcjars: 0 }:
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
INFO: From Compiling Kotlin to JVM @com_google_j2cl//transpiler/java/com/google/j2cl/transpiler/backend/kotlin/source:source { kt: 1, java: 0, srcjars: 0 }:
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
INFO: From Compiling Kotlin to JVM @com_google_j2cl//transpiler/java/com/google/j2cl/transpiler/backend/kotlin/ast:ast { kt: 5, java: 0, srcjars: 0 }:
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
INFO: From Compiling Kotlin to JVM @com_google_j2cl//transpiler/java/com/google/j2cl/transpiler/backend/kotlin/objc:objc { kt: 4, java: 0, srcjars: 0 }:
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
INFO: From Compiling Kotlin to JVM @com_google_j2cl//transpiler/java/com/google/j2cl/transpiler/backend/kotlin:kotlin { kt: 25, java: 0, srcjars: 0 }:
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
external\com_google_j2cl\transpiler\java\com\google\j2cl\transpiler\backend\kotlin\ExpressionRenderer.kt:537:43: warning: parameter 'superReference' is never used
private fun Renderer.superReferenceSource(superReference: SuperReference): Source =
^
warning: '-Xuse-experimental' is deprecated and will be removed in a future release, please use -opt-in instead
warning: language version 1.3 is deprecated and its support will be removed in a future version of Kotlin
external\com_google_j2cl\transpiler\java\com\google\j2cl\transpiler\backend\kotlin\ExpressionRenderer.kt:537:43: warning: parameter 'superReference' is never used
private fun Renderer.superReferenceSource(superReference: SuperReference): Source =
^
ERROR: C:/msys64/home/vachal/_bazel_vachal/juh3klpa/external/com_google_j2cl/jre/java/BUILD:171:13: Transpiling to JavaScript @com_google_j2cl//jre/java:jre failed: (Exit 1): BazelJ2clBuilder.exe failed: error executing command
cd /d C:/msys64/home/vachal/_bazel_vachal/juh3klpa/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: 62a8c95f4093f157ff190a4a8a712c7a0cf98bea47e8aa6822b4f0d8f2a9f247
#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: 180.807s, Critical Path: 54.75s
INFO: 588 processes: 54 internal, 478 local, 56 worker.
FAILED: Build did NOT complete successfully

Please, give me any advice.
What does it mean "Unused native file"? How can I fix this error?

@gkdn
Copy link
Member

gkdn commented Apr 18, 2023

Please see #9 and #121

Per earlier comments, the maven plugin developed by the community works on windows. You can try that.

@gkdn gkdn closed this as completed Apr 18, 2023
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

2 participants