Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update Bazel to 6.4.0 #2063

Merged
merged 9 commits into from
Dec 18, 2023
Merged

Update Bazel to 6.4.0 #2063

merged 9 commits into from
Dec 18, 2023

Conversation

avdv
Copy link
Member

@avdv avdv commented Nov 30, 2023

  • update nixpkgs to nixos-23.11 which was released yesterday
  • fix links in README and docs
  • note that Bazel >= 6.0 is required in the README

@avdv avdv force-pushed the upgrade-bazel-6.4.0 branch from 2283d88 to 59a510e Compare November 30, 2023 09:52
@avdv
Copy link
Member Author

avdv commented Nov 30, 2023

It seems like the fix for NixOS/nixpkgs#269297 did not make it to the nixos-23.11 release and the nixpkgs CI jobs on Darwin fail with:

ERROR: Could not build Bazel
error: builder for '/nix/store/kcw86hxcg3b6zzbdjfq9n6lhbgf94sy5-bazel-6.4.0.drv' failed with exit code 1;
       last 10 log lines:
       > external/upb/upb/port_def.inc:93:58: note: expanded from macro 'UPB_ALIGN_DOWN'
       > #define UPB_ALIGN_DOWN(size, align) ((size) / (align) * (align))
       >                                                          ^~~~~
       > 2 errors generated.
       > Target //src:bazel_nojdk failed to build
       > INFO: Elapsed time: 284.208s, Critical Path: 68.41s

This ☝️ is solved. Now, bazel_6 crashes on darwin:

copying path '/nix/store/x524hsnfw74p91d55c7i1d8dgmz9s8im-bazel-6.4.0' from 'https://cache.nixos.org/'...
copying path '/nix/store/v4ppw8iwgjw0jif8n08xkxlyllqji8w2-go-1.21.4' from 'https://cache.nixos.org/'...
Extracting Bazel installation...
Starting local Bazel server and connecting to it...
INFO: Reading 'startup' options from /nix/store/9xhxqljd4749b32nbf20qkchp1drc4a7-bazel-rc: --server_javabase=/nix/store/wsdrnfbb87g2qfag3g69np6firp6mgys-zulu11.66.15-ca-jdk-11.0.20
INFO: Reading 'startup' options from /Users/runner/work/rules_haskell/rules_haskell/.bazelrc.common: --host_jvm_args=-Djdk.tls.client.protocols=TLSv1.2
Server crashed during startup. Now printing /private/var/tmp/_bazel_runner/d1e3bdaa0c37ce8d00ecff62b05849c3/server/jvm.out
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000000000000, pid=2056, tid=5635
#
# JRE version: OpenJDK Runtime Environment Zulu11.66+15-CA (11.0.20+8) (build 11.0.20+8-LTS)
# Java VM: OpenJDK 64-Bit Server VM Zulu11.66+15-CA (11.0.20+8-LTS, mixed mode, tiered, compressed oops, g1 gc, bsd-amd64)
# Problematic frame:
# C  0x0000000000000000
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/runner/work/rules_haskell/rules_haskell/hs_err_pid2056.log
#
# If you would like to submit a bug report, please visit:
#   http://www.azul.com/support/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Error: Process completed with exit code 37.

Here's the java crash file: https://gist.github.com/avdv/019d5453187daecf13819de1a3148d4d

Note: created a new issue NixOS/nixpkgs#273745

@avdv avdv marked this pull request as draft November 30, 2023 10:44
@avdv avdv force-pushed the upgrade-bazel-6.4.0 branch 2 times, most recently from d5c0b93 to 7c6c280 Compare December 12, 2023 08:45
@avdv avdv self-assigned this Dec 13, 2023
@avdv
Copy link
Member Author

avdv commented Dec 13, 2023

macos CI jobs are now failing with:

ar: @../../../bazel-out/darwin-fastbuild/bin/external/_main~stack_snapshot~stackage/primitive-0.7.3.0/primitive-0.7.3.0/build/objs-6725/ar6725-2.rsp: No such file or directory

