connectedhomeip: [BUG] flag is not supported by this version of the compiler: -Xlint:all
Reproduction steps
Hi, I’m building android chip-tool app on linux, I got this error Hope someone can help me
2023-05-11 16:04:16 INFO [7/17] ACTION //src/controller/java:tlv__kotlinc(//build/toolchain/android:android_arm64)
2023-05-11 16:04:16 INFO FAILED: gen/src/controller/java/tlv.classlist
2023-05-11 16:04:16 INFO python3 ../../build/chip/java/kotlinc_runner.py --classdir obj/src/controller/java/classes --outfile gen/src/controller/java/tlv.classlist --build-config gen/src/controller/java/tlv.json -- -d obj/src/controller/java/classes @gen/src/controller/java/tlv.sources -Werror -Xlint:all -Xlint:deprecation
2023-05-11 16:04:16 INFO warning: flag is not supported by this version of the compiler: -Xlint:all
2023-05-11 16:04:16 INFO warning: flag is not supported by this version of the compiler: -Xlint:deprecation
2023-05-11 16:04:16 INFO /home/nuc17/Test/connectedhomeip/out/android-arm64-chip-tool/../../src/controller/java/src/chip/tlv/utils.kt:23:3: error: type inference failed. Expected type mismatch: inferred type is Int but Long was expected
2023-05-11 16:04:16 INFO foldRightIndexed(0) { i, it, acc ->
2023-05-11 16:04:16 INFO ^
2023-05-11 16:04:16 INFO /home/nuc17/Test/connectedhomeip/out/android-arm64-chip-tool/../../src/controller/java/src/chip/tlv/utils.kt:24:53: error: type mismatch: inferred type is Long but Int was expected
2023-05-11 16:04:16 INFO (acc shl 8) or (if (i == lastIndex && isSigned) it.toLong() else (it.toLong() and 0xFF))
2023-05-11 16:04:16 INFO ^
2023-05-11 16:04:16 INFO /home/nuc17/Test/connectedhomeip/out/android-arm64-chip-tool/../../src/controller/java/src/chip/tlv/utils.kt:24:71: error: type mismatch: inferred type is Long but Int was expected
2023-05-11 16:04:16 INFO (acc shl 8) or (if (i == lastIndex && isSigned) it.toLong() else (it.toLong() and 0xFF))
2023-05-11 16:04:16 INFO ^
2023-05-11 16:04:16 INFO Traceback (most recent call last):
2023-05-11 16:04:16 INFO File "/home/nuc17/Test/connectedhomeip/out/android-arm64-chip-tool/../../build/chip/java/kotlinc_runner.py", line 146, in <module>
2023-05-11 16:04:16 INFO sys.exit(main())
2023-05-11 16:04:16 INFO File "/home/nuc17/Test/connectedhomeip/out/android-arm64-chip-tool/../../build/chip/java/kotlinc_runner.py", line 130, in main
2023-05-11 16:04:16 INFO retcode = subprocess.check_call(kotlin_args + args.rest)
2023-05-11 16:04:16 INFO File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
2023-05-11 16:04:16 INFO raise CalledProcessError(retcode, cmd)
2023-05-11 16:04:16 INFO subprocess.CalledProcessError: Command '['/usr/bin/kotlinc', '-classpath', 'lib/third_party/java_deps/protobuf-java-3.22.0.jar', '-d', 'obj/src/controller/java/classes', '@gen/src/controller/java/tlv.sources', '-Werror', '-Xlint:all', '-Xlint:deprecation']' returned non-zero exit status 1.
2023-05-11 16:04:16 INFO ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/nuc17/Test/connectedhomeip/./scripts/build/build_examples.py", line 230, in <module>
main(auto_envvar_prefix='CHIP')
File "/home/nuc17/Test/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/nuc17/Test/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/nuc17/Test/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
rv.append(sub_ctx.command.invoke(sub_ctx))
File "/home/nuc17/Test/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/nuc17/Test/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/nuc17/Test/connectedhomeip/.environment/pigweed-venv/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/nuc17/Test/connectedhomeip/./scripts/build/build_examples.py", line 220, in cmd_build
context.obj.Build()
File "/home/nuc17/Test/connectedhomeip/scripts/build/build/__init__.py", line 71, in Build
builder.build()
File "/home/nuc17/Test/connectedhomeip/scripts/build/builders/builder.py", line 99, in build
self._build()
File "/home/nuc17/Test/connectedhomeip/scripts/build/builders/android.py", line 428, in _build
self._Execute(
File "/home/nuc17/Test/connectedhomeip/scripts/build/builders/builder.py", line 104, in _Execute
self._runner.Run(cmdarray, title=title)
File "/home/nuc17/Test/connectedhomeip/scripts/build/runner/shell.py", line 73, in Run
raise Exception('Command %r failed: %d' % (cmd, code))
Exception: Command ['ninja', '-C', '/home/nuc17/Test/connectedhomeip/out/android-arm64-chip-tool'] failed: 1
Bug prevalence
all the time
GitHub hash of the SDK that was being used
latest
Platform
darwin
Platform Version(s)
No response
Anything else?
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (3 by maintainers)
Hi @nmtoan91, your last issue is a problem with the Java compiler. The
Object.finalize()method is deprecated since Java 9 and the command have the-Werrorparameter (which would raise an error if any warning is present). Each of thefinalize()methods in the code is annotated with@SuppressWarning("deprecated"), so those warnings (and the error) should go away but it seems that your Java compiler ignore the annotation. I’m pretty sure I faced this issue in the past but I don’t remember in which context and how to fix it. In the meantime here is the APK (It’s for ARM64 on commit a33249db16d3bb351038e68d997db4c0ba5d003c). Please let me know when you downloaded it so I can delete it.please upgrade your kotlin version(1.7.+)