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

openjdk15-bootstrap: fix i686 build #101474

Merged
merged 2 commits into from Jan 27, 2021
Merged

Conversation

@B4dM4n
Copy link
Contributor

@B4dM4n B4dM4n commented Oct 23, 2020

Motivation for this change

The following tests are currently blocked, because openjdk14 fail to build on i686-linux:

This happens because of an incompatibility of older openjdk versions used during bootstrap with gmumake-4.3 ( upstream issue ). Newer version of openjdk already include the used patch.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • 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.
@andir
Copy link
Member

@andir andir commented Oct 23, 2020

Just tried to build this via pkgsi686Linux.openjdk14 but the build is failing like this:

=== Output from failing command(s) repeated here ===
* For target jdk_modules_java.xml__the.java.xml_batch:
* For target jdk_modules_jdk.compiler__the.jdk.compiler_batch:
* For target jdk_modules_jdk.localedata__the.jdk.localedata_batch:
* For target jdk_modules_jdk.scripting.nashorn__the.jdk.scripting.nashorn_batch:
* For target jdk_modules_jdk.security.auth__the.jdk.security.auth_batch:
IOException caught during compilation: Connection reset
* For target support_docs__javadoc_JDK_API_exec:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xf7505503, pid=4876, tid=6220
#
# JRE version: OpenJDK Runtime Environment (12.0.2) (build 12.0.2+0-adhoc..jdk12u-jdk-12.0.2-ga)
# Java VM: OpenJDK Server VM (12.0.2+0-adhoc..jdk12u-jdk-12.0.2-ga, mixed mode, tiered, g1 gc, linux-x86)
# Problematic frame:
# V  [libjvm.so+0x5f3503]  HeapRegion::block_size(HeapWord const*) const+0x113
#
# Core dump will be written. Default location: Core dumps may be processed with "/nix/store/f6r3yar1zx1zrll52wmf300h8k8gibk8-systemd-246/lib/systemd/systemd-coredump %P %u %g %s %t %c %h" (or dumping to /build/jdk13u-jdk-13.0.2-ga/make/core.4876)
#
   ... (rest of output omitted)

* All command lines available in /build/jdk13u-jdk-13.0.2-ga/build/linux-x86-server-release/make-support/failure-logs.
=== End of repeated output ===

No indication of failed target found.
Hint: Try searching the build log for '] Error'.
Hint: See doc/building.html#troubleshooting for assistance.

make[1]: *** [/build/jdk13u-jdk-13.0.2-ga/make/Init.gmk:312: main] Error 2
make: *** [/build/jdk13u-jdk-13.0.2-ga/make/Init.gmk:186: all] Error 2
builder for '/nix/store/k1a4cb64ym78ykx3hgm52nmlkvxdp3fw-openjdk-headless-13.0.2-ga.drv' failed with exit code 2
cannot build derivation '/nix/store/rqvl0h51v0ysgixpclz0s629dl0ycgf6-openjdk-14.0.2-ga.drv': 1 dependencies couldn't be built
error: build of '/nix/store/rqvl0h51v0ysgixpclz0s629dl0ycgf6-openjdk-14.0.2-ga.drv' failed

@B4dM4n
Copy link
Contributor Author

@B4dM4n B4dM4n commented Oct 24, 2020

That's strange. I did a rebuild of /nix/store/k1a4cb64ym78ykx3hgm52nmlkvxdp3fw-openjdk-headless-13.0.2-ga.drv on two machines and both succeeded.

$ nix build --no-link --rebuild /nix/store/k1a4cb64ym78ykx3hgm52nmlkvxdp3fw-openjdk-headless-13.0.2-ga.drv
error: --- Error -------------------------------------------------------------------- nix
derivation '/nix/store/k1a4cb64ym78ykx3hgm52nmlkvxdp3fw-openjdk-headless-13.0.2-ga.drv' may not be deterministic: output '/nix/store/i8ic64dd5b3318n0jkr064gpap5z90sp-openjdk-headless-13.0.2-ga-debug' differs

k1a4cb64ym78ykx3hgm52nmlkvxdp3fw-openjdk-headless-13.0.2-ga.drv.log

@Ekleog
Copy link
Member

