Issue 98262
Summary Cannot build `//llvm:RISCVCodeGen` due to `RISCVGenMacroFusion.inc: No such file`
Labels new issue
Assignees
Reporter JasonLunn
    `bazel build @@llvm-project//llvm:RISCVCodeGen` fails due to `RISCVGenMacroFusion.inc: No such file`

To reproduce:

`bazel build @@llvm-project//llvm:RISCVCodeGen --verbose_failures`

Reproducible on versions `llvmorg-18.1.7` and `llvmorg-18.1.7`, I haven't tried others. I can reproduce the issue using both `bazel 7.1.1-homebrew` on a Macbook and `bazel 7.2.1` on linux. In all of the above combinations, the build fails with the errors shown below.

`Linux`:

```
[...]
ERROR: /home/jatl/.cache/bazel/_bazel_jatl/d70ab8fa04bde16a9caf8ba6fe5a4e13/external/llvm-project/llvm/BUILD.bazel:2388:16: Compiling llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp failed: (Exit 1): gcc failed: error executing CppCompile command (from target @@llvm-project//llvm:RISCVCodeGen) 
  (cd /home/jatl/.cache/bazel/_bazel_jatl/d70ab8fa04bde16a9caf8ba6fe5a4e13/sandbox/linux-sandbox/1458/execroot/local_repository_name && \
  exec env - \
 PATH=/usr/lib/google-golang/bin:/usr/local/buildtools/java/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/rvm/bin \
    PWD=/proc/self/cwd \
  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++14' -MD -MF bazel-out/k8-fastbuild/bin/external/llvm-project/llvm/_objs/RISCVCodeGen/RISCVAsmPrinter.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/external/llvm-project/llvm/_objs/RISCVCodeGen/RISCVAsmPrinter.pic.o' -fPIC '-DLLVM_ON_UNIX=1' '-DHAVE_BACKTRACE=1' '-DBACKTRACE_HEADER=<execinfo.h>' '-DLTDL_SHLIB_EXT=".so"' '-DLLVM_PLUGIN_EXT=".so"' '-DLLVM_ENABLE_THREADS=1' '-DHAVE_DEREGISTER_FRAME=1' '-DHAVE_LIBPTHREAD=1' '-DHAVE_PTHREAD_GETNAME_NP=1' '-DHAVE_PTHREAD_H=1' '-DHAVE_PTHREAD_SETNAME_NP=1' '-DHAVE_REGISTER_FRAME=1' '-DHAVE_SETENV_R=1' '-DHAVE_STRERROR_R=1' '-DHAVE_SYSEXITS_H=1' '-DHAVE_UNISTD_H=1' -D_GNU_SOURCE '-DHAVE_LINK_H=1' '-DHAVE_MALLINFO=1' '-DHAVE_SBRK=1' '-DHAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1' -DHAVE_BUILTIN_THREAD_POINTER '-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-linux-gnu"' '-DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-unknown-linux-gnu"' '-DLLVM_VERSION_MAJOR=18' '-DLLVM_VERSION_MINOR=1' '-DLLVM_VERSION_PATCH=8' '-DLLVM_VERSION_STRING="18.1.8git"' -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS '-DLLVM_ENABLE_ZLIB=1' '-DLLVM_ENABLE_ZSTD=1' -DZSTD_MULTITHREAD '-DBLAKE3_USE_NEON=0' -iquote external/llvm-project -iquote bazel-out/k8-fastbuild/bin/external/llvm-project -iquote external/llvm_zlib -iquote bazel-out/k8-fastbuild/bin/external/llvm_zlib -iquote external/llvm_zstd -iquote bazel-out/k8-fastbuild/bin/external/llvm_zstd -Ibazel-out/k8-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/RISCVCodeGen -Ibazel-out/k8-fastbuild/bin/external/llvm_zstd/_virtual_includes/zstd -Ibazel-out/k8-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/RISCVCommonTableGen -Ibazel-out/k8-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/riscv_isel_target_gen -Ibazel-out/k8-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/RISCVInfo -Ibazel-out/k8-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/RISCVUtilsAndDesc -isystem external/llvm-project/llvm/include -isystem bazel-out/k8-fastbuild/bin/external/llvm-project/llvm/include -isystem external/llvm-project/llvm/lib/Target/RISCV -isystem bazel-out/k8-fastbuild/bin/external/llvm-project/llvm/lib/Target/RISCV '-std=c++17' -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c external/llvm-project/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp -o bazel-out/k8-fastbuild/bin/external/llvm-project/llvm/_objs/RISCVCodeGen/RISCVAsmPrinter.pic.o)
# Configuration: 6610aa18e6d53ac51ce4da0be8fc357d9bfb2615d356b8a957dab2a6ef0723d4
# Execution platform: @@internal_platforms_do_not_use//host:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/llvm-project/llvm/lib/Target/RISCV/RISCVMachineFunctionInfo.h:16,
 from external/llvm-project/llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp:19:
external/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.h:31:10: fatal error: RISCVGenMacroFusion.inc: No such file or directory
   31 | #include "RISCVGenMacroFusion.inc"
      | ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Target @@llvm-project//llvm:RISCVCodeGen failed to build
INFO: Elapsed time: 315.919s, Critical Path: 64.84s
INFO: 1393 processes: 29 internal, 1364 linux-sandbox.
ERROR: Build did NOT complete successfully
```

macOS:

