Closed marcboeker closed 4 weeks ago
Hi @marcboeker! Can I suggest trying with https://github.com/ebitengine/purego instead of cgo?
I also found the following issue that might be of use: https://github.com/golang/go/issues/51007#issuecomment-1369090750
Could you try reproducing with Go 1.20+?
I'm sorry, I only had access to a amd64 Windows VM for a short period of time to test this. ATM I'm not able to setup a amd64 based Windows VM on my M1 Mac, so I can't reproduce this. Do you have access to a Windows machine to test this with 1.20+?
No, unfortunately. I was looking into the issue for https://github.com/cloudquery/cloudquery/issues/8854, but the builds take a couple of hours to complete with the results we already have (+ I believe, the code needs rebasing, as the DuckDB version in the branch is stale).
However, looking at the issue it seems that the thing to look at is this:
__imp_
prefixes indicate an attempt to link against DLL instead of static linking).Hi, I just try to using static link under windows.
//
// duckdb.h
//
//
//===----------------------------------------------------------------------===//
// duplicate of duckdb/main/winapi.hpp
5. comment out that part makes no link error when compile.
Maybe this is related? https://github.com/duckdb/duckdb/issues/12571
@ZenLiuCN Do you have more information on createing the static duckdb build and linking it to go?
I haven't found any instructions on a static build in github.com/duckdb/duckdb/blob/main/Makefile
I just merged https://github.com/marcboeker/go-duckdb/pull/248, which bundles a pre-compiled static library for Windows (using MingW). It will be part of the next go-duckdb release sometime next week.
mingw compiled static libs may not supports all official extensions. suggest that should be noted in readme.
Fair point, I already added a small note to the README
, but I'll extend it a bit. We're also looking into adding MingW distributions for our official extensions. We already build them for our Rtools
, so we might just have to generalize those.
Very good news for me. My last trying got blocked by mysql🤔
When compiling the amalgamation file to build a static library the compiler complains about
definition is marked dllimport
. Others have this problem too.But when adding a
-DDUCKDB_BUILD_LIBRARY
the errors and warnings are gone and the resultinglibduckdb.a
is successfully created. But linking agains it throws the following errors (for more examples see log.txt):This is very weird as the Darwin and Linux builds succeed. The code is located under https://github.com/marcboeker/go-duckdb/tree/windows-builds