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

Run bazel command failed with bazel-0.5.0-jdk7 or bazel-0.5.1-jdk7 #3198

Closed
GinFungYJF opened this issue Jun 15, 2017 · 11 comments
Closed

Run bazel command failed with bazel-0.5.0-jdk7 or bazel-0.5.1-jdk7 #3198

GinFungYJF opened this issue Jun 15, 2017 · 11 comments

Comments

@GinFungYJF
Copy link
Contributor

Description of the problem / feature request / question:

After I installed bazel successfullu by using binary installer(bazel-0.5.0-jdk7-installer-linux-x86_64.sh), I have an error when I run any bazel command. And the 0.5.1-jdk7 has the same error.

If possible, provide a minimal example to reproduce the problem:

root@XX:~# bazel version
Extracting Bazel installation...
java.lang.UnsupportedClassVersionError: com/google/protobuf/MessageOrBuilder : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
        at com.google.devtools.build.lib.runtime.ServerBuilder.<init>(ServerBuilder.java:39)
        at com.google.devtools.build.lib.runtime.BlazeRuntime$Builder.build(BlazeRuntime.java:1157)
        at com.google.devtools.build.lib.runtime.BlazeRuntime.newRuntime(BlazeRuntime.java:1010)
        at com.google.devtools.build.lib.runtime.BlazeRuntime.batchMain(BlazeRuntime.java:753)
        at com.google.devtools.build.lib.runtime.BlazeRuntime.main(BlazeRuntime.java:561)
        at com.google.devtools.build.lib.bazel.BazelMain.main(BazelMain.java:56)

Environment info

  • Operating System:
    ubuntu14.04

  • Bazel version (output of bazel info release):
    0.5.0 or 0.5.1

  • If bazel info release returns "development version" or "(@non-git)", please tell us what source tree you compiled Bazel from; git commit hash is appreciated (git rev-parse HEAD):
    Running bazel info release shows the same error.

Have you found anything relevant by searching the web?

(e.g. StackOverflow answers,
GitHub issues,
email threads on the bazel-discuss Google group)
No.

@meteorcloudy
Copy link
Member

@ulfjack Do you know how jdk7 Bazel works or someone who knows?

@ulfjack
Copy link
Contributor

ulfjack commented Jun 16, 2017

It suspect someone updated our protobuf libraries to a version that requires Jdk 8.

@ulfjack
Copy link
Contributor

ulfjack commented Jun 16, 2017

Last upgrade was 0acead4.

@ulfjack
Copy link
Contributor

ulfjack commented Jun 16, 2017

$ javap -v -cp third_party/protobuf/3.2.0/libprotobuf_java.jar com.google.protobuf.MessageOrBuilder | grep "major"
major version: 52

@buchgr
Copy link
Contributor

buchgr commented Jun 16, 2017

Good catch! Protobuf java only requires Java 6. S it seems like the .jar artifacts where built with a Java 8's javac compiler without -target 1.7 specified. I ll update the jars with properly compiled ones.

buchgr added a commit to buchgr/protobuf that referenced this issue Jun 16, 2017
buchgr added a commit to buchgr/bazel that referenced this issue Jun 16, 2017
…ixes bazelbuild#3198

I recompiled the protobuf jars to be binary compatible with Java 6 by specifying -target 1.6 to javac.

Verified:
$ javap -v -cp third_party/protobuf/3.2.0/libprotobuf_java.jar com.google.protobuf.MessageOrBuilder | grep "major"
  major version: 50

$ javap -v -cp third_party/protobuf/3.2.0/libprotobuf_java_util.jar com.google.protobuf.util.Durations | grep "major"
  major version: 50

Change-Id: Ib40f8af8393de79dd431d08eb766c269bab2e608
@buchgr
Copy link
Contributor

buchgr commented Jun 16, 2017

@GinFungYJF hey! please try again with a bazel built from latest master!

hlopko pushed a commit that referenced this issue Jun 22, 2017
…ixes #3198

I recompiled the protobuf jars to be binary compatible with Java 6 by specifying -target 1.6 to javac.

Verified:
$ javap -v -cp third_party/protobuf/3.2.0/libprotobuf_java.jar com.google.protobuf.MessageOrBuilder | grep "major"
  major version: 50

$ javap -v -cp third_party/protobuf/3.2.0/libprotobuf_java_util.jar com.google.protobuf.util.Durations | grep "major"
  major version: 50

