Add duckdb recipe for emscripten#4983
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The applied patch makes the source tree dirty, causing duckdb's custom setuptools_scm version scheme to fail with "Dev distance is 0, cannot bump version." Setting SETUPTOOLS_SCM_PRETEND_VERSION bypasses the scm detection entirely. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DuckDB's setuptools_scm version scheme errors when distance=0 and dirty=True (which happens because we apply patches). The version scheme tries to bump a dev version but fails since distance is 0. Fix by treating distance=0 as a tag release regardless of dirty state. Also removes the SETUPTOOLS_SCM_PRETEND_VERSION workaround since duckdb explicitly strips that env var. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
duckdb's CMake falls back to CMAKE_INSTALL_LIBDIR when SKBUILD_PLATLIB_DIR is not detected, placing _duckdb.so in a lib/ subdirectory under site-packages. Move it to the correct location after install so that `import duckdb` can find the native module. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The .so was being built as a regular wasm module instead of a side module, so it couldn't be dynamically loaded. Add -sSIDE_MODULE=1 and -sWASM_BIGINT flags to ensure the native extension is built as a relocatable side module that can be loaded at runtime. Also removes the lib/ path workaround and CMAKE_INSTALL_LIBDIR override since SIDE_MODULE linking may change the install behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
scikit-build-core drives CMake, so env vars alone aren't enough. Use the established emscripten-forge pattern: set up the Emscripten toolchain file and a CMAKE_PROJECT_INCLUDE that tells CMake shared libs are supported and should be built as SIDE_MODULE with WASM_BIGINT. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
wasm-ld doesn't support --export-dynamic-symbol. DuckDB's CMake hits the "UNIX AND NOT APPLE" branch for Emscripten, which passes these unsupported flags. Add an EMSCRIPTEN guard to skip them. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DuckDB's CMake links libduckdb_static.a twice to resolve circular dependencies between the core library and extensions. Native linkers handle this fine, but with LTO enabled wasm-ld merges all objects and reports duplicate symbol errors. Disable interprocedural optimization to work around this. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
DuckDB links libduckdb_static.a twice in the link command to resolve circular dependencies between core and extensions. Native linkers handle repeated archives by processing them left-to-right, but wasm-ld treats duplicate definitions as errors regardless of LTO settings. Pass --allow-multiple-definition to wasm-ld. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
duckdb._version uses importlib.metadata.version("duckdb") to get the
package version at import time. Excluding .dist-info removes the
metadata that makes this work.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@IsabelParedes it works! The lint problem is due to using |
| source: | ||
| git: https://github.com/duckdb/duckdb-python.git | ||
| tag: v${{ version }} | ||
| # expected_commit: a12f36ca411007f5eb48919448f61c7498112553 |
There was a problem hiding this comment.
If you allow --experimental, this would work and "pin" the tag to a commit.
There was a problem hiding this comment.
We do allow experimental for a couple of recipes, you could add this package too
Lines 19 to 20 in 2e05d5e
We try to avoid git sources because the Version Bot currently cannot update packages that do not have |
Template A: Checklist for adding a package
Pre-submission Checks
emscripten-wasm32platform (not a noarch package), in other words, the package requires compilation.Recipe Structure
Added
recipes/recipes_emscripten/[package-name]/recipe.yamlwith proper structure:contextsection withversion(and optionallyname)packagesection with name and version using Jinja2 templatessourcesection with:.tar.gz,.tar.bz2,.tar.xz,.tgz, or.zip)${{ version }}template for version updatescurl -sL <url> | sha256sum)[package-name]/patches/directorybuildsection with appropriate script/method${PYTHON} -m pip install . ${PIP_ARGS}$R CMD INSTALL $R_ARGS .emcmake/emmakeoremconfigure/emmakerust-nightlyandmaturinor appropriate Rust build toolrequirementssection (build, host, run as needed)testssectiontest_import_[package].pyfile created and referencedaboutsection with license, homepage, summaryTemplate B: Checklist for updating a package
PR Formatting
Add [package-name]orUpdate [package-name] to [version]Package Details
Build Notes