Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

RHEL5 support #11

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

radhikalism
Copy link
Contributor

Hi,

Following on from #10, I've attempted to add support for building and using clj-v8 with RHEL5 distros. This is an older but still stable and widely-used platform, and it required a number of changes:

  • Shell scripts using sed more portably (no -E flag available).
  • A new "linux-rhel5" build target that's similar to but distinct from "linux", and for x86_64 only.
  • RHEL5 detection using lsb_release where available, including CentOS.
  • JNA dependency bumped to 3.5.2, which relaxes its glibc dependency version (accepts pre-2.11).
  • Additional v8 binaries with the above changes (using CentOS 5.10 amd64) in build/linux-rhel5/x86_64/.

Thoughts?

@radhikalism radhikalism mentioned this pull request Mar 21, 2014
@pbiggar
Copy link
Contributor

pbiggar commented Jul 7, 2014

Sorry for the delay in getting back to you - I think I missed this PR when you made it.

Can you describe the problems you had that make this change necessary on rhel? I don't object, just want to understand the problem and the solution a bit better.

@radhikalism
Copy link
Contributor Author

Sure, thanks for taking a look. Don't mind the delay -- open source can be a high-latency exercise.

I'm using clj-v8 via Optimus in a RHEL5 environment -- still prevalent in the wilderness of enterprise -- and along the way found a few changes were required.

As I recall, I needed to build fresh binaries to use clj-v8 on RHEL5 (and/or CentOS 5) because:

  • clj-v8 depends on JNA 3.5.1, which links to a newer glibc than is available on RHEL5, so loading clj-v8 failed.
  • Other ELF/ABI versioning issues (SysV vs GNU/Linux) would prevent loading on RHEL5 even with a newer glibc.

So in order to build and load these binaries, I had to:

  • Use a suitable build environment (SysV ELF -- I used a CentOS 5 VM).
  • Make minor changes to some build scripts for portability with this older build env; mainly usages of sed.
    • clj-v8-native/create-jar.sh
    • clj-v8-native/local-mvn-install.sh
  • Add a distinct platform target for RHEL5.
    • clj-v8-native/build.sh
    • clj-v8-native/src/v8wrapper/Makefile.linux
    • clj-v8-native/src/v8wrapper/Makefile.linux-rhel5
    • clj-v8-native/src/v8wrapper/Makefile.linux.32
    • clj-v8-native/src/v8wrapper/Makefile.macos
  • Add matching runtime platform detection using lsb_release if available (such as on RHEL5, to distinguish it from generic Linux).
    • clj-v8/project.clj
    • clj-v8/src/v8/core.clj

These changes don't affect any already-supported target's behaviour, adding only a new target.

Probably the largest risk of accepting this is in maintenance -- given that to reproduce or test RHEL5-compatible binaries basically requires another, very particular buiid environment.

On the other hand, RHEL5 (including CentOS 5) is still in long-term support, and relatively easy to find in the wild, so may be worth supporting here -- at least, I am interested until 5.x truly reaches obsolescence. (RHEL 7.x is very new and didn't exist when I raised the PR; even 6.x anecdotally isn't very popular yet.)

What do you think? Can I offer any more specific info?

Thanks


(defn- find-file-path-fragments
[]
(let [os-name (System/getProperty "os.name")
(let [lsb (try (shell/sh "lsb_release" "-d")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there another way to do this without shelling out?

@pbiggar
Copy link
Contributor

pbiggar commented Oct 17, 2015

Sorry for the very long delay in getting back to you. This looks good. One small query about shelling out and that's it.

I'm wiring up some testing at the moment to make this safer. I'm considering using Docker to build each of the native libs in the different environments. Is there a good RHEL image to use to build these on?

@radhikalism
Copy link
Contributor Author

Thanks for looking at this @pbiggar.

Regarding shelling out, I don't know a better way (though I looked) but I'm open to ideas. If there is a Java API for fine-grained platform detection, or at least something substituting lsb_release in this case, I'd support it. Do you have any ideas?

The Docker plan sounds perfect. There are CentOS containers for all versions including v5 at https://hub.docker.com/_/centos/ When I built my in-house copy, I used a VirtualBox image, but Docker would be nicer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants