<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.freebsd.org/bugzilla/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.freebsd.org/bugzilla/"
          
          maintainer="bugmeister@FreeBSD.org"
>

    <bug>
          <bug_id>293546</bug_id>
          
          <creation_ts>2026-03-02 15:58:54 +0000</creation_ts>
          <short_desc>devel/llvm22: fix parallel build</short_desc>
          <delta_ts>2026-03-02 17:11:13 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Ports &amp; Packages</product>
          <component>Individual Port(s)</component>
          <version>Latest</version>
          <rep_platform>Any</rep_platform>
          <op_sys>Any</op_sys>
          <bug_status>New</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>---</priority>
          <bug_severity>Affects Only Me</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Camachat">eric</reporter>
          <assigned_to name="Brooks Davis">brooks</assigned_to>
          
          

      

      

      <flag name="maintainer-feedback"
          id="96162"
          type_id="3"
          status="?"
          setter="bugzilla"
          requestee="brooks"
    />

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1409608</commentid>
    <comment_count>0</comment_count>
      <attachid>268480</attachid>
    <who name="Eric Camachat">eric</who>
    <bug_when>2026-03-02 15:58:54 +0000</bug_when>
    <thetext>Created attachment 268480
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 &quot;file not found&quot; error.

 - Edge cases where this might not apply: If you&apos;re building LLVM from a custom Git clone (not the FreeBSD port), the path would be &lt;your-llvm-source-dir&gt;/polly/lib/CMakeLists.txt. Also, if the port has been updated post-February 2026 to include this fix (check the port&apos;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&apos;s upstreamed or included in future port revisions. If you&apos;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: &apos;llvm/Analysis/TargetLibraryInfo.inc&apos; file not found
   75 | #include &quot;llvm/Analysis/TargetLibraryInfo.inc&quot;
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1409618</commentid>
    <comment_count>1</comment_count>
    <who name="Brooks Davis">brooks</who>
    <bug_when>2026-03-02 17:11:13 +0000</bug_when>
    <thetext>Please consider submitting a pull request to upstreaming LLVM so this can be fixed in all versions.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>268480</attachid>
            <date>2026-03-02 15:58:54 +0000</date>
            <delta_ts>2026-03-02 15:58:54 +0000</delta_ts>
            <desc>fix parallel build</desc>
            <filename>devel-llvm22-fix-parallel-build.diff</filename>
            <type>text/plain</type>
            <size>576</size>
            <attacher name="Eric Camachat">eric</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBkZXZlbC9sbHZtMjIvZmlsZXMvcGF0Y2gtcG9sbHlfbGliX0NNYWtlTGlzdHMu
dHh0IGRldmVsL2xsdm0yMi9maWxlcy9wYXRjaC1wb2xseV9saWJfQ01ha2VMaXN0cy50eHQKbmV3
IGZpbGUgbW9kZSAxMDA2NDQKaW5kZXggMDAwMDAwMDAwMDAwLi5kNTFlNjM3YTIyMTMKLS0tIC9k
ZXYvbnVsbAorKysgZGV2ZWwvbGx2bTIyL2ZpbGVzL3BhdGNoLXBvbGx5X2xpYl9DTWFrZUxpc3Rz
LnR4dApAQCAtMCwwICsxLDkgQEAKKy0tLSBwb2xseS9saWIvQ01ha2VMaXN0cy50eHQub3JpZwky
MDI2LTAyLTI0IDA3OjM1OjI4IFVUQworKysrIHBvbGx5L2xpYi9DTWFrZUxpc3RzLnR4dAorQEAg
LTE0MSw1ICsxNDEsNSBAQCBpZiAoVEFSR0VUIGludHJpbnNpY3NfZ2VuKQorIAorIGlmIChUQVJH
RVQgaW50cmluc2ljc19nZW4pCisgICAjIENoZWNrIGlmIHdlIGFyZSBidWlsZGluZyBhcyBwYXJ0
IG9mIGFuIExMVk0gYnVpbGQKKy0gIGFkZF9kZXBlbmRlbmNpZXMob2JqLlBvbGx5IGludHJpbnNp
Y3NfZ2VuKQorKyAgYWRkX2RlcGVuZGVuY2llcyhvYmouUG9sbHkgYW5hbHlzaXNfZ2VuKQorIGVu
ZGlmKCkK
</data>

          </attachment>
      

    </bug>

</bugzilla>