🐛 fix(ci): 修复 DuckDB Windows 可选驱动构建的 CGO 参数污染

This commit is contained in:
Syngnat
2026-06-08 18:53:55 +08:00
parent f19ff5fdd5
commit 8aa2932878
4 changed files with 13 additions and 10 deletions

View File

@@ -4132,7 +4132,8 @@ func withEnvValue(env []string, key string, value string) []string {
func duckDBWindowsDynamicLibraryCGOLDFlags(libDir string) string {
normalizedDir := filepath.ToSlash(strings.TrimSpace(libDir))
parts := []string{
fmt.Sprintf("-L\"%s\"", normalizedDir),
// cgo 会把每个 CGO_LDFLAGS 片段转成 //go:cgo_ldflag带引号的 -L 在 windows/amd64 上会被当成非法参数。
fmt.Sprintf("-L%s", normalizedDir),
"-lduckdb",
"-lstdc++",
"-lm",

View File

@@ -430,7 +430,7 @@ func TestDuckDBWindowsBuildUsesDynamicLibraryTag(t *testing.T) {
func TestDuckDBWindowsDynamicLibraryCGOLDFlagsIncludeSupportLibraries(t *testing.T) {
flags := duckDBWindowsDynamicLibraryCGOLDFlags(`C:\tmp\duckdb lib`)
for _, expected := range []string{
`-L"C:/tmp/duckdb lib"`,
`-LC:/tmp/duckdb lib`,
"-lduckdb",
"-lstdc++",
"-lm",