Repository navigation
feat: add columnar-dbc Rust crates linking dbc statically - #548
Merged
Merged
Conversation
zeroshade
force-pushed
the
feat/rust-crates
branch
from
October 28, 2026 22:51
352affc to
9fa4004
Compare
zeroshade
force-pushed
the
feat/rust-crates
branch
from
October 28, 2026 23:29
9fa4004 to
c136c8b
Compare
zeroshade
force-pushed
the
feat/rust-crates
branch
from
October 29, 2026 17:07
9239767 to
99c1202
Compare
zeroshade
force-pushed
the
feat/rust-crates
branch
from
November 3, 2026 18:21
d200703 to
e74846d
Compare
zeroshade
marked this pull request as ready for review
November 3, 2026 19:27
amoeba
approved these changes
Nov 4, 2026
amoeba
left a comment
Member
There was a problem hiding this comment.
Generally I think this looks fine. I looked closer at some files than others and I expect I may have more review comments once this is all merged together.
zeroshade
added a commit
that referenced
this pull request
Nov 4, 2026
…and docs_url Address review on #548: - Client::install(name) installs where `dbc install` would without -l (InstallLocation::Default); install_at(name, &location) for an explicit level or directory. - Driver gains docs_url and registry. - Option keys come from libdbc.h's DBC_OPTION_* macros. - README is the crate docs, so its example is compiled as a doctest; wording per review.
zeroshade
added a commit
that referenced
this pull request
Nov 4, 2026
…and docs_url Address review on #548: - Client::install(name) installs where `dbc install` would without -l (InstallLocation::Default); install_at(name, &location) for an explicit level or directory. - Driver gains docs_url and registry. - Option keys come from libdbc.h's DBC_OPTION_* macros. - README is the crate docs, so its example is compiled as a doctest; wording per review.
zeroshade
force-pushed
the
feat/rust-crates
branch
from
November 4, 2026 15:23
ac2b992 to
1acb7b0
Compare
zeroshade
added a commit
that referenced
this pull request
Nov 4, 2026
On Unix, Go reads a copy of the environment taken when its runtime starts, and only its own os.Setenv updates it. A C, Rust, or Python host changes the environment through libc, so changes it made after libdbc loaded were ignored: e.g. Python setting os.environ["ADBC_DRIVER_PATH"] after import still installed to the user level (#548 review). config now reads the three variables through internal/hostenv, which defaults to os.LookupEnv; capi replaces it on Unix with libc getenv, so cgo stays in the C API build. Pure Go programs were already effectively live, and Windows reads the live process environment. The Rust default_location test now sets ADBC_DRIVER_PATH after startup instead of re-running itself, and fails against the previous libdbc.
felipecrv
approved these changes
Nov 4, 2026
zeroshade
added a commit
that referenced
this pull request
Nov 4, 2026
On Unix, Go reads a copy of the environment taken when its runtime starts, and only its own os.Setenv updates it. A C, Rust, or Python host changes the environment through libc, so changes it made after libdbc loaded were ignored: e.g. Python setting os.environ["ADBC_DRIVER_PATH"] after import still installed to the user level (#548 review). config now reads the three variables through internal/hostenv, which defaults to os.LookupEnv; capi replaces it on Unix with libc getenv, so cgo stays in the C API build. Pure Go programs were already effectively live, and Windows reads the live process environment. The Rust default_location test now sets ADBC_DRIVER_PATH after startup instead of re-running itself, and fails against the previous libdbc.
zeroshade
force-pushed
the
feat/rust-crates
branch
from
November 4, 2026 18:16
df93c6c to
b96796d
Compare
zeroshade
added a commit
that referenced
this pull request
Nov 4, 2026
On Unix, Go reads a copy of the environment taken when its runtime starts, and only its own os.Setenv updates it. A C, Rust, or Python host changes the environment through libc, so changes it made after libdbc loaded were ignored: e.g. Python setting os.environ["ADBC_DRIVER_PATH"] after import still installed to the user level (#548 review). config now reads the three variables through internal/hostenv, which defaults to os.LookupEnv; capi replaces it on Unix with libc getenv, so cgo stays in the C API build. Pure Go programs were already effectively live, and Windows reads the live process environment. The Rust default_location test now sets ADBC_DRIVER_PATH after startup instead of re-running itself, and fails against the previous libdbc.
amoeba
approved these changes
Nov 4, 2026
…http tiny_http 0.12 unwraps peer_addr() on accept; on Windows it fails with WSAENOTCONN when the client has already closed the connection, killing the worker and failing the next request with EOF.
…LIB_DIR Keep bundled platform crates as the default, with custom-directory and pkg-config overrides selecting static or opt-in dynamic linking. Move the MSVC Go initializer into the sys crate and reject non-x86_64 static MSVC links. pkg-config 0.3.34 parse_libs defaults the non-macOS/non-Windows system root to /usr, and is_static_available requires an archive path outside every system root. Thus statik(true) alone emits an unqualified link for /usr/lib/<triplet>/libdbc.a, allowing the shared library to win. Probe without Cargo link metadata and explicitly emit static=dbc, leaving private system libraries dynamic.
The default build now locates an installed libdbc through the dbc pkg-config module. The prebuilt platform crates move behind the `bundled` feature, and the `pkg-config` feature is removed since it is now the default. DBC_SYS_LIB_DIR and DBC_SYS_USE_PKG_CONFIG keep their precedence over `bundled`.
…and docs_url Address review on #548: - Client::install(name) installs where `dbc install` would without -l (InstallLocation::Default); install_at(name, &location) for an explicit level or directory. - Driver gains docs_url and registry. - Option keys come from libdbc.h's DBC_OPTION_* macros. - README is the crate docs, so its example is compiled as a doctest; wording per review.
columnar-dbc-sys accepted any installed dbc pkg-config module, so a crate built against an older or newer libdbc compiled and then failed at run time (unknown client options) or used shifted target ids. Require libdbc in [crate version, next minor) before 1.0 (next major after); the 0.0.0-dev repository placeholder stays unchecked. Document the requirement, and that DBC_SYS_LIB_DIR libraries can't be checked.
Co-authored-by: Felipe Oliveira Carvalho <[email protected]>
Co-authored-by: Felipe Oliveira Carvalho <[email protected]>
Per review on #548: - Generate the DBC_OPTION_* string macros as &CStr (bindgen --generate-cstr, c"..." literals), so with_config passes them to C without the runtime CStr::from_bytes_with_nul check. - Drop the crate's Result alias; signatures spell out std::result::Result<T, Error>.
zeroshade
added a commit
that referenced
this pull request
Nov 4, 2026
On Unix, Go reads a copy of the environment taken when its runtime starts, and only its own os.Setenv updates it. A C, Rust, or Python host changes the environment through libc, so changes it made after libdbc loaded were ignored: e.g. Python setting os.environ["ADBC_DRIVER_PATH"] after import still installed to the user level (#548 review). config now reads the three variables through internal/hostenv, which defaults to os.LookupEnv; capi replaces it on Unix with libc getenv, so cgo stays in the C API build. Pure Go programs were already effectively live, and Windows reads the live process environment. The Rust default_location test now sets ADBC_DRIVER_PATH after startup instead of re-running itself, and fails against the previous libdbc.
zeroshade
force-pushed
the
feat/rust-crates
branch
from
November 4, 2026 20:02
b96796d to
f3a2557
Compare
zeroshade
added a commit
that referenced
this pull request
Nov 4, 2026
- `.goreleaser.yaml` gains a `capi` c-archive build that cross-compiles all 5 targets with Zig 0.17.0 (glibc 2.28 / macOS 12 floors). - `scripts/stage_capi.py` checks size and stages each archive; `scripts/publish_crates.py` runs `cargo package` (snapshot) or `cargo publish` (on `v*` tag pushes, from the `production_deploy` GoReleaser run). Publishing skips crate versions already on crates.io, so re-running a partially published release finishes the rest. `ids: [dbc]` filters keep the archives out of the CLI packaging. - New `rust_test` job runs on the snapshot's archives on six native runners (Linux x64/arm64, macOS arm64/x64, Windows MSVC and GNU), with a 30-minute timeout. - Needs a `CARGO_REGISTRY_TOKEN` secret in the `production` environment (see RELEASE.md). Stacked on #548. Supersedes #543. ### libdbc-dev / libdbc-devel - A new `capi-shared` build (linux amd64/arm64, SONAME `libdbc.so`). - Two nfpm entries: deb `libdbc-dev` (`/usr/lib/<triplet>`) and rpm `libdbc-devel` (`/usr/lib64`). Each ships `libdbc.a`, `libdbc.so`, `/usr/include/libdbc.h` and `pkgconfig/dbc.pc`. - `scripts/stage_devel.py` stages the `.so` and `.pc` files. - nfpm takes only the c-archive build's artifacts, because both builds emit `libdbc.h` and GoReleaser doesn't deduplicate. - The packages ship in `release`, `blobs`, and Cloudsmith (`columnar/dbc`, alongside the CLI packages; stable releases only). New CI job `devel packages` (amd64 + arm64): - installs the snapshot `.deb`; - runs the Rust tests with the default build (pkg-config, statically linked, checked with `ldd`), with `DBC_DYNAMIC`, and with `DBC_SYS_LIB_DIR` (`scripts/test_devel_rust.sh`); - installs the `.rpm` in a Fedora container, runs the same Rust tests against it, and compiles and runs a C smoke program, statically and dynamically. ### Docs - `docs/getting_started/installation.md` gains a "Linux Package Repositories (deb/rpm)" section: adding the Cloudsmith `columnar/dbc` apt/dnf repo (setup script or manual config), installing `dbc` / `libdbc-dev` / `libdbc-devel`, or installing a file from GitHub Releases. Linked from the README. - The `columnar-dbc` / `columnar-dbc-sys` rustdoc and crate README explain installing the dev package from the repo or from GitHub Releases, with links to the repo, releases, and install docs. ### macOS / Windows static libdbc-dev - New `libdbc-dev` archive from the `capi` build: `libdbc-dev_<v>_darwin_{amd64,arm64}.tar.gz` and `libdbc-dev_<v>_windows_amd64.zip` with `libdbc.a` (`libdbc.lib` on Windows), `libdbc.h`, `LICENSE`, and a relocatable `dbc.pc` (`prefix=${pcfiledir}`). Attached to the release and the bucket. - `libdbc` Homebrew formula via GoReleaser `brews` → `columnar-tech/homebrew-tap` (`brew install columnar-tech/tap/libdbc`). `brews` is deprecated in favor of casks, but casks can't install into `lib/`/`include/`, so a formula is the only option for a library. - Windows zip → Cloudsmith raw package `libdbc-dev-windows-x64` via a `cloudsmith-raw` custom publisher (`scripts/publish_cloudsmith_raw.py`); the `cloudsmiths` pipe only handles deb/rpm/apk. Stable releases only. - `DBC_SYS_LIB_DIR` accepts `libdbc.lib` on Windows. winget is now restricted to the CLI archives (it otherwise skips with "multiple archives for the same platform"). - New CI job `devel archive`: on macOS arm64/x64 installs the snapshot formula from a local tap, runs `brew test`, and runs the Rust suite with the default pkg-config build; on Windows MSVC/GNU runs the Rust suite against the unpacked zip with `DBC_SYS_LIB_DIR`.
zeroshade
added a commit
that referenced
this pull request
Nov 4, 2026
On Unix, Go reads a copy of the environment taken when its runtime starts, and only its own os.Setenv updates it. A C, Rust, or Python host changes the environment through libc, so changes it made after libdbc loaded were ignored: e.g. Python setting os.environ["ADBC_DRIVER_PATH"] after import still installed to the user level (#548 review). config now reads the three variables through internal/hostenv, which defaults to os.LookupEnv; capi replaces it on Unix with libc getenv, so cgo stays in the C API build. Pure Go programs were already effectively live, and Windows reads the live process environment. The Rust default_location test now sets ADBC_DRIVER_PATH after startup instead of re-running itself, and fails against the previous libdbc.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
rust/:columnar-dbc(safe API),columnar-dbc-sys(bindgen 0.73.2 bindings generated fromlibdbc.h, committed) and fivecolumnar-dbc-sys-<platform>crates, each bundling a prebuiltlibdbc.a. Supported targets: x86_64/aarch64 Linux (glibc), x86_64/aarch64 macOS,x86_64-pc-windows-msvcandx86_64-pc-windows-gnu. Other targets fail at build time.MSVC: a Go c-archive registers its runtime entry in
.ctors, which only the MinGW CRT runs. Under MSVC the first dbc call blocked forever. The Windows platform crate registers_rt0_amd64_windows_libin.CRT$XCUfortarget_env = "msvc". A localcargo xwinlink map shows the pointer in the CRT'sXCA..XCZinitializer table. CI in the top PR of the stack runs the tests.Stacked on #547.
Linking libdbc
Modeled on
zstd-sys, with pkg-config as the default. The source is chosen in this order:DBC_SYS_LIB_DIR=<dir>: a custom directory.DBC_SYS_USE_PKG_CONFIGset: pkg-config moduledbc, even withbundledon.bundledfeature: the per-platform prebuilt crates.dbc.By default the platform crates aren't downloaded at all;
features = ["bundled"]opts into them. Env overrides win even whenbundledis on: the platform crate is neverextern crated, so its archive isn't linked. docs.rs builds withbundledsince it has no installed libdbc.Linking is static by default;
DBC_DYNAMIC(pkg-config-rs's own convention) linkslibdbc.so. pkg-config-rs refuses static links for archives under/usr, sobuild.rsemits the link directives itself rather than using.statik(true).The MSVC Go runtime initializer moved from the Windows platform crate into
-sys. It's applied to any static x86_64 MSVC link, and static MSVC links on other architectures fail with a clear error.