Skip to content

wamrc: Build with LLVM-17 - #12338

Open
cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-build-wamrc-with-llvm-17
Open

wamrc: Build with LLVM-17#12338
cosmo0920 wants to merge 1 commit into
masterfrom
cosmo0920-build-wamrc-with-llvm-17

Conversation

@cosmo0920

@cosmo0920 cosmo0920 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Ubuntu 26.04 (Resolute Racoon) does not provide to install llvm-15. So, I adopted to build with llvm-17.

Minimal exclusion works and the binary runs. Tidying the comment to match:

Simplified. Three version-gated hunks, verified by a clean rebuild — wamrc 2.4.1, no shared libLLVM in DT_NEEDED.

You committed the intermediate version as ff8382463; the working tree now amends it in two places.

1. C++17 only where it's needed

Moved out of the unconditional header (line 11 stays at 14) into the LLVM_FOUND block, gated on LLVM ≥ 16 — LLVM 15 headers build fine at C++14, 16+ require 17.

  if (LLVM_PACKAGE_VERSION VERSION_GREATER_EQUAL 16)
    set (CMAKE_CXX_STANDARD 17)
  endif ()

2. Library filter narrowed to just omptarget

The ^LLVM. include-regex in ff8382463 builds, but the binary aborts at startup:

: CommandLine Error: Option 'verify-dom-info' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

Dropping LTO/Remarks/Polly/LLVM reshuffles the link line enough that --as-needed keeps libLLVM-17.so.1 (pulled in transitively via LLVMDebuginfod, whose INTERFACE_LINK_LIBRARIES is CURL::libcurl;LLVM) alongside the static components — so LLVM's cl::opt registry gets populated twice. Excluding only the genuinely-missing targets leaves the link order intact and --as-needed drops libLLVM entirely:

  set (FLB_WAMRC_LLVM_LIBS ${LLVM_AVAILABLE_LIBS})
  list (FILTER FLB_WAMRC_LLVM_LIBS EXCLUDE REGEX "^omptarget")

Also correcting something I got wrong earlier: I reported Polly as missing. libPolly.a and libPollyISL.a are both present — omptarget* are the only actually-missing entries, which is why the one-line exclusion is sufficient.

3. NDEBUG guard

Kept, but reduced to a single LLVM-version clause (covers 15 and 17):

  if (LLVM_PACKAGE_VERSION VERSION_LESS 18)
    target_compile_definitions (aotclib-static
      PRIVATE $<$<COMPILE_LANGUAGE:CXX>:NDEBUG>)
  endif ()

list(FILTER) needs CMake 3.6; the project requires 3.12, so that's fine.

One caveat on the LLVM 15 claim: llvm-15-dev has no install candidate on this box, so I could only build against LLVM 17 and probe the export-list shape against LLVM 21. Debian/Ubuntu's llvm-15-dev exports the same omptarget targets, so the filter applies there too — but LLVM 15 is untested end-to-end here. If CI covers it, that's the place it'll show.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Summary by CodeRabbit

  • Bug Fixes

    • Improved compatibility with newer LLVM and GCC toolchains.
    • Prevented unsupported OpenMP target libraries from being included during linking.
    • Resolved build failures caused by debug assertions in older LLVM configurations.
  • Build Improvements

    • Updated compilation to use C++17 with LLVM 16 and newer.
    • Improved build consistency across supported compiler environments, including MSVC and GNU toolchains.

@cosmo0920
cosmo0920 requested a review from edsiper as a code owner August 26, 2026 15:41
@cosmo0920 cosmo0920 added this to the Fluent Bit v5.1.2 milestone Aug 26, 2026
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d73b12ff-697f-4925-9ff5-0c59a57fbcd0

📥 Commits

Reviewing files that changed from the base of the PR and between d99a2b8 and be46411.

📒 Files selected for processing (1)
  • src/wamrc/CMakeLists.txt

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The WAMR CMake configuration updates LLVM-version-specific C++ settings, disables assertions for one GNU and LLVM combination, and filters omptarget libraries from both flb-wamrc-bin link paths.

Changes

LLVM build compatibility

Layer / File(s) Summary
LLVM compiler compatibility
src/wamrc/CMakeLists.txt
LLVM 16 and newer builds use C++17. GNU 14 or newer with LLVM older than 18 defines NDEBUG for aotclib-static C++ sources.
LLVM library filtering and linking
src/wamrc/CMakeLists.txt
The build removes omptarget entries from the LLVM library list and uses the filtered list for both MSVC and non-MSVC linking.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to be464

This localized CMake change adjusts LLVM-version handling and library filtering, with no unresolved correctness or integration issue identified at the current head. It is merge-ready after normal checks, with no actionable merge-blocking risk remaining.

Suggested reviewers: edsiper, leonardo-albertovich

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely identifies the primary change: adding LLVM 17 build support for wamrc.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cosmo0920-build-wamrc-with-llvm-17

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d99a2b88a5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/wamrc/CMakeLists.txt Outdated
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@cosmo0920
cosmo0920 force-pushed the cosmo0920-build-wamrc-with-llvm-17 branch from d99a2b8 to be46411 Compare August 26, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant