eclipse-openj9 / openj9

Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Other
3.27k stars 719 forks source link

Use `update-alternatives` in docker files rather than straight symlinks #88

Open mgaudet opened 6 years ago

mgaudet commented 6 years ago

In #23, it was discovered minor changes to the docker file can break it

I suspect switching to update-alternative will fix this.

adamfarley commented 6 years ago

This seems a fairly straightforward change. However this website states that OpenJDK 9 on HotSpot supports SLES 11.

https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms

If this is also the case for OpenJDK on OpenJ9, then we may have to specify the command location explicitly, as the sles 11 machine I checked (jsvt004g.hursley.ibm.com) says: "update-alternatives: command not found". Some websites online say others have this problem also, so this may not be a simple setup bug.

For reference, update-alternative is found in /usr/sbin/update-alternatives

So the docker files with bits that look like this:

# Create links for c++,g++,cc,gcc RUN ln -s g++ /usr/bin/c++ \ && ln -s g++-4.8 /usr/bin/g++ \ && ln -s gcc /usr/bin/cc \ && ln -s gcc-4.8 /usr/bin/gcc

Would probably end up looking something like this:

# Create links for c++,g++,cc,gcc RUN /usr/sbin/update-alternatives --install /usr/bin/g++ g++ /usr/bin/c++ RUN /usr/sbin/update-alternatives --install /usr/bin/g++-4.8 g++-4.8 /usr/bin/g++ RUN /usr/sbin/update-alternatives --install /usr/bin/gcc gcc /usr/bin/cc RUN /usr/sbin/update-alternatives --install /usr/bin/gcc-4.8 gcc-4.8 /usr/bin/gcc

And here's a list of the docker files that could likely use this change:

https://github.com/eclipse/openj9/blob/master/buildenv/docker/jdk9/x86_64/ubuntu16/Dockerfile https://github.com/eclipse/openj9/blob/master/buildenv/docker/jdk9/ppc64le/ubuntu16/Dockerfile https://github.com/eclipse/openj9/blob/master/buildenv/docker/jdk9/s390x/ubuntu16/Dockerfile https://github.com/eclipse/openj9/blob/master/buildenv/docker/test/Dockerfile

Note: The test Dockerfile had a -f in the ln, and I'm not seeing a "force" option for update-alternatives, so perhaps a quiet rm?

Does that sound right?

mgaudet commented 6 years ago

If I recall correctly, update-alternatives only exists on Debian derived linux distributions, of which Ubuntu is one, but SLES is not -- so a SLES docker container will need a different choice.

Everything else looks about right to me based on inspection.

I am currently 😷, and so I am slower than usual. Take what I say with a grain of salt