I am building LLVM (the most recent main branch) using Bazel on my M1 MacBook Pro using the generic_clang
build configuration.
- Chip: Apple M1 Max
- macOS: Ventura 13.0.1
- Xcode version: 14.1 (14B47b)
- MacOS SDK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk
After applying the trick as described in this issue comment, bazel building can keep running until the following error.
(base) ✘-INT ~/w/llvm-project/utils/bazel [main ↓·6|✚ 1]
19:37 $ USE_BAZEL_VERSION=5.0.0 /opt/homebrew/bin/bazel build --config=generic_clang @llvm-project//... --sandbox_debug
INFO: Build options --host_linkopt and --linkopt have changed, discarding analysis cache.
INFO: Analyzed 3731 targets (0 packages loaded, 21793 targets configured).
INFO: Found 3731 targets...
ERROR: /private/var/tmp/_bazel_y/8c037591f8528cb3cd2621d674d2347d/external/llvm-project/libc/BUILD.bazel:1369:14: Compiling libc/src/unistd/linux/ftruncate.cpp failed: (Aborted): sandbox-exec failed: error executing command
(cd /private/var/tmp/_bazel_y/8c037591f8528cb3cd2621d674d2347d/sandbox/darwin-sandbox/5464/execroot/__main__ && \
exec env - \
APPLE_SDK_PLATFORM=MacOSX \
APPLE_SDK_VERSION_OVERRIDE=13.0 \
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
PATH=/Users/y/Library/Caches/bazelisk/downloads/bazelbuild/bazel-5.0.0-darwin-arm64/bin:/usr/local/bin:/Users/y/.cargo/bin:/opt/homebrew/opt/python@3.9/libexec/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/y/anaconda3/bin:/Users/y/anaconda3/condabin:/opt/homebrew/opt/python@3.9/libexec/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:/Users/y/bin \
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk \
TMPDIR=/var/folders/hd/6q8jftdn7b1fygsrzdkp5ww40000gn/T/ \
XCODE_VERSION_OVERRIDE=14.1.0.14B47b \
ZERO_AR_DATE=1 \
/usr/bin/sandbox-exec -f /private/var/tmp/_bazel_y/8c037591f8528cb3cd2621d674d2347d/sandbox/darwin-sandbox/5464/sandbox.sb /var/tmp/_bazel_y/install/c8706c49991751b43417f135b97a0616/process-wrapper '--timeout=0' '--kill_delay=15' external/local_config_cc/wrapped_clang_pp '-D_FORTIFY_SOURCE=1' -fstack-protector -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign -fno-omit-frame-pointer -O0 -DDEBUG '-std=c++11' 'DEBUG_PREFIX_MAP_PWD=.' -iquote external/llvm-project -iquote bazel-out/darwin_arm64-fastbuild/bin/external/llvm-project -isystem external/llvm-project/libc -isystem bazel-out/darwin_arm64-fastbuild/bin/external/llvm-project/libc -MD -MF bazel-out/darwin_arm64-fastbuild/bin/external/llvm-project/libc/_objs/ftruncate.__internal__/ftruncate.pic.d -fPIC '-frandom-seed=bazel-out/darwin_arm64-fastbuild/bin/external/llvm-project/libc/_objs/ftruncate.__internal__/ftruncate.pic.o' -isysroot __BAZEL_XCODE_SDKROOT__ -F__BAZEL_XCODE_SDKROOT__/System/Library/Frameworks -F__BAZEL_XCODE_DEVELOPER_DIR__/Platforms/MacOSX.platform/Developer/Library/Frameworks '-mmacosx-version-min=13.0' -no-canonical-prefixes -pthread -Wall -Wno-deprecated '-std=c++17' -Wno-range-loop-analysis -O3 -fno-builtin -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -target arm64-apple-macosx -c external/llvm-project/libc/src/unistd/linux/ftruncate.cpp -o bazel-out/darwin_arm64-fastbuild/bin/external/llvm-project/libc/_objs/ftruncate.__internal__/ftruncate.pic.o)
external/llvm-project/libc/src/unistd/linux/ftruncate.cpp:21:26: error: no member named 'syscall_impl' in namespace '__llvm_libc'
int ret = __llvm_libc::syscall_impl(SYS_ftruncate, fd, len);
~~~~~~~~~~~~~^
1 error generated.
Error in child process '/usr/bin/xcrun'. 1
INFO: Elapsed time: 496.885s, Critical Path: 45.82s
INFO: 4842 processes: 755 internal, 4087 darwin-sandbox.
FAILED: Build did NOT complete successfully