graal icon indicating copy to clipboard operation
graal copied to clipboard

Support of the Alpine Linux distribution

Open fernando-valdez opened this issue 5 years ago • 9 comments

Feature request

Is your feature request related to a problem? Please describe. Provide out-of-the-box support of the Alpine Linux distribution on GraalVM CE and EE

Describe the solution you'd like. This can be delivered as its own platform. For example, if someone desires to use GraalVM using Alpine, it should be a package like this: graalvm-ce-javaN-Alpine-amd64-X.Y.Z.tar.gz

Describe who do you think will benefit the most. GraalVM users that want to use the advantage of a lightweight Linux distribution based on musl libc and busybox.

Describe alternatives you've considered. Currently, is possible to execute GraalVM on Alpine using the glibc library. But the purpose of using Alpine is to use musl.

Additional context. GraalVM's Github repository can demonstrate that there is a demand for support on Alpine. Here is a list of issues regarding the usage of Alpine: https://github.com/oracle/graal/issues?q=+alpine+

fernando-valdez avatar Sep 01 '20 16:09 fernando-valdez

I'm currently working on it. I've got both 8 and 11 versions build on Alpine, but the native-image tool does not work properly: it produces images that crash when run

petermz avatar Sep 22 '20 15:09 petermz

I'm able to build substratevm and native-image with the attached patch applied and the following prerequisites:

  • gcc-9.3.1 from musl.cc (no luck with gcc package provided by Alpine)
  • symlink named musl-gcc somewhere in PATH and pointing to gcc from the package above
  • labsjdk-11
  • apk add bash cmake git make openssh python2 zlib-static
  • ninja built for Alpine

alpine-musl-ni.patch.txt

petermz avatar Sep 24 '20 08:09 petermz

I've managed to build complete GraalVM CE 20.3.0 package (including js, graalpython, truffleruby, and fastr) on Alpine Linux 3.11 with the 3 patches attached, and

  • labsjdk-11 as boot JDK
  • apk add bash build-base cmake ed gfortran git make openssh python2 sed xz binutils-dev bzip2-dev curl-dev libffi-dev libxml2-dev openssl-dev pcre-dev readline-dev zlib-static
  • ninja built from source (Alpine package didn't work for me, some options were not supported)

Things seem to work in general, but not all tests pass.

The patches are uncultured, they enable musl build at the cost of breaking glibc build. My next step should be to make both builds work. So far I've no idea how to do that... native files need some #ifdefs, as for Java and mx files I'm not sure.

graalvm-musl-20.3.0-patches.zip

petermz avatar Dec 02 '20 12:12 petermz

Hello,

First, thanks a lot for taking into account the requirement I have talked to Julia Kindelsberger.

When do you think GraalVM will be fully supported on Alpine/musl 3.12.x as for the forthcoming OpenJDK 16 ?

Best Regards.

fco-code-org avatar Feb 03 '21 10:02 fco-code-org

Hi @gradinac, sorry to disturb you but do you think we'll be able to work on integrating this patch anytime soon? If yes, I will work on resolving conflicts and re-merging the master branch

petermz avatar Mar 23 '21 15:03 petermz

Hey @petermz, thank you for your contribution! :) I have some things that I need to finish up, but I will probably have time to look into this sometime next week - I'll post an update here as soon as I can.

gradinac avatar Mar 24 '21 20:03 gradinac

Hey @gradinac , any update on this topic please? thank you for your contribution!

nelvadas avatar Aug 27 '21 07:08 nelvadas

I am looking for the same for a new project any traction on this. #Alpine #GraalVM

doogle-oss avatar Nov 22 '21 03:11 doogle-oss

Any update on this? @petermz @fernando-valdez

xlight05 avatar Sep 06 '22 04:09 xlight05

Any update on this ?

nigelthomas-mozanta avatar Oct 09 '23 05:10 nigelthomas-mozanta

Hello,

As far as I know, the answer is: no update on this topic ☹. BTW, it has been a long time that I have requested (September 2020 more than 3 years ago) this feature.

As you can see no more activity since March 2021 so more that 2 years ago :-(

Best Regards.

fco-code-org avatar Oct 09 '23 07:10 fco-code-org

FYI: I recently packaged Mandrel (distribution of GraalVM) native image builder for Alpine Linux. It’s currently available in the testing repository: openjdk-mandrel

jirutka avatar Oct 09 '23 19:10 jirutka

Musl support was merged some time ago, see #3141. It is now possible to build and run GraalVM on a musl based system.

Some things might be unimplemented (esp. in Truffle/Espresso area), but JIT/AOT compilation should work

petermz avatar Oct 12 '23 07:10 petermz