Windows build fails: yajl's Conan recipe sets CMP0026 OLD, incompatible with newer CMake
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 52/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- cmake, cpp, github-actions
调研方向
从 vcbuild.bat 和 .github/workflows/test_new.yml 开始,尤其检查 build-windows 作业,以追踪 Conan 如何构建 yajl/2.1.0。检查 yajl 的 CMakeLists.txt,以及 reformatter/CMakeLists.txt 和 verify/CMakeLists.txt,并验证报告中的 policy 和 LOCATION 错误。当受影响的 Windows CI 路径能够使用当前 toolchain 成功配置和构建时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Summary
The Windows build (vcbuild.bat → Conan → yajl) fails deterministically on GitHub-hosted Windows runners that have picked up a newer Visual Studio/CMake toolchain. yajl/2.1.0's Conan Center recipe's CMakeLists.txt still does cmake_policy(SET CMP0026 OLD), and current CMake has dropped support for CMP0026's OLD behavior entirely, so cmake_policy() itself errors out before configuration can proceed.
Where this was found
Building ModSecurity-nginx's Windows CI job (.github/workflows/test_new.yml, build-windows), which invokes this repo's own Windows build via vcbuild.bat. Not caused by anything in ModSecurity-nginx — it fails inside owasp-modsecurity/ModSecurity's own dependency build step, so any downstream consumer building on an affected Windows toolchain would hit the same thing.
Evidence (from CI log)
yajl/2.1.0: Calling build()
yajl/2.1.0: Apply patch (conan): CMake: fix mingw, disable build of doc/test/perf/example, relocatable shared lib for macos, install DLL into bin folder
yajl/2.1.0: Running CMake.configure()
yajl/2.1.0: RUN: cmake -G "Visual Studio 18 2026" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="C:/Users/runneradmin/.conan2/p/b/yajla281b513a4897/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "C:/Users/runneradmin/.conan2/p/b/yajla281b513a4897/b/src"
CMake Error at CMakeLists.txt:17 (cmake_policy):
Policy CMP0026 may not be set to OLD behavior because this version of CMake
no longer supports it. The policy was introduced in CMake version 3.0.0,
and use of NEW behavior is now required.
Please either update your CMakeLists.txt files to conform to the new
behavior or use an older version of CMake that still supports the old
behavior. Run cmake --help-policy CMP0026 for more information.
Two further, likely-related errors appear later in the same yajl configure step once the policy issue is worked around/ignored:
CMake Error at reformatter/CMakeLists.txt:38 (GET_TARGET_PROPERTY):
The LOCATION property may not be read from target "json_reformat". Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.
CMake Error at verify/CMakeLists.txt:32 (GET_TARGET_PROPERTY):
The LOCATION property may not be read from target "json_verify". Use the
target name directly with add_custom_command, or use the generator
expression $<TARGET_FILE>, as appropriate.
(GET_TARGET_PROPERTY ... LOCATION on a target is also removed/hard-errors under CMake's CMP0026 NEW behavior — consistent with the same root cause: yajl's bundled CMakeLists.txt predates CMake policies this old CMake no longer tolerates.)
The runner's cmake -G "Visual Studio 18 2026" generator string indicates the GitHub-hosted Windows image has moved to a VS2026-preview-class toolchain with a correspondingly newer bundled CMake.
Impact
- Deterministic, not flaky: every Windows build that reaches the yajl step on an affected toolchain fails the same way. Retrying does not help.
- Blocks Windows CI for any downstream project (e.g. ModSecurity-nginx) that builds libmodsecurity for Windows via this path.
Suggested fixes (any of)
- Pin/patch the yajl Conan recipe/version used by
vcbuild.batto one whoseCMakeLists.txtdoesn't rely onCMP0026 OLD(or pass a policy override / patch it out during the build). - Pin an explicit, known-compatible CMake version for the Windows build instead of relying on whatever the toolchain/runner provides.
- Consider the existing #3308 ("Drop YAJL dependency") as a longer-term fix that would sidestep this class of issue entirely.
Environment
- GitHub-hosted Windows runner (windows-2025 image at the time of writing)
- Conan 2.x,
yajl/2.1.0from conancenter - Observed via
owasp-modsecurity/ModSecurity-nginx'stest_new.ymlbuild-windowsjob
- 主要语言
- C++
- 星标
- 9.8k
- 派生
- 1.8k
- 平均合并
- 2 小时 46 分钟
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
owasp-modsecurity/ModSecurity 的其他 Issue
-
2.x Platform - IIS
难度 1/5 1 小时以内 新手友好度 90/100
owasp-modsecurity/ModSecurity#3623 · 1 条评论 ·
维护者通常 1 天内回复
-
2.x Platform - IIS
难度 2/5 1-3 小时 新手友好度 82/100
owasp-modsecurity/ModSecurity#3621 · 1 条评论 ·
维护者通常 1 天内回复
-
2.x Platform - IIS
难度 2/5 1-3 小时 新手友好度 84/100
owasp-modsecurity/ModSecurity#3619 · 1 条评论 ·
维护者通常 1 天内回复
-
2.x Platform - IIS
难度 2/5 1-3 小时 新手友好度 76/100
owasp-modsecurity/ModSecurity#3612 · 1 条评论 ·
维护者通常 1 天内回复
-
3.x
难度 2/5 1-3 小时 新手友好度 70/100
owasp-modsecurity/ModSecurity#3580 · 1 条评论 ·
维护者通常 1 天内回复
查看 owasp-modsecurity/ModSecurity 的全部 Issue
相似的 Issue
-
area/ysql kind/bug priority/medium
难度 2/5 1-3 小时 新手友好度 75/100
yugabyte/yugabyte-db#34552 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 1 天内回复
-
bug
难度 1/5 1 小时以内 新手友好度 94/100
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
ai_p2
难度 2/5 1-3 小时 新手友好度 76/100
ClickHouse/ClickHouse#123351 ·
维护者通常 1 天内回复