Repository navigation
build(rust2): build the ffi staticlib for the C++ target arch (Refs #1552) - #1553
Merged
Merged
Conversation
The cargo invocation for winuxcmd_ffi.lib never passed --target, so on the x64 CI host the arm64 legs (vcvars x64_arm64) silently linked an x86_64 staticlib whose objects cannot resolve the bridge ABI symbols for an ARM64 link (LNK2001 x3 + LNK1120). Derive the Rust target triple from the C++ target arch (package arch, then the vcvars target environment, then the processor), always pass --target, and consume the per-triple artifact path on both architectures. The workflow installs the aarch64 std library for the arm64 legs, which the runner image does not carry by default. Refs #1552
caomengxuan666
marked this pull request as ready for review
November 10, 2026 05:47
This was referenced Nov 10, 2026
Closed
caomengxuan666
added a commit
that referenced
this pull request
Nov 10, 2026
…plets Three CI findings from PR #1561's first run, each traced to root cause: i18n-drift: the 25 new-drift rows are all stale zh-CN keys whose source strings this PR deleted (the 10 C++ bodies + test_expr.hpp, incl. command.readlink/realpath.error.file_name_too_long — the Rust fsutil::reason statics replaced the keyed i18n::format calls). Verified PR-introduced: main tip measures none of them (its CI is green), and the catalog clone carries the keys for text my branch no longer produces. Recorded as deliberate growth with check_i18n_drift.py --update-baseline per the #1534/#1547 precedent; the eventual shrink is the catalog cleanup batch in unixwin/winuxcmd-i18n. baseline (GNU master differential), 2 real mismatches vs the live oracle: - mkdir -m 888 printed the usage Try-hint; GNU mkdir.c:290 treats an invalid mode as a runtime operand error - one stderr line, no hint. mkdir.rs writes the line directly now. - test -f /dev/null returned 0: the operand reaches the library as the NUL DOS device and metadata() succeeds on it; -f now rejects DOS char devices (GNU: char device is not a regular file, rc 1). build-windows x64 ctest, 4 symlink rows the local runner skipped (no symlink privilege) that the CI runner executes: - readlink -f / realpath default / realpath -m on a dangling leaf link (dang -> z_absent_tgt) now resolve the leaf symlink to its target's path (<parent>/z_absent_tgt, rc 0) instead of echoing the link name - AllButLast splices the read_link target onto the canonical parent and folds it lexically; NoCheck does the same over the -m walk; -e keeps failing (probed GNU 9.4). canon unit test pins the class where symlinks are creatable, skips where they are not. - realpath --relative-to: the common-prefix walk compared components case-sensitively, so the CI runner's lowercase-drive ctx.cwd ("d:\...") never matched the canonicalized target's "D:\..." and the output fell back to absolute. Component comparison is now case-insensitive (Windows path spellings are case-variants). pgrep_inverse_excludes_matches failed once on CI and passes on rerun - the #1553 pid-flake family, unrelated. Refs #1488
caomengxuan666
added a commit
that referenced
this pull request
Nov 10, 2026
…plets Three CI findings from PR #1561's first run, each traced to root cause: i18n-drift: the 25 new-drift rows are all stale zh-CN keys whose source strings this PR deleted (the 10 C++ bodies + test_expr.hpp, incl. command.readlink/realpath.error.file_name_too_long — the Rust fsutil::reason statics replaced the keyed i18n::format calls). Verified PR-introduced: main tip measures none of them (its CI is green), and the catalog clone carries the keys for text my branch no longer produces. Recorded as deliberate growth with check_i18n_drift.py --update-baseline per the #1534/#1547 precedent; the eventual shrink is the catalog cleanup batch in unixwin/winuxcmd-i18n. baseline (GNU master differential), 2 real mismatches vs the live oracle: - mkdir -m 888 printed the usage Try-hint; GNU mkdir.c:290 treats an invalid mode as a runtime operand error - one stderr line, no hint. mkdir.rs writes the line directly now. - test -f /dev/null returned 0: the operand reaches the library as the NUL DOS device and metadata() succeeds on it; -f now rejects DOS char devices (GNU: char device is not a regular file, rc 1). build-windows x64 ctest, 4 symlink rows the local runner skipped (no symlink privilege) that the CI runner executes: - readlink -f / realpath default / realpath -m on a dangling leaf link (dang -> z_absent_tgt) now resolve the leaf symlink to its target's path (<parent>/z_absent_tgt, rc 0) instead of echoing the link name - AllButLast splices the read_link target onto the canonical parent and folds it lexically; NoCheck does the same over the -m walk; -e keeps failing (probed GNU 9.4). canon unit test pins the class where symlinks are creatable, skips where they are not. - realpath --relative-to: the common-prefix walk compared components case-sensitively, so the CI runner's lowercase-drive ctx.cwd ("d:\...") never matched the canonicalized target's "D:\..." and the output fell back to absolute. Component comparison is now case-insensitive (Windows path spellings are case-variants). pgrep_inverse_excludes_matches failed once on CI and passes on rerun - the #1553 pid-flake family, unrelated. Refs #1488
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1552
What changed
The rust2 command library (
winuxcmd_ffi.lib) was built by cargo with notarget selection, so it always carried the host architecture. The arm64
legs of
build-winuxcmd.ymlcross-compile from an x64 host (vcvarsx64_arm64,/machine:ARM64at link time), so they received an x86_64staticlib whose objects cannot satisfy the bridge references, and the
link of winuxcmd.exe stopped with LNK2001 for
winuxcmd_abi_version,winuxcmd_runandwinuxcmd_free_bufplus LNK1120. The x64 legs wereunaffected because host and link target agree there.
CMakeLists.txt: derive the Rust target triple from the C++ targetarch (explicit package arch, then the vcvars target environment, then
the processor; a cache variable
WINUXCMD_RUST2_TARGET_TRIPLEcanoverride), always pass it to cargo with
--target, and consume theper-triple artifact path
rust2-target/<triple>/release/winuxcmd_ffi.libon botharchitectures. The symbol definitions, the ABI header and the bridge
are untouched, and no library leaves the link.
.github/workflows/build-winuxcmd.yml: the arm64 legs install theaarch64-pc-windows-msvcstd library before configuring, since therunner image only carries the host target.
本 PR 删除了什么
Nothing is deleted. The single replaced line is the previous
host-layout artifact path in
CMakeLists.txt, superseded by theper-triple path above.
Verification
Verified locally at source level: the derivation block was extracted
verbatim and exercised with
cmake -Pacross five input shapes (CIarm64, CI x64, local vcvars cross, local native, explicit override) and
resolved to the expected triple and artifact path each time; the
per-triple cargo artifact layout was confirmed with a minimal
staticlib crate. The MSVC build itself cannot run on this Linux host,
so the deciding evidence is this PR's own CI: the arm64 full leg is
expected to link winuxcmd.exe with no LNK2001 for the three bridge
symbols. Baseline infrastructure reds noted in the issue (pcre2
download HTTP 504 on some legs, gnulib HTTP 500 on the oracle leg) are
unrelated to this change.
No user-visible text changes; the i18n catalogs are not affected.