Change-Id: Ib40f8af8393de79dd431d08eb766c269bab2e608
hlopko pushed a commit that referenced this issue Jun 22, 2017
…ixes #3198

I recompiled the protobuf jars to be binary compatible with Java 6 by specifying -target 1.6 to javac.

Verified:
$ javap -v -cp third_party/protobuf/3.2.0/libprotobuf_java.jar com.google.protobuf.MessageOrBuilder | grep "major"
  major version: 50

$ javap -v -cp third_party/protobuf/3.2.0/libprotobuf_java_util.jar com.google.protobuf.util.Durations | grep "major"
  major version: 50

Change-Id: Ib40f8af8393de79dd431d08eb766c269bab2e608
bazel-io pushed a commit that referenced this issue Jun 27, 2017
Baseline: e78ad83

Cherry picks:
   + 6802831:
     experimental UI: move stopUpdateThread() out of synchronized,
     again
   + 019935d:
     Fix bug in URI computation in RemoteModule
   + e9424cf:
     Automated rollback of commit
     7dec005.
   + 9eea05d:
     Switching to Watcher API instead of wait_for_completion, in
     preparation for deprecating the wait_for_completion field.
   + 8965981:
     Set correct execroot for info
   + 716b527:
     Only create a single per-build instance of the remote cache /
     executor
   + 1d82d19:
     protobuf: Update protobuf jars to be binary compatible with Java
     6. Fixes #3198
   + 524b90d:
     Change CAS URI to use the "bytestream" scheme instead of being
     scheme-less
   + 4929ad7:
     Automated g4 rollback of commit
     923d7df.
   + 68b9a7e:
     Automated g4 rollback of commit
     da56606.
   + 2ba693f:
     Automated rollback of commit
     ce7c4de.

Incompatible changes:

  - Blaze no longer generates xcode projects. Use tulsi.bazel.build
    instead.

Important changes:

  - Keyword-only syntax in a function definition is deprecated
      (e.g. `def foo(a, *, b)` or `def foo(a, *b, c)`) and will be
    removed in the future.
  - Attempting to build an Android target without setting up
    android_sdk_repository will now produce a helpful error message.
  - Adds a sha256 attribute to git_repository and new_git_repository.
    This can only be used if the remote is a public GitHub
    repository. It forces
    Bazel to download the repository as a tarball, which will often
    be faster and
    more robust than cloning it.
  - Sandboxing is now enabled by default on FreeBSD (via
    processwrapper-sandbox).
  - android_test may use manifest placeholders with 'manifest_merger
    = "android"'.
  - load() statements should be called at the top of .bzl files,
    before any
      other statement. This convention will be enforced in the future.
  - Effectively remove sysroot from CppConfiguration and allow it to
    use select statements.
  - proto_library.strict_proto_deps no longer exists.
  - Flag --explicit_jre_deps is now a noop.
  - The 'legacy' Android manifest merger is deprecated. Please
    upgrade to the 'android' manifest merger, which is the same
    merger used by Gradle.
    https://developer.android.com/studio/build/manifest-merge.html
  - Using $(CC_FLAGS) in a GenRule adds a dependency to the c++
    toolchain
  - add one-version enforcement to android_local_test
  - Skylark support (apple_common.dotted_version(string)) for
    building DottedVersion objects to interface with native apple
    rules
  - CC_FLAGS can be defined using 'cc-flags-make-variable' action_config in
    CROSSTOOL
  - ios_framework native rule has been removed. This rule had been
    essentially broken for several months now; users should be using
    the skylark ios framework rule.
    https://github.com/bazelbuild/rules_apple has details.
  - Clean command no longer uses boolean values for --async,
    --expunge, and --expunge_async options.
  - Partially fixes external J2ObjC support.
  - '--aspects' can occur more than once on the command line.
  - --no_ prefix no longer recognized.
  - Use action_config in crosstool for static library archiving,
    remove ar_flag.
  - Added a new flag --sandbox_writable_path, which asks the sandbox
    to
    make an existing directory writable when running actions.
  - bazel test now also computes a default instrumentation filter if
    --collect_code_coverage is enabled
  - n/na
  - In .bzl files, top-level `if` statements are deprecated and will
    be forbidden
      in the future. Move them in a function body instead (or use a
    conditional
      expression instead: `x if condition else y`).
  - ios_device and ios_test are deprecated. Please use the new testing
    rules in https://github.com/bazelbuild/rules_apple instead.
  - bazel query --output package now displays packages from external
    repository with the format "@reponame//package". Packages in the
    main repository continue to have the format "package".
  - ctx.expand_make_variables is deprecated.
  - Bazel posts links to the CAS to the BEP if remote caching /
    execution is enabled
  - `bazel info execution_root` returns the corrrect directory name
    for the execution root.
