I’m currently debugging the build times of the moreSwift/swift-winui (a fork of thebrowsercompany/swift-winui; identical for the purpose of this post).
I have my suspicions as to what’s causing the issues (i.e. linking) but I’d like to be able to verify and quantify that.
I’ve managed to build llbuild-analyze on macOS, but if I run it against a build database from my Windows machine it fails trying to parse Windows paths, so I’ve resorted to trying to build llbuild-analyze on Windows.
If I run swift run, I get the following errors;
C:\Users\rohan\scratch\mirror\Users\stackotter\Desktop\Projects\Swift\swift-llbuild\products\llbuild
-analyze\.build\checkouts\swift-tools-support-core\Sources\TSCclibc\include\csqlite3.h:1:10: error:
'sqlite3.h' file not found
1 | #include <sqlite3.h>
| `- error: 'sqlite3.h' file not found
C:\Users\rohan\scratch\mirror\Users\stackotter\Desktop\Projects\Swift\swift-llbuild\products\llbuild
-analyze\.build\checkouts\swift-tools-support-core\Sources\TSCUtility\SQLite.swift:14:29: error: cou
ld not build C module 'CSQLite3'
12 | import TSCBasic
13 |
14 | @_implementationOnly import CSQLite3
| `- error: could not build C module 'CSQLite3'
15 |
16 | /// A minimal SQLite wrapper.
To remedy that, I installed sqlite3 via vcpkg and attempted to build the package again;
> swift run -Xcc -I -Xcc C:\vcpkg\installed\x64-windows\include -Xlinker -L -Xlinker C:\vcpkg\installed\x64-windows\lib
...
lld-link: error: duplicate symbol: sqlite3_bind_null
>>> defined at C:\\Users\\rohan\\scratch\\mirror\\Users\\stackotter\\Desktop\\Projects\\Swift\\swift
-llbuild\\products\\llbuild-analyze\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftToolchainCSQLi
te.build\\sqlite3.c.o
>>> defined at sqlite3.lib(sqlite3.dll)
lld-link: error: duplicate symbol: sqlite3_bind_text
>>> defined at C:\\Users\\rohan\\scratch\\mirror\\Users\\stackotter\\Desktop\\Projects\\Swift\\swift
-llbuild\\products\\llbuild-analyze\\.build\\x86_64-unknown-windows-msvc\\debug\\SwiftToolchainCSQLi
te.build\\sqlite3.c.o
>>> defined at sqlite3.lib(sqlite3.dll)
swift-tools-support-core depends on sqlite3 as a system package while swift-toolchain-sqlite builds sqlite3 from source. Is there some known way to get this to build without refactoring things to depend on a single copy of sqlite? (I ask as I begin refactoring while waiting for a response
)