Skip to content

[BUG] Build is broken with Bazel 7.0.0 pre-releases and master builds #1636

@nicholasjng

Description

@nicholasjng

Describe the bug
Google Benchmark does not build anymore on 7.0.0 pre-releases, as well as Bazel builds from source (I used those to test the linker response file stuff).

This is not immediately actionable, but I still wanted to post this in case someone has insights into what is wrong.

The failure:

 ERROR: /Users/nicholasjunge/Workspaces/c++/benchmark/bindings/python/google_benchmark/BUILD:12:13: Linking bindings/python/google_benchmark/_benchmark.so failed: (Exit 1): sandbox-exec failed: error executing CppLink command
        (cd /private/var/tmp/_bazel_nicholasjunge/7931a2ee992544fe3d1024dd6c7623f6/sandbox/darwin-sandbox/62/execroot/com_github_google_benchmark && \
        exec env - \
          PATH=/private/var/folders/rw/mj164vm16k10x_byww6my1s00000gn/T/pip-build-env-d6fa0l9y/overlay/bin:/private/var/folders/rw/mj164vm16k10x_byww6my1s00000gn/T/pip-build-env-d6fa0l9y/normal/bin:/Users/nicholasjunge/Workspaces/c++/benchmark/venv/bin:/Users/nicholasjunge/.docker/bin:/opt/homebrew/opt/llvm/bin:/Users/nicholasjunge/Library/Python/3.9/bin:/opt/homebrew/share/google-cloud-sdk/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Users/nicholasjunge/Workspaces/golang/bin:/opt/homebrew/opt/fzf/bin \
          PWD=/proc/self/cwd \
          TMPDIR=/var/folders/rw/mj164vm16k10x_byww6my1s00000gn/T/ \
          ZERO_AR_DATE=1 \
        /usr/bin/sandbox-exec -f /private/var/tmp/_bazel_nicholasjunge/7931a2ee992544fe3d1024dd6c7623f6/sandbox/darwin-sandbox/62/sandbox.sb /var/tmp/_bazel_nicholasjunge/install/e65ae3b38bd9f831d80b21589a115207/process-wrapper '--timeout=0' '--kill_delay=15' '--stats=/private/var/tmp/_bazel_nicholasjunge/7931a2ee992544fe3d1024dd6c7623f6/sandbox/darwin-sandbox/62/stats.out' external/local_config_cc/cc_wrapper.sh @bazel-out/darwin_arm64-opt/bin/bindings/python/google_benchmark/_benchmark.so-2.params)
      ld64.lld: error: undefined symbol: _Py_Dealloc
      >>> referenced by bazel-out/darwin_arm64-opt/bin/bindings/python/google_benchmark/_objs/_benchmark.so/benchmark.o:(symbol PyInit__benchmark+0x1db8)
      >>> referenced by bazel-out/darwin_arm64-opt/bin/bindings/python/google_benchmark/_objs/_benchmark.so/benchmark.o:(symbol PyInit__benchmark+0x1bd4)
      >>> referenced by bazel-out/darwin_arm64-opt/bin/bindings/python/google_benchmark/_objs/_benchmark.so/benchmark.o:(symbol PyInit__benchmark+0x1a94)
      >>> referenced 198 more times

[...] and many more symbols, all from Python (I think?)

System
Which OS, compiler, and compiler version are you using:

  • OS: MacOS 13.4.1
  • Compiler and version: Homebrew clang version 16.0.6

To reproduce
Steps to reproduce the behavior:

  1. sync to HEAD
  2. Run curl -L -o bazel-7.0.0-pre.20230628.2 https://github.com/bazelbuild/bazel/releases/download/7.0.0-pre.20230628.2/bazel-7.0.0-pre.20230628.2-darwin-arm64 && chmod +x bazel-7.0.0-pre.20230628.2
  3. Change setup.py:L64 to ./bazel-7.0.0-pre.20230628.2 (maybe throw in a sandbox_debug somewhere)
  4. Run python3 -m pip wheel . -w dist

Expected behavior
Everything to build fine.

Additional context
Seems like this has to do with how the Python headers are passed to the linker. I will check if the way that linker deps are passed has changed in newer Bazel.

The build completes perfectly as late as Bazel 6.2.1, so it seems that Bazel 7 contains a breaking change in this regard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions