fix: Windows 交叉编译添加 CGO_ENABLED=0
All checks were successful
Release / build (push) Successful in 6m28s

This commit is contained in:
2026-04-08 03:14:30 +08:00
parent 063b14add7
commit 95338962cb
3 changed files with 27 additions and 2 deletions

View File

@@ -960,4 +960,23 @@ go build -ldflags "-X github.com/titor/fanyi/internal/logo.version=${VERSION}" -
- `changelog.md` - 版本历史整理
- `build.sh` - 跨平台编译脚本
**关联版本**: [changelog.md#v1.2.0](changelog.md#v120-2026-04-08)
---
### [2026-04-08] Windows 交叉编译修复
**问题**: 交叉编译的 Windows 版本在 Windows 上提示"不支持16位应用程序"
**原因**:
- Linux CI 交叉编译 Windows 时,缺少 `CGO_ENABLED=0` 参数
- 原生编译go build 在 Windows 上)没有这个问题
**解决方案**:
- 在 build.sh 的 `windows/amd64` 分支添加 `CGO_ENABLED=0`
- 统一使用 `CGO_ENABLED=0` 进行构建
**相关文件**:
- `build.sh` - 添加 CGO_ENABLED=0
**关联版本**: [changelog.md#v1.2.0](changelog.md#v120-2026-04-08)