@GinFungYJF
Copy link
Contributor Author

@buchgr But how to build a bazel-jdk7 form the latest master instead of the distribution?

@GinFungYJF
Copy link
Contributor Author

GinFungYJF commented Jun 28, 2017

I think this issue should be reopened as the bazel-0.5.2-jdk7 has another error after I installed it with the bazel-0.5.2-jdk7-installer-linux-x86_64.sh.

root@XX:~# bazel version
com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: java.util.ArrayList.sort(Ljava/util/Comparator;)V
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212)
        at com.google.common.cache.LocalCache.get(LocalCache.java:4053)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4057)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4986)
        at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4992)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.createOptionsParser(BlazeCommandDispatcher.java:743)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:408)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:322)
        at com.google.devtools.build.lib.runtime.BlazeRuntime.batchMain(BlazeRuntime.java:760)
        at com.google.devtools.build.lib.runtime.BlazeRuntime.main(BlazeRuntime.java:552)
        at com.google.devtools.build.lib.bazel.BazelMain.main(BazelMain.java:58)
Caused by: java.lang.NoSuchMethodError: java.util.ArrayList.sort(Ljava/util/Comparator;)V
        at com.google.devtools.build.lib.runtime.AllIncompatibleChangesExpansion.getExpansion(AllIncompatibleChangesExpansion.java:165)
        at com.google.devtools.common.options.OptionsData.from(OptionsData.java:93)
        at com.google.devtools.common.options.OptionsParser.getOptionsDataInternal(OptionsParser.java:123)
        at com.google.devtools.common.options.OptionsParser.getOptionsData(OptionsParser.java:110)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher$1.load(BlazeCommandDispatcher.java:129)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher$1.load(BlazeCommandDispatcher.java:126)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208)
        ... 10 more
bazel crash in async thread:
com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: java.util.ArrayList.sort(Ljava/util/Comparator;)V
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2212)
        at com.google.common.cache.LocalCache.get(LocalCache.java:4053)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4057)
        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4986)
        at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4992)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.createOptionsParser(BlazeCommandDispatcher.java:743)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:408)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:322)
        at com.google.devtools.build.lib.runtime.BlazeRuntime.batchMain(BlazeRuntime.java:760)
        at com.google.devtools.build.lib.runtime.BlazeRuntime.main(BlazeRuntime.java:552)
        at com.google.devtools.build.lib.bazel.BazelMain.main(BazelMain.java:58)
Caused by: java.lang.NoSuchMethodError: java.util.ArrayList.sort(Ljava/util/Comparator;)V
        at com.google.devtools.build.lib.runtime.AllIncompatibleChangesExpansion.getExpansion(AllIncompatibleChangesExpansion.java:165)
        at com.google.devtools.common.options.OptionsData.from(OptionsData.java:93)
        at com.google.devtools.common.options.OptionsParser.getOptionsDataInternal(OptionsParser.java:123)
        at com.google.devtools.common.options.OptionsParser.getOptionsData(OptionsParser.java:110)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher$1.load(BlazeCommandDispatcher.java:129)
        at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher$1.load(BlazeCommandDispatcher.java:126)
        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3628)
        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2336)
        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2295)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2208)
        ... 10 more

@ulfjack ulfjack assigned philwo and unassigned buchgr Jun 28, 2017
@ulfjack ulfjack reopened this Jun 28, 2017
@philwo
Copy link
Member

philwo commented Jun 28, 2017

@ulfjack What shall I do with this bug?

@GinFungYJF Could you use the Bazel version that comes with a bundled OpenJDK8 instead? You can download it from our releases page: bazel-0.5.2-installer-linux-x86_64.sh.

@damienmg
Copy link
Contributor

We had only 1 bug report for that and the problem has been there for 1 month now. As announced before 0.5.0 we were going to remove support for JDK-7 build, please use the installer with OpenJDK8 bundled instead.

Next release won't have JDK-7 builds anymore, see https://www.bazel.build/blog/2017/04/21/JDK7-deprecation.html

mmorearty pushed a commit to Asana/bazel that referenced this issue Jul 1, 2017
Baseline: e78ad83

Cherry picks:
   + 6802831:
     experimental UI: move stopUpdateThread() out of synchronized,
     again
   + 019935d:
     Fix bug in URI computation in RemoteModule
   + e9424cf:
     Automated rollback of commit
     7dec005.
   + 9eea05d:
     Switching to Watcher API instead of wait_for_completion, in
     preparation for deprecating the wait_for_completion field.
   + 8965981:
     Set correct execroot for info
   + 716b527:
     Only create a single per-build instance of the remote cache /
     executor
   + 1d82d19:
     protobuf: Update protobuf jars to be binary compatible with Java
     6. Fixes bazelbuild#3198
   + 524b90d:
     Change CAS URI to use the "bytestream" scheme instead of being
     scheme-less
   + 4929ad7:
     Automated g4 rollback of commit
     923d7df.
   + 68b9a7e:
     Automated g4 rollback of commit
     da56606.
   + 2ba693f:
     Automated rollback of commit
     ce7c4de.

Incompatible changes:

  - Blaze no longer generates xcode projects. Use tulsi.bazel.build
    instead.

Important changes:

  - Keyword-only syntax in a function definition is deprecated
      (e.g. `def foo(a, *, b)` or `def foo(a, *b, c)`) and will be
    removed in the future.
  - Attempting to build an Android target without setting up
    android_sdk_repository will now produce a helpful error message.
  - Adds a sha256 attribute to git_repository and new_git_repository.
    This can only be used if the remote is a public GitHub
    repository. It forces
    Bazel to download the repository as a tarball, which will often
    be faster and
    more robust than cloning it.
  - Sandboxing is now enabled by default on FreeBSD (via
    processwrapper-sandbox).
  - android_test may use manifest placeholders with 'manifest_merger
    = "android"'.
  - load() statements should be called at the top of .bzl files,
    before any
      other statement. This convention will be enforced in the future.
  - Effectively remove sysroot from CppConfiguration and allow it to
    use select statements.
  - proto_library.strict_proto_deps no longer exists.
  - Flag --explicit_jre_deps is now a noop.
  - The 'legacy' Android manifest merger is deprecated. Please
    upgrade to the 'android' manifest merger, which is the same
    merger used by Gradle.
    https://developer.android.com/studio/build/manifest-merge.html
  - Using $(CC_FLAGS) in a GenRule adds a dependency to the c++
    toolchain
  - add one-version enforcement to android_local_test
  - Skylark support (apple_common.dotted_version(string)) for
    building DottedVersion objects to interface with native apple
    rules
  - CC_FLAGS can be defined using 'cc-flags-make-variable' action_config in
    CROSSTOOL
  - ios_framework native rule has been removed. This rule had been
    essentially broken for several months now; users should be using
    the skylark ios framework rule.
    https://github.com/bazelbuild/rules_apple has details.
  - Clean command no longer uses boolean values for --async,
    --expunge, and --expunge_async options.
  - Partially fixes external J2ObjC support.
  - '--aspects' can occur more than once on the command line.
  - --no_ prefix no longer recognized.
  - Use action_config in crosstool for static library archiving,
    remove ar_flag.
  - Added a new flag --sandbox_writable_path, which asks the sandbox
    to
    make an existing directory writable when running actions.
  - bazel test now also computes a default instrumentation filter if
    --collect_code_coverage is enabled
  - n/na
  - In .bzl files, top-level `if` statements are deprecated and will
    be forbidden
      in the future. Move them in a function body instead (or use a
    conditional
      expression instead: `x if condition else y`).
  - ios_device and ios_test are deprecated. Please use the new testing
    rules in https://github.com/bazelbuild/rules_apple instead.
  - bazel query --output package now displays packages from external
    repository with the format "@reponame//package". Packages in the
    main repository continue to have the format "package".
  - ctx.expand_make_variables is deprecated.
  - Bazel posts links to the CAS to the BEP if remote caching /
    execution is enabled
  - `bazel info execution_root` returns the corrrect directory name
    for the execution root.
@philwo
Copy link
Member

philwo commented Jul 13, 2017

Closing because it's obsolete with Bazel 0.5.2 being released and a version with bundled OpenJDK 8 being available.

@GinFungYJF Please let us know if the version with bundled OpenJDK 8 is not usable for you. We would really like to get Bazel to work for you.

@philwo philwo closed this as completed Jul 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants