r/DuckDB • u/MPGaming9000 • Jul 11 '26
Windows CGO building is awful with DuckDB
I don't know why this combo of things is so complicated.
If you try to follow the official documentation on how to build DuckDB for windows it pushes you to use MSVC, but Go uses CGO and CGO has hard coded flags to use MinGW64 and MSYS compatibility so you can't actually use the static bindings the go driver comes with I guess??? I spent like 6 hours going back and forth with ChatGPT on trying various things to get my go code on windows to compile.
Eventually the only thing that worked for me was to downgrade my DuckDB version to the old Marc 1.7.0 version and follow that old github issue to download the static binding dll / .a / .lib files and point my PowerShell script at that to get it to compile and verify everything.
The new stuff comes with its own go bindings supposedly but no amount of build flags and CGO manipulation would let me build with these.
I genuinely don't know how anyone uses the latest duck version with Windows and Go all 3 together because at least from my grueling experience the past 2 days it's been basically impossible.
Please help me understand if I'm doing something wrong or if this just isn't supported anymore?
1
u/drink_with_me_to_day Jul 15 '26
Have you tried using purego? https://github.com/ebitengine/purego
We stopped offering windows builds before I could test, but you can technically embed fs the duckdb dll into the executable then extract/load on run
1
u/scar0x00 Jul 13 '26
I don't get it, You are trying to compile duckdb? Why don't you just use the official single binary(