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

Support for Alpine Linux #289

Closed
wants to merge 4 commits into from
Closed

Conversation

kernle32dll
Copy link

This adds support for building a musl flavored J2V8 version, by providing a Alpine dockerfile to cross-compile J2V8 inside.

Also fixes install.maven.sh in case install.java.sh was not run beforehand (opt folder creation)

This adds support for building a musl flavored J2V8 version, by providing a Alpine dockerfile to cross-compile J2V8 inside.

Also fixes install.maven.sh in case install.java.sh was not run beforehand (opt folder creation)
@matiwinnetou
Copy link
Contributor

matiwinnetou commented Jun 23, 2017

Funny PR seems to suggest that alpine is in fact a special kind of linux not compatible with linux. I like alpine and use it for private stuff but this musl lib is causing so many workarounds for people. Personally when something doesn't work for me I usually resort to ubuntu rather than trying to fix those alpine build errors.

@kernle32dll
Copy link
Author

@matiwinnetou Well what should I say. It is Linux, yes. But that darn musl thing really does complicate matters. The company I work for did invest a lot of time evaluating alternatives, but there simple isn't one to Alpine + musl re-compiled dependencies.

Like I already mentioned in some issues here: This led us to develop our own Docker base image with j2v8. However this is very tiresome, as we always have to match the maven version with the Docker file version. We would really appreciate the integration into J2V8 directly :(

@matiwinnetou
Copy link
Contributor

I would implement this differently though, now it looks like alpine is on the same level as target = linux, windows. Alpine is linux but some kind of special flavour. On another hand it would make everything more complicated. It looks like this alpine thingy is a proper workaround :(. It is down to maintainer to decide of future of this PR though.

@kernle32dll
Copy link
Author

kernle32dll commented Jun 27, 2017

@drywolf was working on some flavor thingy, maybe he has some thoughts on this?
Also pinging @irbull for thoughts.

CMakeLists.txt Outdated
@@ -46,6 +46,15 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(J2V8_LIB_PLATFORM_NAME "linux")
set(J2V8_LIB_PREFIX "")
set(J2V8_LIB_ARCH_NAME "x86")

# TODO: This hack could be used to have a different lib filename for alpine, e.g. libj2v8_alpine_x86_64
Copy link
Author

Choose a reason for hiding this comment

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

I just realized that this hack IS required. Otherwise there is no possibility to deploy, since building the alpine version would overwrite the regular linux version!

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, the platform + architecture combination should be the primary indicator about the binary compatibility for a shared library. Since the lib for alpine would not be compatible with "default" linux distros, it should have its own identifier here and should also be handled by the java LibraryLoader.

Copy link
Author

Choose a reason for hiding this comment

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

I did push a small fix, which is less hacky and actually works :D

@drywolf
Copy link
Contributor

drywolf commented Jun 27, 2017

I'm currently working on a slight refactor of the CLI and how the build system code handles the invocation of the cross-compile environments, so that it is possible to support multiple cross-compile environments for each platform.

My test case currently is to run the win32 build also in Vagrant, which would allow for a true cross compile.
Building with a separate Docker environment for Alpine Linux would be also possible this way, like:
python build.py -t linux:alpine -a x64 -ne

@kernle32dll 's code in this PR would stay mostly the same, except for some changes to how the build target is defined and integrated into the build-system.
For the necessary workarounds and fixes I would need to have a closer look which build parameters would be necessary to be passed in to cmake to make them only activate when the JNI code is built for alpine, but not "regular" linux.

Technically speaking it is not a problem though.

PS: once I have the Win32 Vagrant build running in a stable manner, I could integrate the code of this PR as well to make it compatible with my changes. But before I step into that, I would like to hear back from @irbull if official support for Alpine is within the scope of what he plans for the project.

Corrected small f'up - with Docker the host kernel is shared with the container. So trying to detect alpine via kernel version inside the container is stupid.
Code adjustments, to allow the LibraryLoader to find the alpine flavored lib
@matiwinnetou
Copy link
Contributor

IMHO obsoleted by #327

@kernle32dll
Copy link
Author

kernle32dll commented Aug 7, 2017

@matiwinnetou Probably. Thanks for the heads-up to #327. I will look into it tomorrow, and possibly close this PR then

@matiwinnetou
Copy link
Contributor

Obsoleted, please close.

@irbull
Copy link
Member

irbull commented Aug 29, 2017

While I haven't tested it, we do have support for alpine Linux in HEAD now with the new build system. This PR can be closed. If there are problems with the alpine build, we can address them in separate issues or PRs. Thanks!

@irbull irbull closed this Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants