diff --git a/build.ps1 b/build.ps1 index ab0a194..4232f93 100644 --- a/build.ps1 +++ b/build.ps1 @@ -16,7 +16,7 @@ CPATH — additive. clang appends it to the header search path without disturbing MSVC/SDK auto-detection, so plain `swift build` works afterwards with no flags at all. - -Xlinker -LIBPATH: — passed per-invocation rather than via %LIB%. Setting %LIB% + -Xlinker /LIBPATH: — passed per-invocation rather than via %LIB%. Setting %LIB% would be actively harmful: clang skips emitting its own -libpath: for the VC, UCRT *and* Windows SDK directories the moment %LIB% is set (clang/lib/Driver/ToolChains/MSVC.cpp, @@ -167,7 +167,11 @@ function Invoke-Swift([string[]]$SwiftArgs, [hashtable]$Sql) { # warning. Read the warnings. $full = @($SwiftArgs) + @( '-Xcc', "-I$($Sql.Include)", - '-Xlinker', "-LIBPATH:$($Sql.Lib)", + # `/LIBPATH:`, NOT `-LIBPATH:`. A leading `-L` is claimed by the driver's GNU-style + # library-path flag, so `-LIBPATH:C:\…\lib` is read as `-L` + `IBPATH:C:\…\lib` and + # re-emitted to the linker as `-libpath:IBPATH:C:\…\lib` — a directory that exists + # nowhere, and the only symptom is `lld-link: could not open 'sqlite3.lib'`. + '-Xlinker', "/LIBPATH:$($Sql.Lib)", '-Xlinker', '/FORCE:MULTIPLE') Write-Note "swift $($full -join ' ')" # Out-Host, not the pipeline: a native command's stdout would otherwise become this