Giter Site home page Giter Site logo

Comments (6)

begelundmuller avatar begelundmuller commented on June 26, 2024 1

I'm happy to hear that. We'd be happy to submit a PR for you to test and will try to prioritise it within a few weeks.

from go-duckdb.

marcboeker avatar marcboeker commented on June 26, 2024

Hi @begelundmuller,

thank you for reaching out and thanks for you kind words. Go DuckDB is made possible by many different contributors.

The idea sounds great to me. Especially if we can drop an external dependency. I think we have to test this and see if it works on all major the platforms (macOS, Linux and Windows).

Would it be OK for you, if you submit a PR and we test drive it?

Thanks in advance!

from go-duckdb.

begelundmuller avatar begelundmuller commented on June 26, 2024

This has now been merged: #40

The PR also includes pre-compiled static libraries inspired by https://github.com/rogchap/v8go. This means that on supported platforms, you get static binaries without having to wait for DuckDB to compile from source.

from go-duckdb.

LasseJacobs avatar LasseJacobs commented on June 26, 2024

@begelundmuller could you explain why having a single source file makes it easier to statically link? I thought this would not matter since in both cases (single vs multiple source files) you end up with a single archive file (.a)? But indeed I am unable to statically link the libduckdb_static.a file duckdb produces when I build it from source, while the archive file produced from the single file links statically without a problem.

I would like to understand why this is the case.

from go-duckdb.

begelundmuller avatar begelundmuller commented on June 26, 2024

Hey @LasseJacobs, you're right that simply having one source file instead of multiple source files does not itself make a difference to our ability to compile from source or statically link an archive.

The DuckDB amalgamation is convenient because DuckDB is an extensive project with many source files and dependencies. Their build process requires CMake and might change at any time. The point of the amalgamation is to reduce this complexity to a single file with no dependencies that can be compiled using just a C++ compiler.

So by using the amalgamation, we both reduce build complexity and get a "contract" with the DuckDB project that's less likely to break. In fact, the amalgamation is published as part of every release, so we just pull it from their release artifacts.

Now about the static library, you're right that DuckDB outputs a libduckdb_static.a file when you compile it from source. I actually investigated using that instead of building the static libraries from the amalgamation. However, it turns out that libduckdb_static.a doesn't include DuckDB's dependencies, which are compiled as separate archive files (you can find them in the build output if you search for .a files). You have to statically link all of them (in the right order) to make it work – which would tie us into DuckDB's current build setup, which is likely to change.

Therefore, it felt safer to just compile the amalgamation to a static library ourselves (it's not that complicated). If DuckDB ever decides to publish static libraries as part of their release artifacts (currently they only publish shared libraries), I would probably reconsider this.

from go-duckdb.

LasseJacobs avatar LasseJacobs commented on June 26, 2024

@begelundmuller very clear now! Thanks.

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.