bazelbuild / bazel

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

macos sequoia bazel c++ not work #23748

Open kekxv opened 1 month ago

kekxv commented 1 month ago

Description of the bug:

INFO: Analyzed 4 targets (93 packages loaded, 485 targets configured).
ERROR: /Volumes/work/clang/bazel-ci-cpp-test/main/BUILD.bazel:3:11: Compiling main/hello-greet.cc failed: (Exit 1): cc_wrapper.sh failed: error executing CppCompile command (from target //main:hello-greet) external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object ... (remaining 21 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from main/hello-greet.cc:1:
./main/hello-greet.h:4:10: fatal error: 'string' file not found
    4 | #include <string>
      |          ^~~~~~~~
1 error generated.
ERROR: /Volumes/work/clang/bazel-ci-cpp-test/lib/BUILD:3:11: Compiling lib/hello-time.cc failed: (Exit 1): cc_wrapper.sh failed: error executing CppCompile command (from target //lib:hello-time) external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object ... (remaining 21 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
lib/hello-time.cc:2:10: fatal error: 'ctime' file not found
    2 | #include <ctime>
      |          ^~~~~~~
1 error generated.
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 3.393s, Critical Path: 0.09s
INFO: 28 processes: 28 internal.
ERROR: Build did NOT complete successfully

Which category does this issue belong to?

C++ Rules, Local Execution

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

$ xcode-select -p
/Library/Developer/CommandLineTools

macos 14 was work.

upgrade system and CommandLineTools not working.

Which operating system are you running Bazel on?

macos sequoia (macos 15)

What is the output of bazel info release?

release 7.3.1

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

No response

If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

zezhehh commented 1 month ago

My bazel is working again after reinstalling Xcode and Command Line Tools

kekxv commented 1 month ago

My bazel is working again after reinstalling Xcode and Command Line Tools

is work for me.

but reinstall Command Line Tools is 15, not 16 .

Maybe Command Line Tools 16 is not supported .

schultetwin commented 1 month ago

Does:

bazel sync --configure

Help?

Bazel caches it's autodetected toolchain from xcode. If you update xcode to a new location, it won't be able to find the same header files anymore.

The above command reruns the toolchain autodetection to detect where xcode is.

There's some more information here for more details: https://github.com/bazelbuild/rules_apple/blob/master/doc/common_info.md#xcode-version-selection-and-invalidation