Skip to content

[build] main 分支在 MSVC 14.51 (VS18 Community) 本机构建失败:多处缺 <time.h>/<string_view>(CI 未见) #1497

Closed

Description

@caomengxuan666

环境

  • Windows 10 19045 x64;VS18 Community,MSVC 14.51.36231(本机唯一工具集)
  • WinuxCmd main @ ff5aa89;scripts/build-with-vs.ps1 等价路径(Ninja + vcvars64 + PCRE2 FETCHCONTENT 本地源)
  • 同仓最近有同类先例:d46c3d5a(GCC 模块下 ::size_t)说明这类 include 漂移会分工具链出现

现象

main 分支全量构建连续失败,均为「CI 工具集经传递包含、本地 14.51 不再提供」的缺 include:

  1. src/commands/cpio.cpp(331)、logger.cpp(255,266)、pinky.cpp、vmstat.cpp、w.cpp、watch.cpp、who.cpp:localtime_s/gmtime_s 找不到标识符 —— 需要 <time.h>(src/pch/pch.h 不含任何 time 头)
  2. src/commands/terminfo_table.h(154):std::string_view 不是 std 成员 —— 需要 <string_view>

期望

每个使用 CRT/STL 符号的 TU 自带对应 #include,不依赖传递包含或特定 MSVC 小版本的 STL 内部结构。

复现

vcvars64.bat
cmake -B build-vs -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_MODE=DEV \
  -DUSE_STATIC_CRT=ON -DBUILD_FFI=ON -DWINUXCMD_ENABLE_PCRE2=ON \
  -DFETCHCONTENT_SOURCE_DIR_WINUXCMD_PCRE2=D:/tmp/wc1438/pcre2-10.47
cmake --build build-vs --target winuxcmd winuxcmd-tests

首个失败 cpio.cpp(331) error C3861: "localtime_s";补 <time.h> 后依次暴露上述其余文件。

工件

本地最小解挡补丁(每处一行 include,未提交)可提供;sed.nul_txt_reads_file_issue1333 单测在本机同样失败(pre-fix 对照也失败,属本机环境差异,另见 #1495 PR 讨论)。

Activity

  1. added
    bug
    on Nov 1, 2026
  2. added a commit that references this issue on Nov 2, 2026
  3. caomengxuan666 commented on Nov 2, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by the first commit of #1499 (merged b9e9391): direct /<string_view> includes; <string_view> placed in the PCH rather than the header to avoid C2953 under unity builds with import std. Local MSVC 14.51.36231 clean-checkout build passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions