-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
openjdk8 compile statically #85902
base: master
Are you sure you want to change the base?
openjdk8 compile statically #85902
Conversation
Maybe that's not a helpful advice but still: why aren't you using https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/static.nix ? At least to place there the dependencies you override... And there's also |
@doronbehar I tested both with |
I think I've discovered the reason: oracle/graal#1755 (comment)
PR ready for review (description is modified above) |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiled openjdk8 using static = true
and it worked just fine on my laptop (although it took some time 😄 as to be expected). Also tested out resulting java
and javac
binaries with a simple hello world program. LGTM 👍
I marked this as stale due to inactivity. → More info |
feel free to upstream the patches and rebase if you or someone wants to get this in nixpkgs |
EDITED 28/04/2020: I was able to solve the static compilation problem. With these changes I can finally compile graalvm native images. I didn't pay much attention to linting etc, so don't hesitate to ask questions about my decision or potential blunders. I will very likely need to make similar changes to jdk11, but this brings me step closer to getting graalvm 20 to compile on nixpkgs.
Preface: plz help and/or look over, I've been struggling with this for few days.I've been able to build openjdk8 statically with patches pointed out here graalvm/openjdk8-jvmci-builder#11 (comment) I've been successfull with both musl and gcc (I think I'll be focusing on gcc since the official CE is distributed with gcc, but this could be irrelevant).Ending with the same error over and over[deleted]
Motivation for this change
As part of upgrading graalvm8, I will need to use statically compiled openjdk8 as basis for jvmci8 to build native-image/substratevm. I believe the same applies for openjdk11, but I haven't reached that far yet.
Things done
Added optional attribute "static" to openjdk8
Added patches needed to compile statically in gcc and musl (gcc should work fine as I write this, musl I haven't tested for few days, darwin-clang I never tried so far).
Bumped openjdk8 and adoptjdk-bin both to
252-b09
Tested using sandboxing (nix.useSandbox on NixOS, or option
sandbox
innix.conf
on non-NixOS linux)Built on platform(s)
Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
Tested compilation of all pkgs that depend on this change using
nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
Tested execution of all binary files (usually in
./result/bin/
)Determined the impact on package closure size (by running
nix path-info -S
before and after)Ensured that relevant documentation is up to date
Fits CONTRIBUTING.md.