@Ekleog Ekleog commented Jan 23, 2021

OpenJDK 14 is no longer in nixpkgs unstable. Is this still required for other newer versions of openjdk, maybe?

@B4dM4n B4dM4n force-pushed the openjdk14-i686-build branch from 14e6627 to be4763a Jan 24, 2021
@B4dM4n B4dM4n changed the title openjdk14: fix i686 bootstrap build openjdk15-bootstrap: fix i686 build Jan 24, 2021
@B4dM4n
Copy link
Contributor Author

@B4dM4n B4dM4n commented Jan 24, 2021

Yes, this is still needed. The tests mentioned above are still failing.

I took another go at building the packages and now also got similar segfaults as @andir.

The issue seems to be the used gcc version. I tried it with gcc 8, 9 and 10, and only the gcc8 build succeeds. When looking at the Debian build of openjdk-12, they also use at most gcc8, so I switch the opendk-12 build to gcc8Stdenv.

@andir Can you please try to build the new version with gcc8 again?

@Ekleog
Copy link
Member

@Ekleog Ekleog commented Jan 24, 2021

Thank you for the update!

FWIW, here is how things eventually fail here (x86_64 system), running nix-build -E 'let pkgs = import ./. { overlays = []; }; in pkgs.pkgsi686Linux.openjdk15 while at the root of nixpkgs at commit be4763a (current tip of your branche) — similar things happen when I try pkgsi686Linux.nixosTests.gerrit, which appears to have the same list of to-build derivations:

g++ -std=gnu++98 -fno-PIE -c   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc-8.4.0/gcc -I../../gcc-8.4.0/gcc/. -I../../gcc-8.4.0/gcc/../include -I../../gcc-8.4.0/gcc/../libcpp/include -I/nix/store/cjavgfszkgqi323khmil471q7ixk19p3-gmp-6.2.1-dev/include -I/nix/store/xl28qirdv9z6wvv8grhryyay22hjnkpp-mpfr-4.1.0-dev/include -I/nix/store/klzzqwpms24jd778slylz0hjng0lqlkj-libmpc-1.2.0/include  -I../../gcc-8.4.0/gcc/../libdecnumber -I../../gcc-8.4.0/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc-8.4.0/gcc/../libbacktrace -I/nix/store/bcsl8r9pzqiwk2959kaszdqj4dwsckyw-isl-0.17.1/include  -o ree.o -MT ree.o -MMD -MP -MF ./.deps/ree.TPo ../../gcc-8.4.0/gcc/ree.c

ERROR: Build failed for target 'all' in configuration 'linux-x86-normal-server-release' (exit code 2)
Stopping sjavac server
g++ -std=gnu++98 -fno-PIE -c   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc-8.4.0/gcc -I../../gcc-8.4.0/gcc/. -I../../gcc-8.4.0/gcc/../include -I../../gcc-8.4.0/gcc/../libcpp/include -I/nix/store/cjavgfszkgqi323khmil471q7ixk19p3-gmp-6.2.1-dev/include -I/nix/store/xl28qirdv9z6wvv8grhryyay22hjnkpp-mpfr-4.1.0-dev/include -I/nix/store/klzzqwpms24jd778slylz0hjng0lqlkj-libmpc-1.2.0/include  -I../../gcc-8.4.0/gcc/../libdecnumber -I../../gcc-8.4.0/gcc/../libdecnumber/bid -I../libdecnumber -I../../gcc-8.4.0/gcc/../libbacktrace -I/nix/store/bcsl8r9pzqiwk2959kaszdqj4dwsckyw-isl-0.17.1/include  -o inchash.o -MT inchash.o -MMD -MP -MF ./.deps/inchash.TPo ../../gcc-8.4.0/gcc/inchash.c

=== Output from failing command(s) repeated here ===
* For target buildtools_tools_jigsaw_classes__the.BUILD_JIGSAW_TOOLS_batch:
Connection attempt failed: Connection refused (Connection refused)
Connection attempt failed: Connection refused (Connection refused)
Connection attempt failed: Connection refused (Connection refused)
Giving up
IOException caught during compilation: Could not connect to server

* All command lines available in /build/source/build/linux-x86-normal-server-release/make-support/failure-logs.
=== End of repeated output ===

