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

Bazel package deps incompatible with Travis JDK #1821

Closed
mbrukman opened this issue Sep 24, 2016 · 10 comments
Closed

Bazel package deps incompatible with Travis JDK #1821

mbrukman opened this issue Sep 24, 2016 · 10 comments
Assignees
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request

Comments

@mbrukman
Copy link
Contributor

I am trying to test a project which uses Bazel with Travis.

The only way I've gotten to use it is via the following config (see full config file):

    - os: linux
      dist: trusty
      env: TEST_RUNNER=bazel

      sudo: required

      before_script:
        - sudo add-apt-repository -y ppa:webupd8team/java
        - echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
        - echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
        - echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
        - curl "https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg" | sudo apt-key add -
        - sudo apt-get update
        - sudo apt-get install -qq -y oracle-java8-installer
        - sudo apt-get install -qq -y bazel
      script:
        - bazel test //...

Travis includes the ability to get JDK 8 pre-installed via the following option:

    - os: linux
      jdk: oracle8jdk

However, Bazel is incompatible with the Oracle 8 JDK provided by Travis, due to package dependencies. Specifically, attempting to install Bazel from a package with Travis CI's pre-installed JDK 8 generates the following error:

The following packages have unmet dependencies:
 bazel : Depends: google-jdk but it is not installable or
                  java8-jdk but it is not installable or
                  java8-sdk but it is not installable
E: Unable to correct problems, you have held broken packages.

It would be nice to eliminate some of the complexity of integrating with Bazel by making the Bazel package compatible with the Travis CI's Oracle 8 JDK package.

@meteorcloudy meteorcloudy self-assigned this Sep 26, 2016
@meteorcloudy meteorcloudy added type: feature request P2 We'll consider working on this in future. (Assignee optional) category: misc > release / binary labels Sep 26, 2016
@meteorcloudy
Copy link
Member

Is the name of the Travis JDK "oracle8jdk", I mean, if we add "oracle8jdk" as an alternative dependency, will that fix the problem?

@damienmg
Copy link
Contributor

Closing as we do not have update since a month.

@justinsb
Copy link
Contributor

The package name is oracle-java8-installer, but I think it would be better to add an openjdk dependency (unless there is an openjdk issue), as that is also installed (see below).

Can we reopen this?

I was able to get bazel to run using the following:

os: linux
dist: trusty

sudo: required

before_script:
     - wget "http://storage.googleapis.com/bazel-apt/pool/jdk1.8/b/bazel/bazel_0.4.0_amd64.deb"
     - sudo dpkg --force-all -i bazel_0.4.0_amd64.deb

script:
  - bazel test //...

java & jdk packages installed:

$ dpkg -l | grep java
ii  ca-certificates-java                     20130815ubuntu1                         all          Common CA certificates (JKS keystore)
ii  java-common                              0.51                                    all          Base of all Java packages
ii  libatk-wrapper-java                      0.30.4-4                                all          ATK implementation for Java using JNI
ii  libatk-wrapper-java-jni:amd64            0.30.4-4                                amd64        ATK implementation for Java using JNI (JNI bindings)
ii  libxerces2-java                          2.11.0-7                                all          Validating XML parser for Java with DOM level 3 support
ii  libxml-commons-external-java             1.4.01-2build1                          all          XML Commons external code - DOM, SAX, and JAXP, etc
ii  libxml-commons-resolver1.1-java          1.2-7build1                             all          XML entity and URI resolver library
ii  oracle-java7-installer                   7u80+7u60arm-0~webupd8~1                all          Oracle Java(TM) Development Kit (JDK) 7
ii  oracle-java7-unlimited-jce-policy        7u80+7u60arm-0~webupd8~1                all          Unlimited JCE Policy for Oracle Java 7
ii  oracle-java8-installer                   8u101+8u101arm-1~webupd8~2              all          Oracle Java(TM) Development Kit (JDK) 8
ii  oracle-java8-unlimited-jce-policy        8u101+8u101arm-1~webupd8~2              all          Unlimited JCE Policy for Oracle Java 8
ii  oracle-java9-installer                   9b130+9b130arm-1~webupd8~0              all          Oracle Java(TM) Development Kit (JDK) 9
ii  oracle-java9-unlimited-jce-policy        9b130+9b130arm-1~webupd8~0              all          Unlimited JCE Policy for Oracle Java 9
ii  tzdata-java                              2016f-0ubuntu0.14.04                    all          time zone and daylight-saving time data for use by java runtimes
0.04s$ dpkg -l | grep jdk
ii  openjdk-6-jdk:amd64                      6b39-1.13.11-0ubuntu0.14.04.1           amd64        OpenJDK Development Kit (JDK)
ii  openjdk-6-jre:amd64                      6b39-1.13.11-0ubuntu0.14.04.1           amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-6-jre-headless:amd64             6b39-1.13.11-0ubuntu0.14.04.1           amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  openjdk-6-jre-lib                        6b39-1.13.11-0ubuntu0.14.04.1           all          OpenJDK Java runtime (architecture independent libraries)
ii  openjdk-7-jdk:amd64                      7u111-2.6.7-0ubuntu0.14.04.3            amd64        OpenJDK Development Kit (JDK)
ii  openjdk-7-jre:amd64                      7u111-2.6.7-0ubuntu0.14.04.3            amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-7-jre-headless:amd64             7u111-2.6.7-0ubuntu0.14.04.3            amd64        OpenJDK Java runtime, using Hotspot JIT (headless)
ii  openjdk-8-jdk:amd64                      8u91-b14-0ubuntu4~14.04                 amd64        OpenJDK Development Kit (JDK)
ii  openjdk-8-jdk-headless:amd64             8u91-b14-0ubuntu4~14.04                 amd64        OpenJDK Development Kit (JDK) (headless)
ii  openjdk-8-jre:amd64                      8u91-b14-0ubuntu4~14.04                 amd64        OpenJDK Java runtime, using Hotspot JIT
ii  openjdk-8-jre-headless:amd64             8u91-b14-0ubuntu4~14.04                 amd64        OpenJDK Java runtime, using Hotspot JIT (headless)

@mbrukman
Copy link
Contributor Author

Ideally, we could specify the list of packages that would be sufficient to satisfy Bazel, as that would allow us to drop the sudo requirement and run in the faster and more efficient container-based environment (once we also get the required packages on the Travis package whitelist, of course).

Using oracle-java8-installer (and in the future, oracle-java9-installer) as one of the alternatives sounds good to me; here are the packages produced by the WebUpd8 team.

@justinsb
Copy link
Contributor

Actually there's another gotcha (but I'm new to this stuff, so I may be missing a trick)... the container based environment runs Ubuntu 12.04. It's possible to install bazel without sudo using the installer script with --user. But then I got an error about the version of libstdc++:

/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by /usr/bin/bazel)
/usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.19' not found (required by /usr/bin/bazel)

@mbrukman
Copy link
Contributor Author

Also, per the output from @justinsb above, perhaps openjdk-8-jdk is also a valid alternative dependency?

@mbrukman
Copy link
Contributor Author

Also, re: Ubuntu 12.04 (Precise) runtime environment in Travis: the default is indeed Precise, but you can also explicitly choose Ubuntu 14.04 (Trusty) if you prefer a newer one via the .travis.yml config file.

@mbrukman
Copy link
Contributor Author

I have managed to make Bazel work with Oracle JDK8 using a .travis.yml config as follows:

# Extract of the most relevant config parameters; see below for full config
matrix:
  include:
    - os: linux
      dist: trusty
      sudo: required
      language: java
      addons:
        apt:
          sources:
            - sourceline: "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8"
              key_url: "https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg"
          packages:
            - oracle-java8-installer
            - bazel

See full config and successful Travis run with this config.

Some explanation for the particular parameters:

  • sudo: required because Bazel repo and package are not whitelisted
  • without language: java we cannot install oracle-java8-installer without manually adding the ppa:webupd8team/java; however, it also installs an older version of oracle-java8-installer such that requesting it to be installed causes it to be upgraded, rather than installed from scratch
  • using jdk: oraclejdk8 breaks for some reason (again, see config for link to broken Travis build)

I believe there's still value for adding oracle-java8-installer as an optional dependency for Bazel such that oracle-java8-installer can be installed by users automatically without specifying it explicitly.

I think the required change is quite small so I'll send a PR to fix this.

mbrukman added a commit to mbrukman/bazel that referenced this issue Nov 25, 2016
With this change, `oracle-java7-installer` and `oracle-java8-installer` become
alternatives to satisfy the JDK dependency and thus can be implicitly installed
when someone just asks to install Bazel by itself.

Resolves issue bazelbuild#1821.
bazel-io pushed a commit that referenced this issue Nov 28, 2016
With this change, `oracle-java7-installer` and `oracle-java8-installer` become
alternatives to satisfy the JDK dependency and thus can be implicitly installed
when someone just asks to install Bazel by itself.

Resolves issue #1821.

Closes #2137.

--
Reviewed-on: #2137
MOS_MIGRATED_REVID=140200795
@ronshapiro
Copy link
Contributor

ronshapiro commented Jun 6, 2017

Dagger has been pinning against a version here: https://github.com/google/dagger/blob/b15108ffbc680296d80831f68a1108d803a89426/.travis.yml#L16

But those versions seem to disappear once a new version is released, causing our build to not be hermetic. Would it be possible to leave old versions on the apt repository?

@damienmg damienmg reopened this Jun 8, 2017
@damienmg
Copy link
Contributor

damienmg commented Jun 8, 2017

Sorry I am late reclining the issues it was solved in between.

As for CI I recommend using the artifacts from the release page instead of the apt repository. Please open a separate issue if there is more we could do.

@damienmg damienmg closed this as completed Jun 8, 2017
ronshapiro added a commit to google/dagger that referenced this issue Jun 14, 2017
…a the custom apt repository, which is cleared after a new beta is released.

Verified in: #772
Conversation in: bazelbuild/bazel#1821

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158998542
ronshapiro added a commit to google/dagger that referenced this issue Jun 14, 2017
…a the custom apt repository, which is cleared after a new beta is released.

Verified in: #772
Conversation in: bazelbuild/bazel#1821

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=158998542
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) type: feature request
Projects
None yet
Development

No branches or pull requests

5 participants