Giter Site home page Giter Site logo

windows cgo question about go-duckdb HOT 5 CLOSED

marcboeker avatar marcboeker commented on July 4, 2024
windows cgo question

from go-duckdb.

Comments (5)

dedisuryadi avatar dedisuryadi commented on July 4, 2024 4

Hope this help anyone who try to install this package on windows machine, you can try installing git-bash and mingw using chocolatey and then locate the the mingw lib directory, in my case it's on C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\lib then copy duckdb.dll there. You need to copy the duckdb header files (duckdb.h and duckdb.hpp?) to the root of go-duckdb directory, I am cloning this package btw, not installing it through go get

from go-duckdb.

marcboeker avatar marcboeker commented on July 4, 2024

Hi @sdmcallister,

as I don't have access to a Windows machine, I've tried to compile go-duckdb in a VM with the WSL. Unfortunately I'm getting an error, that the DuckDB library could not be found.

/usr/bin/ld: cannot find -lduckdb
collect2: error: ld returned 1 exit status

I think that it is not sufficient to only adjust the CGO_LDFLAGS and CGO_CFLAGS environment vars to point to the DuckDB library and header files. I've tried that and failed. There must be another way under windows to fix the library and include paths.

Unfortunately I have very little free time at the moment. Maybe you could try some Stackoverflow exploring for compiling CGO packages under the WSL and setting the CGO env vars properly.

Sorry, that I couldn't help you with this issue :(

from go-duckdb.

sdmcallister avatar sdmcallister commented on July 4, 2024

Thanks! I'll keep trying and if I have any success I'll be sure to post here.

from go-duckdb.

sdmcallister avatar sdmcallister commented on July 4, 2024

@dedisuryadi Thank for the help!

My solution was a bit different. I used go mod.

I downloaded the recent compiled release windows 64 C/C++ release:

https://github.com/cwida/duckdb/releases/download/v0.2.5/libduckdb-windows-amd64.zip

I copied the duckdb.h and duckdb.hpp into
C:\Users\me\go\pkg\mod\github.com\marcboeker\[email protected]

Then I copied the duckdb.dll into C:\Windows\System32

That seemed to work. Amazing!

@marcboeker Thank you for the working on this package!

from go-duckdb.

tixsys avatar tixsys commented on July 4, 2024

here is what u miss. -lduckdb.

assuming path-to-lib is patche where .dll, .h, .lib is present correct env params will be

CGO_CFLAGS=-Ipath-to-lib
CGO_LDFLAGS=-Lpath-to-lib -lduckdb

Anddd it works on windows :)

from go-duckdb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.