No indication of failed target found.
Hint: Try searching the build log for '] Error'.
Hint: See doc/building.html#troubleshooting for assistance.

make[1]: *** [/build/source/make/Init.gmk:305: main] Error 2
make: *** [/build/source/make/Init.gmk:186: all] Error 2
builder for '/nix/store/h79dsv5c8i12rpwkfk1h4nbgjb6ss20v-openjdk-headless-11.0.9+11.drv' failed with exit code 2
cannot build derivation '/nix/store/akfp4jrhw77ypm9dkk69990lk2f94j35-openjfx-modular-sdk-15.0.1+1.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/jfdil4pribhqmpii5wkcnk8qcw3wnikx-openjdk-15.0.1-ga.drv': 1 dependencies couldn't be built
error: build of '/nix/store/jfdil4pribhqmpii5wkcnk8qcw3wnikx-openjdk-15.0.1-ga.drv' failed

So it actually fails building openjdk11. Maybe openjdk11 would require the same gcc8 override? That said, it could maybe also be due to my computer not having enough RAM to compile openjdk… though I haven't seen an OOM message in my logs so that'd be surprising.

Do you know of an x86_64 system where the above-listed nix-build command works?

@ofborg ofborg bot requested a review from abbradar Jan 26, 2021
@B4dM4n
Copy link
Contributor Author

@B4dM4n B4dM4n commented Jan 26, 2021

Just noticed that I missed the openjfx15 commit to pull the correct dependency. It's required to build openjdk15, but not openjdk15_headless.

FWIW, here is how things eventually fail here (x86_64 system), running nix-build -E 'let pkgs = import ./. { overlays = []; }; in pkgs.pkgsi686Linux.openjdk15 while at the root of nixpkgs at commit be4763a (current tip of your branche) — similar things happen when I try pkgsi686Linux.nixosTests.gerrit, which appears to have the same list of to-build derivations:

With that commit in place your build command is fine and builds all jdks for me:

$ nix-build -E 'let pkgs = import ./. { overlays = []; }; in pkgs.pkgsi686Linux.openjdk15'
/nix/store/nryhys2rsqnfr8s4qix68z4pl64qfqc5-openjdk-15.0.1-ga

So it actually fails building openjdk11. Maybe openjdk11 would require the same gcc8 override? That said, it could maybe also be due to my computer not having enough RAM to compile openjdk… though I haven't seen an OOM message in my logs so that'd be surprising.

Your build log does not mention any compile errors in it's output. The segfaults I was getting are reported pretty clearly, like the error log above. So the build build might have been killed/died due to resource exhaustion (disk space, RAM). I tested the openjdk11 build again on three different machines (all with 8GB+ available RAM for the build) and they all succeeded.

nix build --rebuild /nix/store/h79dsv5c8i12rpwkfk1h4nbgjb6ss20v-openjdk-headless-11.0.9+11.drv
error: --- Error -------------------------------------------------------------------------------------------------------- nix
derivation '/nix/store/h79dsv5c8i12rpwkfk1h4nbgjb6ss20v-openjdk-headless-11.0.9+11.drv' may not be deterministic: output '/nix/store/z6l51v5nvm4k05n2407mc600sxcd0rvw-openjdk-headless-11.0.9+11' differs

So I'm not sure what caused the build to fail for you 🤔

@Ekleog
Copy link
Member

@Ekleog Ekleog commented Jan 26, 2021

Cool, thank you for your feedback! I'd say it's probably just my computer not having enough RAM indeed… let's try to build on ofborg instead :)

@ofborg build pkgsi686Linux.openjdk15

Ekleog
Ekleog approved these changes Jan 26, 2021
Copy link
Member

@Ekleog Ekleog left a comment

BTW, r+ing the changes as they currently are, hoping that ofborg can confirm this is green to land

@Ekleog
Copy link
Member

@Ekleog Ekleog commented Jan 27, 2021

Looks like ofborg successfully built it! Merging this PR, thank you :)

@Ekleog Ekleog merged commit 951363f into NixOS:master Jan 27, 2021
21 of 22 checks passed
@B4dM4n B4dM4n deleted the openjdk14-i686-build branch Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants