Can I build LLVM using Basel for macOS+arm64

It seems that the closest configuration is generic_clang. So I tried it on my M1 MacBook Pro.

USE_BAZEL_VERSION=5.0.0 /opt/homebrew/bin/bazel build --config=generic_clang @llvm-project//...

Unfortunately, I got the following error.

FPUtil/FEnvImpl.h:16:10: fatal error: 'aarch64/fenv_darwin_impl.h' file not found

It seems that the aarch64/fenv_darwin_impl.h is not in the MacOSX.sdk.

$ cd
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/
$ du -a | grep fenv
8	./usr/include/c++/v1/fenv.h
8	./usr/include/c++/v1/cfenv
16	./usr/include/fenv.h
16	./usr/share/man/man3/fenv.3

Reading llvm-project/config.bzl at 70de0e014013b4d97febe6704881a9a8c893d078 · llvm/llvm-project · GitHub, it seems that there is “darwin_arm64”. How can I use it from the Bazel build command-line?

This file was added during the initial commit of libc for Darwin arm64:
https://reviews.llvm.org/D120914

It is today in the mono repo:

My best guess is that someone forgot to add the header to bazel files:

I would recommend to create an issue:

Thank you, @tschuett ! I filed an issue Need to add header file fenv_darwin_impl.h into Bazel build rules · Issue #59378 · llvm/llvm-project · GitHub as recommended.