Summary
The Release Binaries workflow fails for x86_64-pc-windows-msvc with linker errors for four libc functions.
Error
From run #22211846804:
error LNK2019: unresolved external symbol gmtime_s referenced in function _ZN5rilua6stdlib2os7os_date...
error LNK2019: unresolved external symbol localtime_s referenced in function _ZN5rilua6stdlib2os7os_date...
error LNK2019: unresolved external symbol fprintf referenced in function _ZN5rilua6stdlib2io7g_write...
error LNK2019: unresolved external symbol fscanf referenced in function _ZN5rilua6stdlib2io6g_read...
fatal error LNK1120: 4 unresolved externals
Affected symbols
| Symbol |
File |
Function |
gmtime_s |
src/stdlib/os.rs |
os_date (UTC) |
localtime_s |
src/stdlib/os.rs |
os_date (local) |
fprintf |
src/stdlib/io.rs |
g_write |
fscanf |
src/stdlib/io.rs |
g_read |
Cause
The FFI declarations in src/platform.rs reference C runtime functions that require explicit linking on Windows MSVC. The CI test workflow passes because it runs cargo test on Linux, but the release binary workflow cross-compiles with --target x86_64-pc-windows-msvc where the universal C runtime (ucrt) is not linked automatically.
Possible fixes
- Add
#[link(name = "ucrt")] or #[link(name = "msvcrt")] to the FFI extern blocks on Windows
- Use
#[cfg_attr(target_env = "msvc", link(name = "ucrt"))] conditionally
- Add a
build.rs that emits cargo:rustc-link-lib=ucrt on MSVC targets
First observed
Tag v0.1.8, workflow run on 2026-02-20.
Summary
The Release Binaries workflow fails for
x86_64-pc-windows-msvcwith linker errors for four libc functions.Error
From run #22211846804:
Affected symbols
gmtime_ssrc/stdlib/os.rsos_date(UTC)localtime_ssrc/stdlib/os.rsos_date(local)fprintfsrc/stdlib/io.rsg_writefscanfsrc/stdlib/io.rsg_readCause
The FFI declarations in
src/platform.rsreference C runtime functions that require explicit linking on Windows MSVC. The CI test workflow passes because it runscargo teston Linux, but the release binary workflow cross-compiles with--target x86_64-pc-windows-msvcwhere the universal C runtime (ucrt) is not linked automatically.Possible fixes
#[link(name = "ucrt")]or#[link(name = "msvcrt")]to the FFI extern blocks on Windows#[cfg_attr(target_env = "msvc", link(name = "ucrt"))]conditionallybuild.rsthat emitscargo:rustc-link-lib=ucrton MSVC targetsFirst observed
Tag v0.1.8, workflow run on 2026-02-20.