Skip to content

Instantly share code, notes, and snippets.

@prednaz
Last active April 4, 2024 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prednaz/f2953e2b2f2161e23ca32b803c3a154f to your computer and use it in GitHub Desktop.
Save prednaz/f2953e2b2f2161e23ca32b803c3a154f to your computer and use it in GitHub Desktop.
[nix-shell:~/tweag/nix_bazel_codelab]$ bazel build //java/src/main/java/bazel/bootcamp:HelloBazelBootcamp 
WARNING: Build option --extra_toolchains has changed, discarding analysis cache (this can be expensive, see https://bazel.build/advanced/performance/iteration-speed).
ERROR: /home/rednaz/.cache/bazel/_bazel_rednaz/4416c53fc376f6850591c05e606de763/external/rules_java~7.5.0~toolchains~local_jdk/BUILD.bazel:2:10: in fail_rule rule @@rules_java~7.5.0~toolchains~local_jdk//:jdk: 
Traceback (most recent call last):
        File "/home/rednaz/.cache/bazel/_bazel_rednaz/4416c53fc376f6850591c05e606de763/external/rules_java~7.5.0/toolchains/fail_rule.bzl", line 19, column 13, in _fail_rule_impl
                fail("%s %s" % (ctx.attr.header, ctx.attr.message))
Error in fail: Auto-Configuration Error: Cannot find Java binary bin/java in /home/rednaz/.cache/bazel/_bazel_rednaz/4416c53fc376f6850591c05e606de763/external/rules_java~7.5.0~toolchains~local_jdk/nosystemjdk; either correct your JAVA_HOME, PATH or specify Java from remote repository (e.g. --java_runtime_version=remotejdk_11)
ERROR: /home/rednaz/.cache/bazel/_bazel_rednaz/4416c53fc376f6850591c05e606de763/external/rules_java~7.5.0~toolchains~local_jdk/BUILD.bazel:2:10: Analysis of target '@@rules_java~7.5.0~toolchains~local_jdk//:jdk' failed
ERROR: Analysis of target '//java/src/main/java/bazel/bootcamp:HelloBazelBootcamp' failed; build aborted: Analysis failed
INFO: Elapsed time: 0.093s, Critical Path: 0.00s
INFO: 1 process: 1 internal.
ERROR: Build did NOT complete successfully

[nix-shell:~/tweag/nix_bazel_codelab]$ # added `startup --nosystem_rc` to the beginning of `.bazelrc`

[nix-shell:~/tweag/nix_bazel_codelab]$ bazel build //java/src/main/java/bazel/bootcamp:HelloBazelBootcamp 
INFO: Reading 'startup' options from /nix/store/cxjc7filv802s5ws35hga85wy5pbxz3l-bazel-rc: --server_javabase=/nix/store/ksxp6l73r6m48p1mgf43rcr6agp4yci9-openjdk-headless-17.0.7+7
INFO: Reading 'startup' options from /home/rednaz/tweag/nix_bazel_codelab/.bazelrc: --nosystem_rc
[INFO 13:32:03.854 src/main/cpp/option_processor.cc:407] Looking for the following rc files: /nix/store/cxjc7filv802s5ws35hga85wy5pbxz3l-bazel-rc,/home/rednaz/tweag/nix_bazel_codelab/.bazelrc,/home/rednaz/.bazelrc
[INFO 13:32:03.854 src/main/cpp/rc_file.cc:56] Parsing the RcFile /nix/store/cxjc7filv802s5ws35hga85wy5pbxz3l-bazel-rc
[INFO 13:32:03.854 src/main/cpp/rc_file.cc:56] Parsing the RcFile /etc/bazel.bazelrc
[INFO 13:32:03.854 src/main/cpp/rc_file.cc:131] Skipped optional import of /etc/bazel.bazelrc, the specified rc file either does not exist or is not readable.
[INFO 13:32:03.854 src/main/cpp/rc_file.cc:56] Parsing the RcFile /home/rednaz/tweag/nix_bazel_codelab/.bazelrc
[INFO 13:32:03.854 src/main/cpp/rc_file.cc:56] Parsing the RcFile /home/rednaz/tweag/nix_bazel_codelab/.bazelrc.local
[INFO 13:32:03.854 src/main/cpp/rc_file.cc:131] Skipped optional import of /home/rednaz/tweag/nix_bazel_codelab/.bazelrc.local, the specified rc file either does not exist or is not readable.
[FATAL 13:32:03.854 src/main/cpp/blaze.cc:1102] Can't specify --nosystem_rc in the .bazelrc file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment