Created attachment 268480 [details] fix parallel build Fix parallel build error on 8-core/16-thread CPU: # cause: - Why this file? Polly is built as part of the LLVM tools subtree, and its CMakeLists.txt handles the compilation of its transform passes (like ScopInliner.cpp, which triggered your error). The existing code there already includes a conditional dependency on older TableGen targets (e.g., intrinsics_gen from a 2017 fix for a similar race). However, it lacks one for the new TargetLibraryInfo.inc generator introduced in LLVM commit c9f5734 (PR #165009, around November 2025), which refactored TargetLibraryInfo from a .def file to TableGen-based .inc generation. Without this, high-parallelism builds (common on FreeBSD with samu or Ninja) can attempt to compile Polly sources before the .inc file is ready, leading to the "file not found" error. - Edge cases where this might not apply: If you're building LLVM from a custom Git clone (not the FreeBSD port), the path would be <your-llvm-source-dir>/polly/lib/CMakeLists.txt. Also, if the port has been updated post-February 2026 to include this fix (check the port's changelog or pkg info llvm22), you might not need to modify anything. In rare cases on very low-RAM systems, the error could masquerade as a missing file due to OOM kills during TableGen, but your znver4 setup suggests parallelism is the culprit. - Related considerations: Modifying this file directly in the work directory is a temporary fix—it will be wiped out on make clean or a fresh port fetch. For a permanent solution in the FreeBSD ports ecosystem, create a patch file (e.g., via make makepatch) and submit it to the maintainer (Brooks Davis) or via Bugzilla/PR. This ensures it's upstreamed or included in future port revisions. If you're cross-compiling or using Poudriere, apply the patch in your custom repository. # error log: samu: job failed with status 1: /usr/bin/c++ -DLLVM_BUILD_STATIC -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/wrkdirs/usr/ports/devel/llvm22/work-default/.build/tools/polly/lib -I/wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/polly/lib -I/wrkdirs/usr/ports/devel/llvm22/work-default/.build/tools/polly/include -I/wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/polly/lib/External -I/wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/polly/lib/External/pet/include -I/wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/polly/lib/External/isl/include -I/wrkdirs/usr/ports/devel/llvm22/work-default/.build/tools/polly/lib/External/isl/include -I/wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/polly/include -I/wrkdirs/usr/ports/devel/llvm22/work-default/.build/include -I/wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/llvm/include -O3 -pipe -mtune=znver4 -march=znver4 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -march=znver4 -isystem /usr/local/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wno-pass-failed -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -fno-exceptions -fno-rtti -O3 -pipe -mtune=znver4 -march=znver4 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -march=znver4 -isystem /usr/local/include -DNDEBUG -std=c++17 -fno-exceptions -funwind-tables -MD -MT tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScopInliner.cpp.o -MF tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScopInliner.cpp.o.d -o tools/polly/lib/CMakeFiles/obj.Polly.dir/Transform/ScopInliner.cpp.o -c /wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/polly/lib/Transform/ScopInliner.cpp In file included from /wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/polly/lib/Transform/ScopInliner.cpp:16: In file included from /wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/polly/include/polly/ScopInliner.h:12: In file included from /wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/llvm/include/llvm/Analysis/CGSCCPassManager.h:92: In file included from /wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/llvm/include/llvm/Analysis/LazyCallGraph.h:46: /wrkdirs/usr/ports/devel/llvm22/work-default/llvm-project-22.1.0.src/llvm/include/llvm/Analysis/TargetLibraryInfo.h:75:10: fatal error: 'llvm/Analysis/TargetLibraryInfo.inc' file not found 75 | #include "llvm/Analysis/TargetLibraryInfo.inc" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated.
Please consider submitting a pull request to upstreaming LLVM so this can be fixed in all versions.