```
ERROR: /private/var/tmp/_bazel_jatl/0fa0cb5d930f107230fecdb83d0e365c/external/llvm-project/llvm/BUILD.bazel:2388:16: Compiling llvm/lib/Target/RISCV/RISCVDeadRegisterDefinitions.cpp failed: (Exit 1): wrapped_clang_pp failed: error executing CppCompile command (from target @@llvm-project//llvm:RISCVCodeGen) 
  (cd /private/var/tmp/_bazel_jatl/0fa0cb5d930f107230fecdb83d0e365c/sandbox/darwin-sandbox/1/execroot/local_repository_name && \
  exec env - \
    APPLE_SDK_PLATFORM=MacOSX \
 APPLE_SDK_VERSION_OVERRIDE=14.4 \
 PATH=/Users/jatl/.rvm/gems/ruby-3.1.0/bin:/Users/jatl/.rvm/gems/ruby-3.1.0@global/bin:/Users/jatl/.rvm/rubies/ruby-3.1.0/bin:/Users/jatl/.rvm/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/git/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/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:/Library/Apple/usr/bin:/Users/jatl/mdproxy/bin \
    XCODE_VERSION_OVERRIDE=15.3.0.15E204a \
    ZERO_AR_DATE=1 \
  external/local_config_apple_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++14' '-fdebug-prefix-map=__BAZEL_EXECUTION_ROOT__=.' '-fdebug-prefix-map=__BAZEL_XCODE_DEVELOPER_DIR__=/PLACEHOLDER_DEVELOPER_DIR' -iquote external/llvm-project -iquote bazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project -iquote external/llvm_zlib -iquote bazel-out/darwin_x86_64-fastbuild/bin/external/llvm_zlib -iquote external/llvm_zstd -iquote bazel-out/darwin_x86_64-fastbuild/bin/external/llvm_zstd -Ibazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/RISCVCodeGen -Ibazel-out/darwin_x86_64-fastbuild/bin/external/llvm_zstd/_virtual_includes/zstd -Ibazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/RISCVCommonTableGen -Ibazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/riscv_isel_target_gen -Ibazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/RISCVInfo -Ibazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/_virtual_includes/RISCVUtilsAndDesc -isystem external/llvm-project/llvm/include -isystem bazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/include -isystem external/llvm-project/llvm/lib/Target/RISCV -isystem bazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/lib/Target/RISCV -MD -MF bazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/_objs/RISCVCodeGen/RISCVDeadRegisterDefinitions.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_DEREGISTER_FRAME=1' '-DHAVE_LIBPTHREAD=1' '-DHAVE_PTHREAD_GETNAME_NP=1' '-DHAVE_PTHREAD_H=1' '-DHAVE_PTHREAD_SETNAME_NP=1' '-DHAVE_REGISTER_FRAME=1' '-DHAVE_SETENV_R=1' '-DHAVE_STRERROR_R=1' '-DHAVE_SYSEXITS_H=1' '-DHAVE_UNISTD_H=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"' '-DLLVM_VERSION_MAJOR=18' '-DLLVM_VERSION_MINOR=1' '-DLLVM_VERSION_PATCH=8' '-DLLVM_VERSION_STRING="18.1.8git"' -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS '-DLLVM_ENABLE_ZLIB=1' '-DLLVM_ENABLE_ZSTD=1' -DZSTD_MULTITHREAD '-DBLAKE3_USE_NEON=0' '-frandom-seed=bazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/_objs/RISCVCodeGen/RISCVDeadRegisterDefinitions.o' -isysroot __BAZEL_XCODE_SDKROOT__ -F__BAZEL_XCODE_SDKROOT__/System/Library/Frameworks -F__BAZEL_XCODE_DEVELOPER_DIR__/Platforms/MacOSX.platform/Developer/Library/Frameworks -no-canonical-prefixes -pthread '-std=c++17' '-Wframe-larger-than=100000000' -Wno-vla -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -target x86_64-apple-macosx14.4 -c external/llvm-project/llvm/lib/Target/RISCV/RISCVDeadRegisterDefinitions.cpp -o bazel-out/darwin_x86_64-fastbuild/bin/external/llvm-project/llvm/_objs/RISCVCodeGen/RISCVDeadRegisterDefinitions.o)
# Configuration: bbf001e7d5bd5cbcf890633bdab22ca562a3317f9026f226cf55f517a5312533
# Execution platform: @@local_config_platform//:host

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from external/llvm-project/llvm/lib/Target/RISCV/RISCVDeadRegisterDefinitions.cpp:15:
external/llvm-project/llvm/lib/Target/RISCV/RISCVSubtarget.h:31:10: fatal error: 'RISCVGenMacroFusion.inc' file not found
#include "RISCVGenMacroFusion.inc"
         ^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error in child process '/usr/bin/xcrun'. 1
Target @@llvm-project//llvm:RISCVCodeGen failed to build
```

For context, my workspace file includes the following:

```
llvm_version = "llvmorg-18.1.8"

http_archive(
    name = "llvm-raw",
 build_file_content = "# empty",
    strip_prefix = "llvm-project-" + llvm_version,
    urls = ["https://github.com/llvm/llvm-project/archive/refs/tags/{version}.tar.gz".format(version = llvm_version)],
)
load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
llvm_configure(name = "llvm-project")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
maybe(
    http_archive,
    name = "llvm_zlib",
 build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
 sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
 strip_prefix = "zlib-ng-2.0.7",
    urls = [
 "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
 ],
)

maybe(
    http_archive,
    name = "llvm_zstd",
 build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD",
 sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0",
 strip_prefix = "zstd-1.5.2",
    urls = [
 "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz",
 ],
)
```

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to