bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
23.05k stars 4.03k forks source link

remotejdk11_linux's javac does not work on NixOS #10280

Closed suhr closed 1 year ago

suhr commented 4 years ago

How to reproduce:

% export ANDROID_HOME=$HOME/Android/Sdk/
% nix-shell -p python3 openjdk
% bazel build :app

This is the bazel output:

Starting local Bazel server and connecting to it...
INFO: Writing tracer profile to '/home/suhr/.cache/bazel/_bazel_suhr/287e693ea5ce89a552a7ef45d13c27aa/command.profile.gz'
INFO: Analyzed target //:app (73 packages loaded, 975 targets configured).
INFO: Found 1 target...
INFO: Deleting stale sandbox base /home/suhr/.cache/bazel/_bazel_suhr/287e693ea5ce89a552a7ef45d13c27aa/sandbox
ERROR: /home/suhr/.cache/bazel/_bazel_suhr/287e693ea5ce89a552a7ef45d13c27aa/external/bazel_tools/tools/jdk/BUILD:319:1: Action external/bazel_tools/tools/jdk/platformclasspath_classes/DumpPlatformClassPath.class failed (Exit 1) javac failed: error executing command external/remotejdk11_linux/bin/javac -source 8 -target 8 -Xlint:-options -cp external/remotejdk11_linux/lib/tools.jar -d bazel-out/host/bin/external/bazel_tools/tools/jdk/platformclasspath_classes ... (remaining 1 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox
src/main/tools/linux-sandbox-pid1.cc:427: "execvp(external/remotejdk11_linux/bin/javac, 0x94ce70)": No such file or directory
Target //:app failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 14.906s, Critical Path: 0.54s
INFO: 16 processes: 16 linux-sandbox.
FAILED: Build did NOT complete successfully
suhr commented 4 years ago

With some symlinks in /lib64 the issue becomes more clear:

external/remotejdk11_linux/bin/javac: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

It finds out that the prebuilt javac binary expects some shared libraries in FHS locations.

jin commented 4 years ago

This is more of an issue with Bazel not being supported on NixOS officially, and not rules_jvm_external. Transferring over to bazelbuild/bazel.

sgowroji commented 1 year ago

Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so.