Skip to content

0.16.0 release binary requires local JDK #5744

Closed

Description

@schroederc

Description of the problem / feature request:

Bazel release 0.15.2 could build Java targets without a local system JDK installed. Bazel release 0.16.0 cannot.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

$ # Be on a system without a local JDK installed
$ git clone https://github.com/google/protobuf.git
$ cd protobuf
$ bazel-0.16.0 build //:protobuf_java
INFO: Analysed target //:protobuf_java (0 packages loaded).
INFO: Found 1 target...
ERROR: missing input file '@local_jdk//:jre/lib/jce.jar'
ERROR: /protobuf/BUILD:609:1: //:protobuf_java: missing input file '@local_jdk//:jre/lib/jce.jar'
Target //:protobuf_java failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /protobuf/BUILD:609:1 1 input file(s) do not exist
INFO: Elapsed time: 0.426s, Critical Path: 0.15s
INFO: 0 processes.
FAILED: Build did NOT complete successfully

$ bazel-0.15.2 build //:protobuf_java
INFO: Analysed target //:protobuf_java (12 packages loaded).
INFO: Found 1 target...
Target //:protobuf_java up-to-date:
  bazel-bin/libprotobuf_java.jar
INFO: Elapsed time: 65.287s, Critical Path: 28.78s
INFO: 163 processes: 162 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 168 total actions

Activity

  1. schroederc commented on Aug 2, 2018

    @schroederc
    ContributorAuthor

    This seems similar to the issue with the 0.15.1 release: #5591 (comment)

  2. laszlocsomor commented on Aug 3, 2018

    @laszlocsomor
    Contributor

    I see the same on Windows 10 with Bazel 0.16.0 vs. Bazel 0.15.2:

    C:\src\bazel>c:\src\bazel-releases\0.16.0\bazel.exe --output_user_root=c:\tmp1 build --python_path=c:/anaconda3/python.exe @local_jdk//:bootclasspath
    ...
    INFO: Found 1 target...
    ERROR: missing input file '@local_jdk//:jre/lib/jce.jar'
    ERROR: C:/tmp1/o2bbs3hu/external/local_jdk/BUILD.bazel:75:1: @local_jdk//:bootclasspath: missing input file 'LabelCause{label=@local_jdk//:jre/lib/jce.jar, msg=missing input file '@local_jdk//:jre/lib/jce.jar'}'
    Target @local_jdk//:bootclasspath failed to build
    ERROR: C:/tmp1/o2bbs3hu/external/local_jdk/BUILD.bazel:75:1 1 input file(s) do not exist
    INFO: Elapsed time: 0.989s, Critical Path: 0.00s
    INFO: 0 processes.
    FAILED: Build did NOT complete successfully
    
    C:\src\bazel>c:\src\bazel-releases\0.15.2\bazel.exe --output_user_root=c:\tmp2 build --python_path=c:/anaconda3/python.exe @local_jdk//:bootclasspath
    ...
    INFO: Found 1 target...
    Target @local_jdk//:bootclasspath up-to-date (nothing to build)
    INFO: Elapsed time: 1.279s, Critical Path: 0.01s
    INFO: 0 processes.
    INFO: Build completed successfully, 1 total action
    

    Solution was to define JAVA_HOME:

    set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_152
    
  3. laszlocsomor commented on Aug 3, 2018

    @laszlocsomor
    Contributor

    /cc @buchgr -- do you know what's going on?

  4. schroederc commented on Aug 3, 2018

    @schroederc
    ContributorAuthor

    While we're on the subject, how does one actually go about building a Bazel binary with the fully embedded JDK? If I try bazel build --stamp //src:bazel on https://github.com/bazelbuild/bazel/tree/0.15.2 or https://github.com/bazelbuild/bazel/tree/0.16.0, then I get either the issue from #5591 (comment) or this issue, respectively.

  5. buchgr commented on Aug 6, 2018

    @buchgr
    Contributor

    @schroederc which JDK version to you have installed on your system? Are you specifying a --javabase via a flag (in .bazelrc maybe?).

  6. schroederc commented on Aug 6, 2018

    @schroederc
    ContributorAuthor

    The point is that the system doesn't have any JDK installed. 0.15 did not need a local JDK installed but 0.16.0 now does.

    As a repro, this Docker container builds a java_library successfully using 0.15.2 with no local JDK:

    FROM debian:jessie
    RUN apt-get update && \
        apt-get install -y pkg-config zip g++ zlib1g-dev unzip curl git
    
    RUN curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazel/releases/download/0.15.2/bazel-0.15.2-linux-x86_64 && chmod +x /usr/bin/bazel
    
    RUN git clone https://github.com/google/protobuf.git && \
        cd protobuf && \
        bazel build //:protobuf_java
    

    But 0.16.0 fails to build the same target in the same environment:

    FROM debian:jessie
    RUN apt-get update && \
        apt-get install -y pkg-config zip g++ zlib1g-dev unzip curl git
    
    RUN curl -L -o /usr/bin/bazel https://github.com/bazelbuild/bazel/releases/download/0.16.0/bazel-0.16.0-linux-x86_64 && chmod +x /usr/bin/bazel
    
    RUN git clone https://github.com/google/protobuf.git && \
        cd protobuf && \
        bazel build //:protobuf_java
    

    0.16.0 complains about a missing input file:

    ERROR: missing input file '@local_jdk//:jre/lib/jsse.jar'
    ERROR: /protobuf/BUILD:609:1: //:protobuf_java: missing input file '@local_jdk//:jre/lib/jsse.jar'
    Target //:protobuf_java failed to build
    
  7. buchgr commented on Aug 6, 2018

    @buchgr
    Contributor

    @cushon any ideas?

  8. cushon commented on Aug 6, 2018

    @cushon
    Contributor

    We're defaulting to the embedded JDK as a target --javabase, and we don't support JDK > 8 as a target --javabase.

    Can you install a JDK 8 and use that as the target?

    In the medium term

    • there's some work happening to use remote repos for java runtimes so Bazel can fetch a JDK 8 for you to use as the target
    • we will eventually support JDK 9 as a target --javabase
  9. schroederc commented on Aug 6, 2018

    @schroederc
    ContributorAuthor

    I did add the JDK 8 to our Docker container as a workaround. If this was intentional, then the release notes should be updated to reflect the breaking change (as well as the fact that the embedded JDK was updated to 9).

  10. cushon commented on Aug 6, 2018

    @cushon
    Contributor

    They mention the first part:

    The embedded JDK has been upgraded to JDK 9, and is now used as both the default startup --host_javabase and build --host_javabase.

    https://blog.bazel.build/2018/07/31/bazel-0.16.html

  11. dslomov commented on Aug 8, 2018

    @dslomov
    Contributor

    Even though our longer-term intention is to fully hide the embedded JDK, we should not break people without prior announcement.
    We will be issuing the patch release of 0.16 that fixes this: track status in #5792

  12. cushon commented on Aug 9, 2018

    @cushon
    Contributor

    This is fixed at head, and the fixes will be included in the upcoming 0.16.1 and 0.17 releases.

  13. added a commit that references this issue on Aug 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions