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

bazel: Set a sensible strict action environment. #43530

Merged
merged 2 commits into from Jul 19, 2018

Conversation

mboes
Copy link
Contributor

@mboes mboes commented Jul 14, 2018

Bazel either reuses the PATH from the client, or sets a hardcoded
one. The former mode in problematic for build hermeticity. But the
latter is crippled on NixOS, because the hardcoded value is
/bin:/usr/bin. So we set the hardcoded value to match what
customBash provides. This has the effect of aligning the
environments for ctx.actions.run and ctx.actions.run_shell, which
were previously distinct (bug).

cc @uri-canva

@Profpatsch
Copy link
Member

@GrahamcOfBorg build bazel

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: bazel

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: bazel

Partial log (click to expand)

./tools/test/collect_coverage.sh: interpreter directive changed from "/bin/bash -x" to "/nix/store/6ylxcy8rr5ssyqfwk7k8hmjywl6c5jvw-bash/bin/bash -x"
./tools/test/test-setup.sh: interpreter directive changed from "/bin/bash" to "/nix/store/6ylxcy8rr5ssyqfwk7k8hmjywl6c5jvw-bash/bin/bash"
configuring
no configure script, doing nothing
building
Building Bazel from scratch....../usr/bin/xcrun clang -fobjc-arc -framework CoreServices -framework Foundation -o /tmp/.bazel-30001/bazel_KBMOqhi6/archive/_embedded_binaries/xcode-locator tools/osx/xcode_locator.m
xcode-select: error: no developer tools were found at '/Applications/Xcode.app', and no install could be requested (perhaps no UI is present), please install manually from 'developer.apple.com'.
/nix/store/7amnc2662p390bgzj6c0snylj19vxmj2-stdenv-darwin/setup: line 1291: ./output/bazel: No such file or directory
builder for '/nix/store/5vyr0l003nfqpkqrnjjb31k0n731qd4z-bazel-0.13.0.drv' failed with exit code 127
�[31;1merror:�[0m build of '/nix/store/5vyr0l003nfqpkqrnjjb31k0n731qd4z-bazel-0.13.0.drv' failed

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: bazel

Partial log (click to expand)

src/main/cpp/blaze_util_posix.cc: In function 'uint64_t blaze::AcquireLock(const string&, bool, bool, blaze::BlazeLock*)':
src/main/cpp/blaze_util_posix.cc:667:3: warning: ignoring return value of 'int ftruncate(int, __off_t)', declared with attribute warn_unused_result [-Wunused-result]
   (void) ftruncate(lockfd, 0);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main/cpp/blaze_util_posix.cc: At global scope:
src/main/cpp/blaze_util_posix.cc:404:15: warning: 'std::__cxx11::string blaze::RunProgram(const string&, const std::vector<std::__cxx11::basic_string<char> >&)' defined but not used [-Wunused-function]
 static string RunProgram(const string& exe,
               ^~~~~~~~~~
building of ‘/nix/store/hbcq8a1nkqi509skcjdpck4di0cyn9n8-bazel-0.13.0.drv’ timed out after 1800 seconds
error: build of ‘/nix/store/hbcq8a1nkqi509skcjdpck4di0cyn9n8-bazel-0.13.0.drv’ failed

@Profpatsch
Copy link
Member

Rebased to master.

@GrahamcOfBorg build bazel

@GrahamcOfBorg
Copy link

No attempt on x86_64-linux (full log)

The following builds were skipped because they don't evaluate on x86_64-linux: bazel

Partial log (click to expand)

Cannot nix-instantiate `bazel' because:
GC Warning: Failed to expand heap by 10737418240 bytes
Can't start up: not enough memory

@Profpatsch
Copy link
Member

Retriggering because of memory failure
@GrahamcOfBorg build bazel

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: bazel

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnfree = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnfree = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

No attempt on x86_64-linux (full log)

The following builds were skipped because they don't evaluate on x86_64-linux: bazel

Partial log (click to expand)

Cannot nix-instantiate `bazel' because:
GC Warning: Failed to expand heap by 10737418240 bytes
Can't start up: not enough memory

@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: bazel

Partial log (click to expand)

building '/nix/store/b1x1yflwkw15hwvnypqwbj6fjlnc4r1d-bazel-0.15.1.drv'...
unpacking sources
unpacking source archive /nix/store/62081xrk8ipgcj9a0xm8dvcpk657sjfg-bazel-0.15.1-dist.zip
source root is .
setting SOURCE_DATE_EPOCH to timestamp 1531925814 of file ./.sandbox.sb
warning: file ./.sandbox.sb may be generated; SOURCE_DATE_EPOCH may be non-deterministic
patching sources
substitute(): ERROR: file 'src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java' does not exist
builder for '/nix/store/b1x1yflwkw15hwvnypqwbj6fjlnc4r1d-bazel-0.15.1.drv' failed with exit code 1
�[31;1merror:�[0m build of '/nix/store/b1x1yflwkw15hwvnypqwbj6fjlnc4r1d-bazel-0.15.1.drv' failed

@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: hello

Partial log (click to expand)

/nix/store/l51wb4n37sslmchg9ncb8v0mcgqxwfz1-hello-2.10

@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@Profpatsch
Copy link
Member

once more
@GrahamcOfBorg build bazel

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: bazel

Partial log (click to expand)

copying path '/nix/store/1vmpmfr713fpp8pwvpfqvibhy2hz0dmw-openjdk-8u172b11' from 'https://cache.nixos.org'...
building '/nix/store/f78ywnwf78ihvncn6hd4s9iyl76crs8n-bazel-0.15.1.drv'...
unpacking sources
unpacking source archive /nix/store/62081xrk8ipgcj9a0xm8dvcpk657sjfg-bazel-0.15.1-dist.zip
source root is .
setting SOURCE_DATE_EPOCH to timestamp 315532800 of file ./tools/zip/BUILD.tools
patching sources
substitute(): ERROR: file 'src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java' does not exist
builder for '/nix/store/f78ywnwf78ihvncn6hd4s9iyl76crs8n-bazel-0.15.1.drv' failed with exit code 1
error: build of '/nix/store/f78ywnwf78ihvncn6hd4s9iyl76crs8n-bazel-0.15.1.drv' failed

@Profpatsch
Copy link
Member

Ah, the string moved to BazelRuleClassProvider.java in the same folder.

Bazel either reuses the `PATH` from the client, or sets a hardcoded
one. The former mode in problematic for build hermeticity. But the
latter is crippled on NixOS, because the hardcoded value is
`/bin:/usr/bin`. So we set the hardcoded value to match what
`customBash` provides. This has the effect of aligning the
environments for `ctx.actions.run` and `ctx.actions.run_shell`, which
were previously distinct (bug).
@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@Profpatsch
Copy link
Member

One more time!
@GrahamcOfBorg build bazel

@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@NixOS NixOS deleted a comment from GrahamcOfBorg Jul 18, 2018
@GrahamcOfBorg
Copy link

Failure on x86_64-darwin (full log)

Attempted: bazel

Partial log (click to expand)

./tools/test/collect_coverage.sh: interpreter directive changed from "/bin/bash -x" to "/nix/store/4b394rnkm139ykzzhgl453g7pwj2wh8v-bash/bin/bash -x"
./tools/test/test-setup.sh: interpreter directive changed from "/bin/bash" to "/nix/store/4b394rnkm139ykzzhgl453g7pwj2wh8v-bash/bin/bash"
configuring
no configure script, doing nothing
building
Building Bazel from scratch....../usr/bin/xcrun clang -fobjc-arc -framework CoreServices -framework Foundation -o /tmp/.bazel-30001/bazel_WbI8Um1G/archive/_embedded_binaries/xcode-locator tools/osx/xcode_locator.m
xcode-select: error: no developer tools were found at '/Applications/Xcode.app', and no install could be requested (perhaps no UI is present), please install manually from 'developer.apple.com'.
/nix/store/znciimv8frnpfdhqpwc2nmxfgrjvxs1b-stdenv-darwin/setup: line 1291: ./output/bazel: No such file or directory
builder for '/nix/store/pdx5dpdqg9j9vzmbv79zs353jjvgb1bl-bazel-0.15.1.drv' failed with exit code 127
�[31;1merror:�[0m build of '/nix/store/pdx5dpdqg9j9vzmbv79zs353jjvgb1bl-bazel-0.15.1.drv' failed

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: bazel

Partial log (click to expand)

//examples/java-native/src/test/java/com/example/myproject:hello         PASSED in 0.8s

Executed 2 out of 2 tests: 2 tests pass.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
INFO: Build completed successfully, 22 total actions
installing
post-installation fixup
patching script interpreter paths in /nix/store/0xpl3l0mwqshx5hccha77fq88irg6vay-bazel-0.15.1
checking for references to /tmp/.bazel-1000 in /nix/store/0xpl3l0mwqshx5hccha77fq88irg6vay-bazel-0.15.1...
/nix/store/0xpl3l0mwqshx5hccha77fq88irg6vay-bazel-0.15.1

@Profpatsch
Copy link
Member

Finally! \o/

@Profpatsch Profpatsch merged commit c27f686 into NixOS:master Jul 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants