llvm / llvm/llvm-project

LLVM 22.1.1 build fails due to missing `llvm/Analysis/TargetLibraryInfo.inc`

Open
#186,867 4 comments 0 reactions 0 assignees View on GitHub
build-problem
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Building LLVM with the following configuration:

```
cmake -B output -G Ninja -S llvm -Wno-dev \
${C_INCLUDE_DIRS:+-DC_INCLUDE_DIRS="${C_INCLUDE_DIRS}"} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{vars.llvm-prefix}} \
-DCMAKE_PREFIX_PATH=${{vars.llvm-prefix}} \
-DENABLE_LINKER_BUILD_ID=ON \
-DFFI_INCLUDE_DIR="${ffi_include_dir}" \
-DLLVM_BINUTILS_INCDIR=/usr/include \
-DLLVM_BUILD_DOCS=OFF \
-DLLVM_BUILD_EXAMPLES=OFF \
-DLLVM_BUILD_EXTERNAL_COMPILER_RT=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_BUILD_TESTS=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_DEFAULT_TARGET_TRIPLE="${{build.arch}}-unknown-linux-gnu" \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_FFI=ON \
-DLLVM_ENABLE_LIBCXX=ON \
-DLLVM_ENABLE_PIC=ON \
-DLLVM_ENABLE_PROJECTS="clang;lld;mlir;clang-tools-extra" \
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_SPHINX=OFF \
-DLLVM_ENABLE_TERMINFO=ON \
-DLLVM_ENABLE_ZLIB=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_HOST_TRIPLE="${{build.arch}}-unknown-linux-gnu" \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_APPEND_VC_REV=OFF \
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang-${{vars.major-version}} \
-DCLANG_CONFIG_FILE_USER_DIR=~/.config/clang-${{vars.major-version}} \
-DCLANG_ENABLE_ARCMT=ON \
-DCLANG_ENABLE_STATIC_ANALYZER=ON \
-DCLANG_LINK_CLANG_DYLIB=ON \
-DCLANG_PLUGIN_SUPPORT=ON \
-DCLANG_PYTHON_BINDINGS_VERSIONS="$python_version" \
-DCLANG_VENDOR=Wolfi \
-DLIBCLANG_BUILD_STATIC=ON \
-DLIBUNWIND_HAS_NODEFAULTLIBS_FLAG=OFF \
-DCOMPILER_RT_INCLUDE_TESTS=OFF \
-DCOMPILER_RT_BUILD_SANITIZERS=ON \
-DCOMPILER_RT_INSTALL_PATH="${{vars.clang-prefix}}" \
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF
```

will fail with:

```
2026/03/16 19:34:55 INFO [1699/8447] /usr/local/bin/c++ -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/build/output/to
ols/mlir/lib/Support -I/home/build/mlir/lib/Support -I/home/build/output/tools/mlir/include -I/home/build/mlir/include -I/home/build/output/include -I/home/build/llvm/include -fPIC -fno-sema
ntic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wim
plicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-dangling-reference -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-
noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -O3 -DNDEBUG -std=c++17 -fno-exceptions -funwind-tables -MD -MT tools/mlir/lib/Support/CMakeFiles/obj.MLIRSupport.dir/ToolUtilities.cpp.o -MF tools/mlir/lib/Support/CMakeFiles/obj.MLIRSupport
.dir/ToolUtilities.cpp.o.d -o tools/mlir/lib/Support/CMakeFiles/obj.MLIRSupport.dir/ToolUtilities.cpp.o -c /home/build/mlir/lib/Support/ToolUtilities.cpp
2026/03/16 19:34:55 INFO In file included from /home/build/llvm/include/llvm/Analysis/LazyCallGraph.h:46,
2026/03/16 19:34:55 INFO from /home/build/llvm/include/llvm/Analysis/CGSCCPassManager.h:92,
2026/03/16 19:34:55 INFO from /home/build/llvm/include/llvm/Passes/PassBuilder.h:18,
2026/03/16 19:34:55 INFO from /home/build/mlir/lib/ExecutionEngine/OptUtils.cpp:19:
2026/03/16 19:34:55 INFO /home/build/llvm/include/llvm/Analysis/TargetLibraryInfo.h:75:10: fatal error: llvm/Analysis/TargetLibraryInfo.inc: No such file or directory
2026/03/16 19:34:55 INFO 75 | #include "llvm/Analysis/TargetLibraryInfo.inc"
2026/03/16 19:34:55 INFO | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2026/03/16 19:34:55 INFO compilation terminated.
```

This _may_ be related to (but not necessarily fixed by) https://github.com/llvm/llvm-project/pull/184390 (and https://github.com/llvm/llvm-project/pull/165009). The workaround I'm using for now is to explicitly invoke the `analysys_gen` CMake target before actually building everything:

```
cmake --build output --target analysis_gen
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.