You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
desugar doesn't work with Bazel 0.17.1 and --host_javabase=<jdk8> #6159
The problem is that the --add-opens=java.base/java.lang.invoke=ALL-UNNAMED JVM flag added to desugar in d02f876 is incompatible with a JDK 8 `--host_javabase.
That issue was later fixed by 2e677fb, but the fix wasn't included in 0.17.1.
@cushon I'm using the one from the binary installer.
Also, using JDK9 is not an option when building Android binaries as it does not support it yet (JDK8 only). Although I think Bazel is supposed to handle it automatically? See #5978 (comment)
When I do not specify the build "works", but WARNING: An illegal reflective access operation has occurred
The warnings are annoying but harmless. We should suppress them. (Related: #6151.)
Ultimately this won't work because Android doesn't support JDK >8.
Can you provide more context about what doesn't work? The --host_javabase is only used for tools that run during the build (javac, etc.). You can use a JDK 9 --host_javabase and still build Android code that needs to be compatible with Java 8 or earlier.
@cushon never mind you were right, I thought the warning were a sign of the previous bug (which would cause our downstream gradle-based build to fail). But I tested it right now and it does work without--config jdk8.
I'm still interested in the use-case for --config jdk8. The regression is concerning either way and needs to be fixed, but you should be able to do Android builds with the default javabase and java_toolchain flags. If you ran into problems with the defaults that were fixed by using --config jdk8 I'd like to make sure there are bugs tracking those.
Yes, --config jdk8 was a workaround for #5978, and I can confirm I can do successful builds without it on 0.17.1 (with the annoying warning though, but that's tracked at #6151).
Note that (3) also affects anyone using Bazel without an embedded JDK together with a locally installed JDK 8, since it will default to using the local JDK 8 as the --host_javabase.
JAVA_HOME=$JAVA8_HOME ANDROID_HOME=$HOME/Android/Sdk/ bazel_nojdk build //:sample
...
Unrecognized option: --add-opens=java.base/java.lang.invoke=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
I think the mitigation is:
prefer the binaries with an embedded JDK, and don't override the --host_javabase
when using the binaries without an embedded JDK, use a JDK 9 --host_javabase
And if there ends up being a 0.17.2 it should include 2e677fb.
Activity
steeve commentedon Sep 15, 2018
@cushon I'm using the one from the binary installer.
Also, using JDK9 is not an option when building Android binaries as it does not support it yet (JDK8 only). Although I think Bazel is supposed to handle it automatically? See #5978 (comment)
cushon commentedon Sep 15, 2018
The warnings are annoying but harmless. We should suppress them. (Related: #6151.)
Can you provide more context about what doesn't work? The
--host_javabaseis only used for tools that run during the build (javac, etc.). You can use a JDK 9--host_javabaseand still build Android code that needs to be compatible with Java 8 or earlier.cushon commentedon Sep 15, 2018
As in https://github.com/bazelbuild/bazel/releases/download/0.17.1/bazel-0.17.1-installer-darwin-x86_64.sh? Then I can't reproduce the problem you reported without
--config=jdk8.Can you share the output of
bazel info?steeve commentedon Sep 15, 2018
@cushon never mind you were right, I thought the warning were a sign of the previous bug (which would cause our downstream gradle-based build to fail). But I tested it right now and it does work without
--config jdk8.Yes I'm using https://github.com/bazelbuild/bazel/releases/download/0.17.1/bazel-0.17.1-installer-darwin-x86_64.sh since bazelbuild/homebrew-tap#4 is not merged yet. I wanted to check if there was any issue before people at the office start upgrading.
Just in case:
cushon commentedon Sep 15, 2018
Thanks for confirming!
I'm still interested in the use-case for
--config jdk8. The regression is concerning either way and needs to be fixed, but you should be able to do Android builds with the defaultjavabaseandjava_toolchainflags. If you ran into problems with the defaults that were fixed by using--config jdk8I'd like to make sure there are bugs tracking those.steeve commentedon Sep 15, 2018
Yes,
--config jdk8was a workaround for #5978, and I can confirm I can do successful builds without it on 0.17.1 (with the annoying warning though, but that's tracked at #6151).jin commentedon Sep 17, 2018
@cushon thanks for driving this!
So let me summarize the issues so far:
--host_javabase: this is now working fine, and no changes are required.--config jdk8doesn't work on 0.17.1, because my fix at 2e677fb didn't make it into 0.17.1.Did I miss anything else?
cushon commentedon Sep 17, 2018
I think that's right.
Note that (3) also affects anyone using Bazel without an embedded JDK together with a locally installed JDK 8, since it will default to using the local JDK 8 as the
--host_javabase.I think the mitigation is:
--host_javabase--host_javabaseAnd if there ends up being a 0.17.2 it should include 2e677fb.
jin commentedon Sep 17, 2018
This sounds like it warrants a point release, since it's a regression introduced in 0.17.
jin commentedon Sep 17, 2018
(cc @ahumesky)
cushon commentedon Sep 17, 2018
I agree, given the emphasis on preserving support for
--host_javabase=<jdk8>in 0.17 (see #6035).steeve commentedon Sep 20, 2018
I think we can close this because #6164 fixed it