which is related to #2070

@avdv avdv force-pushed the upgrade-bazel-6.4.0 branch from 1c3df86 to 80c8527 Compare December 13, 2023 14:14
avdv added 8 commits December 18, 2023 15:16
* users need Bazel >= 6.0
* replace old getting started link which redirects to the "Contributing to Bazel" page
- bump max Bazel version in start script
- use Bazel 6.4.0 for integration tests
- remove Bazel 6.2.0 from integration test
This avoids a SIGSEGV for bazel_6 from nixpkgs, see NixOS/nixpkgs#273745.
Downloading from https://hackage.haskell.org/ would otherwise fail with:
```
HttpExceptionRequest Request {
  host                 = "hackage.haskell.org"
  port                 = 443
  secure               = True
  requestHeaders       = [("Accept-Encoding",""),("User-Agent","Haskell pantry package")]
  path                 = "/root.json"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
  proxySecureMode      = ProxySecureWithConnect
}
 (InternalException (HandshakeFailed (Error_Protocol "certificate rejected: security: createProcess: posix_spawnp: does not exist (No such file or directory)" CertificateUnknown)))
```
See commercialhaskell/stack#4558
When using nix we cannot use the system ar tool since it might have a different
interface (ie. is assumed to support response files) than the nix provided one.

The bintools packages provides `libtool` and `ar` in its `bin/` folder.
This avoids an error when compiling zlib with ISO C99 conforming compilers:
```
external/zlib.hs/gzwrite.c:78:20: error: call to undeclared function 'write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
            writ = write(state->fd, strm->next_in, put);
                   ^
external/zlib.hs/gzwrite.c:78:20: note: did you mean 'fwrite'?
/nix/store/51c1k4sj0irwgyvkgbyhqi0ggilyh3j2-Libsystem-1238.60.2/include/stdio.h:254:9: note: 'fwrite' declared here
size_t   fwrite(const void * __restrict __ptr, size_t __size, size_t __nitems, FILE * __restrict __stream) __DARWIN_ALIAS(fwrite);
         ^
external/zlib.hs/gzwrite.c:108:24: error: call to undeclared function 'write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                writ = write(state->fd, state->x.next, put);
                       ^
external/zlib.hs/gzwrite.c:627:9: error: call to undeclared function 'close'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    if (close(state->fd) == -1)
        ^
3 errors generated.
```
@avdv avdv force-pushed the upgrade-bazel-6.4.0 branch from 68b53fd to d927ace Compare December 18, 2023 14:16
@avdv avdv marked this pull request as ready for review December 18, 2023 15:04
@avdv avdv requested a review from aherrmann December 18, 2023 15:04
Copy link
Member

@aherrmann aherrmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Looks good!

```
clang: warning: argument unused during compilation: '-no-pie' [-Wunused-command-line-argument]
tests/haskell_doctest/Bar.hs:11: failure in expression `bar'
expected: 9
 but got: ld: warning: -undefined dynamic_lookup may not work with chained fixups
          ^
          9
Examples: 3  Tried: 2  Errors: 0  Failures: 1
```
If the linker writes some output to stderr, this interferes with the expected output
in the doctest. Note, that if the linker fails, the output will be written to stdout/stderr
in any case.
@avdv avdv force-pushed the upgrade-bazel-6.4.0 branch from d927ace to 6e9f843 Compare December 18, 2023 16:39
@avdv avdv added the merge-queue merge on green CI label Dec 18, 2023
@mergify mergify bot merged commit 1b476c3 into master Dec 18, 2023
49 checks passed
@mergify mergify bot deleted the upgrade-bazel-6.4.0 branch December 18, 2023 19:02
@mergify mergify bot removed the merge-queue merge on green CI label Dec 18, 2023
@avdv avdv linked an issue Jan 2, 2024 that may be closed by this pull request
@avdv avdv mentioned this pull request Jan 2, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to Bazel 6.4
2 participants