Build error in container/internal/layout.h on osx with Bazel 4.2.0 and Xcode 13.1
Describe the bug
external/com_google_absl/absl/container/internal/layout.h:300:15: error: use of undeclared identifier 'abi'
demangled = abi::__cxa_demangle(typeid(T).name(), nullptr, nullptr, &status);
^
1 error generated.
Error in child process '/usr/bin/xcrun'. 1
Steps to reproduce the bug
Sync https://github.com/kythe/kythe
Update the Abseil version and add a rules_cc dependency to external.bzl (262ebec3c2296296526740db4aefce68c80de7fa)
bazelisk build //kythe/cxx/indexer/cxx:indexer
What version of Abseil are you using?
ec0d76f1d012cc1a4b3b08dfafcfc5237f5ba2c9, but this happens in earlier versions.
What operating system and version are you using
macOS Big Sur 11.6
What compiler and version are you using?
Xcode 13.1
Build version 13A1030d
Apple clang version 13.0.0 (clang-1300.0.29.3)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
What build system are you using?
Bazelisk version: development
Build label: 4.2.0
Other details
I definitely suspect I'm holding it wrong, but I'm not sure how.
Can you rebuild with --verbose_failures and post the full compile command-line that fails?
(cd /private/var/tmp/_bazel_user/4047a92cde5c126a2747538e6c63dc38/sandbox/darwin-sandbox/10/execroot/io_kythe && \
exec env - \
APPLE_SDK_PLATFORM=MacOSX \
APPLE_SDK_VERSION_OVERRIDE=12.0 \
PATH=/bin:/usr/bin:/usr/local/bin \
XCODE_VERSION_OVERRIDE=13.1.0.13A1030d \
external/local_config_cc/wrapped_clang '-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 . -iquote bazel-out/darwin-fastbuild/bin -iquote external/com_google_absl -iquote bazel-out/darwin-fastbuild/bin/external/com_google_absl -iquote external/com_github_google_glog -iquote bazel-out/darwin-fastbuild/bin/external/com_github_google_glog -iquote external/llvm-project -iquote bazel-out/darwin-fastbuild/bin/external/llvm-project -iquote external/llvm_terminfo -iquote bazel-out/darwin-fastbuild/bin/external/llvm_terminfo -iquote external/llvm_zlib -iquote bazel-out/darwin-fastbuild/bin/external/llvm_zlib -iquote external/net_zlib -iquote bazel-out/darwin-fastbuild/bin/external/net_zlib -iquote external/org_libmemcached_libmemcached -iquote bazel-out/darwin-fastbuild/bin/external/org_libmemcached_libmemcached -iquote external/com_github_tencent_rapidjson -iquote bazel-out/darwin-fastbuild/bin/external/com_github_tencent_rapidjson -iquote external/com_google_protobuf -iquote bazel-out/darwin-fastbuild/bin/external/com_google_protobuf -iquote external/com_googlesource_code_re2 -iquote bazel-out/darwin-fastbuild/bin/external/com_googlesource_code_re2 -iquote external/boringssl -iquote bazel-out/darwin-fastbuild/bin/external/boringssl -iquote external/org_libzip -iquote bazel-out/darwin-fastbuild/bin/external/org_libzip -Ibazel-out/darwin-fastbuild/bin/external/com_github_google_glog/_virtual_includes/glog -Ibazel-out/darwin-fastbuild/bin/external/llvm-project/clang/_virtual_includes/basic_internal_headers -Ibazel-out/darwin-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/InstCombineTableGen -Ibazel-out/darwin-fastbuild/bin/external/com_google_protobuf/_virtual_includes/any_proto -Ibazel-out/darwin-fastbuild/bin/external/com_google_protobuf/_virtual_includes/timestamp_proto -isystem external/llvm-project/clang/include -isystem bazel-out/darwin-fastbuild/bin/external/llvm-project/clang/include -isystem external/llvm-project/clang/lib/AST -isystem bazel-out/darwin-fastbuild/bin/external/llvm-project/clang/lib/AST -isystem external/llvm-project/clang/lib/AST/Interp -isystem bazel-out/darwin-fastbuild/bin/external/llvm-project/clang/lib/AST/Interp -isystem external/llvm-project/llvm/include -isystem bazel-out/darwin-fastbuild/bin/external/llvm-project/llvm/include -isystem external/net_zlib/zlib/include -isystem bazel-out/darwin-fastbuild/bin/external/net_zlib/zlib/include -isystem external/org_libmemcached_libmemcached/headers -isystem bazel-out/darwin-fastbuild/bin/external/org_libmemcached_libmemcached/headers -isystem external/org_libmemcached_libmemcached -isystem bazel-out/darwin-fastbuild/bin/external/org_libmemcached_libmemcached -isystem external/com_github_tencent_rapidjson/include -isystem bazel-out/darwin-fastbuild/bin/external/com_github_tencent_rapidjson/include -isystem external/com_google_protobuf/src -isystem bazel-out/darwin-fastbuild/bin/external/com_google_protobuf/src -isystem external/boringssl/src/include -isystem bazel-out/darwin-fastbuild/bin/external/boringssl/src/include -isystem external/org_libzip/lib -isystem bazel-out/darwin-fastbuild/bin/external/org_libzip/lib -MD -MF bazel-out/darwin-fastbuild/bin/kythe/cxx/indexer/cxx/_objs/frontend/frontend.d '-DLLVM_ON_UNIX=1' '-DHAVE_BACKTRACE=1' '-DBACKTRACE_HEADER=<execinfo.h>' '-DLTDL_SHLIB_EXT=".so"' '-DLLVM_PLUGIN_EXT=".so"' '-DLLVM_ENABLE_THREADS=1' '-DHAVE_SYSEXITS_H=1' '-DHAVE_UNISTD_H=1' '-DHAVE_STRERROR_R=1' '-DHAVE_LIBPTHREAD=1' '-DHAVE_PTHREAD_GETNAME_NP=1' '-DHAVE_PTHREAD_SETNAME_NP=1' '-DHAVE_PTHREAD_GETSPECIFIC=1' '-DHAVE_REGISTER_FRAME=1' '-DHAVE_DEREGISTER_FRAME=1' '-DHAVE_MACH_MACH_H=1' '-DHAVE_MALLOC_MALLOC_H=1' '-DHAVE_MALLOC_ZONE_STATISTICS=1' '-DHAVE_PROC_PID_RUSAGE=1' '-DHAVE_UNW_ADD_DYNAMIC_FDE=1' '-DLLVM_NATIVE_ARCH="X86"' '-DLLVM_NATIVE_ASMPARSER=LLVMInitializeX86AsmParser' '-DLLVM_NATIVE_ASMPRINTER=LLVMInitializeX86AsmPrinter' '-DLLVM_NATIVE_DISASSEMBLER=LLVMInitializeX86Disassembler' '-DLLVM_NATIVE_TARGET=LLVMInitializeX86Target' '-DLLVM_NATIVE_TARGETINFO=LLVMInitializeX86TargetInfo' '-DLLVM_NATIVE_TARGETMC=LLVMInitializeX86TargetMC' '-DLLVM_NATIVE_TARGETMCA=LLVMInitializeX86TargetMCA' '-DLLVM_HOST_TRIPLE="x86_64-unknown-darwin"' '-DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-unknown-darwin"' -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS '-DLLVM_ENABLE_ZLIB=1' '-frandom-seed=bazel-out/darwin-fastbuild/bin/kythe/cxx/indexer/cxx/_objs/frontend/frontend.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=12.0' '-std=c++17' -Wno-non-virtual-dtor -Wno-unused-variable -Wno-implicit-fallthrough -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -target x86_64-apple-macosx -c kythe/cxx/indexer/cxx/frontend.cc -o bazel-out/darwin-fastbuild/bin/kythe/cxx/indexer/cxx/_objs/frontend/frontend.o)
Execution platform: @local_config_platform//:host
This turns out to be a problem with the way we're building LLVM and not with Abseil. It turns out that an -isystem is adding a header search path that, because of osx's case insensitivity, matches <cxxabi.h> (the filename is CXXABI.H in the repo). Thanks for helping me diagnose the problem!