Remove forward declarations to cgo exported funcs#5
Remove forward declarations to cgo exported funcs#5anacrolix merged 1 commit intogo-llsqlite:masterfrom
Conversation
|
To hopefully save someone else some time My personal use-case here is to easily cross-compile a project that uses sqlite. https://github.com/zombiezen/go-sqlite would have been my first choice of sqlite driver, but the modernc/sqlite foundation it's built on doesn't support many GOOS/GOARCH combos. For example, Android (builds but makes prohibited syscalls), iOS, various BSDs. Zig is great, and makes cross compilation a dream, e.g. Unfortunately, Zig uses clang internally, leading to the build errors on windows detailed in the main PR. This PR makes cross-compiling as "easy" as: Caveat: The zig toolchain is currently missing winpthreads for windows, so you'll need to build and link against winpthreads manually, e.g. by cross-compiling using https://github.com/kassane/winpthreads-zigbuild and passing |
|
@theraphim do you have any thoughts? What version of Zig are you cross compiling with? I have a project that I cross compile to Windows and I don't recall any errors but it's been a while. I'll try it with this PR. Thanks for the PR! |
|
I should mention that I've used zombiezen, and Zig for cross compilation too, so I understand the difficulty. In my case I had to stop using zombiezen because I needed to use extensions, and I couldn't figure them out in Go with zombiezen, and couldn't call through to C extensions from zombiezen, and I started writing my extensions in Rust which was all too much to deal with. |
|
@anacrolix Cross compiling with both Zig stable and nightly -- behaviour is the same! I believe cross-compiling with a gcc based toolchain does work, but not with a clang-based one (i.e. zig, but also... clang). I'm recklessly assuming you're not a Windows user, but you can verify the problem and fix on linux/macos because zig bundles a mingw64+clang cross compilation toolchain:
|
|
Fantastic. Thanks for the thorough reproduction steps. |
Parallel PR to crawshaw/sqlite#146 -- I feel like this one has a better chance of being merged than the crawshaw repo :)
Full details of the change in PR linked above.
tl;dr, fixes building on windows with clang, as well as a typo in readme.md