Skip to content

llhttp: fix broken static build for v9.3.1#9803

Open
npc1054657282 wants to merge 1 commit intoxmake-io:devfrom
npc1054657282:fix-9802
Open

llhttp: fix broken static build for v9.3.1#9803
npc1054657282 wants to merge 1 commit intoxmake-io:devfrom
npc1054657282:fix-9802

Conversation

@npc1054657282
Copy link
Copy Markdown

@npc1054657282 npc1054657282 commented Apr 20, 2026

fix #9802

  1. build: add llhttp-specific prefix to CMake options. nodejs/llhttp#657 replaced the BUILD_SHARED_LIBS and BUILD_STATIC_LIBS with LLHTTP_BUILD_SHARED_LIBS and LLHTTP_BUILD_STATIC_LIBS.
  2. Fix double compilation bug
  • Before adding new features and new modules, please go to issues to submit the relevant feature description first.
  • Write good commit messages and use the same coding conventions as the rest of the project.
  • Please commit code to dev branch and we will merge into master branch in feature
  • Ensure your edited codes with four spaces instead of TAB.

  • 增加新特性和新模块之前,请先到issues提交相关特性说明,经过讨论评估确认后,再进行相应的代码提交,避免做无用工作。
  • 编写友好可读的提交信息,并使用与工程代码相同的代码规范,代码请用4个空格字符代替tab缩进。
  • 请提交代码到dev分支,如果通过,我们会在特定时间合并到master分支上。
  • 为了规范化提交日志的格式,commit消息,不要用中文,请用英文描述。

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the llhttp package configuration to handle version-specific CMake flags, specifically introducing the LLHTTP_ prefix for versions 9.3.1 and later. It also refactors the installation logic to ensure that the xmake build system is only invoked when CMake is not being used. The review feedback suggests a refactor to use a conditional prefix variable for the CMake flags to reduce code redundancy and improve maintainability.

Comment on lines +37 to +43
if package:version():ge("9.3.1") then
table.insert(configs, "-DLLHTTP_BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DLLHTTP_BUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
else
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
end
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The logic for setting CMake flags can be simplified by determining the variable prefix once based on the version. This reduces redundancy and improves the maintainability of the code.

            local prefix = package:version():ge("9.3.1") and "LLHTTP_" or ""
            table.insert(configs, "-D" .. prefix .. "BUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
            table.insert(configs, "-D" .. prefix .. "BUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I will insist on retaining the complete LLHTTP_BUILD_SHARED_LIBS and LLHTTP_BUILD_STATIC_LIBS to ensure explicitness, readability, searchability, and maintainability.

fix xmake-io#9802
1. nodejs/llhttp#657 replaced the `BUILD_SHARED_LIBS` and
`BUILD_STATIC_LIBS` with `LLHTTP_BUILD_SHARED_LIBS` and
`LLHTTP_BUILD_STATIC_LIBS`.
2. Fix double compilation bug
npc1054657282 added a commit to npc1054657282/VCAligner that referenced this pull request Apr 20, 2026
已提交至上游 xmake-io/xmake-repo#9803 在此之前先进行本地覆盖的修复。
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.

llhttp v9.3.1修改了编译参数导致动/静态链接的配置开关失效。

1 participant