Skip to content

pampa - make quarto-system-runtime optional via filters feature#192

Merged
cscheid merged 1 commit into
quarto-dev:mainfrom
rundel:feature/pampa-optional-runtime
May 14, 2026
Merged

pampa - make quarto-system-runtime optional via filters feature#192
cscheid merged 1 commit into
quarto-dev:mainfrom
rundel:feature/pampa-optional-runtime

Conversation

@rundel
Copy link
Copy Markdown
Contributor

@rundel rundel commented May 14, 2026

Context

I've been playing around with building an R wrapper around q2/pampa and I've run into an issue building it on linux. See https://github.com/rundel/q2r if interested.

Issue

Library consumers of pampa that use only the parser and writer cannot build on Linux. pampa::unified_filter is unconditionally exposed from lib.rs and imports quarto_system_runtime::SystemRuntime, which transitively pulls deno_core and the v8 prebuilt static archive. default-features = false on pampa does not drop this — quarto-system-runtime is a non-optional workspace dep.

The Linux x86_64 v8 static was compiled with the local-exec TLS model, so linking it into a consumer's cdylib fails. macOS escapes this because Mach-O TLS goes through a runtime descriptor lookup that's identical in executables and dylibs.

$ cargo tree --no-default-features -i deno_core
deno_core v0.376.0
└── quarto-system-runtime v0.1.0
    └── pampa v0.0.0
        └── <consumer-cdylib>

$ cargo build --lib   # consumer crate-type = ["cdylib", "staticlib"]
/usr/bin/ld: target/debug/libconsumer.a(api.o): relocation R_X86_64_TPOFF32 against
  hidden symbol `_ZN2v88internal18g_current_isolate_E' can not be used when making
  a shared object
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

Sketch of fix

Feature-gate quarto-system-runtime in crates/pampa/Cargo.toml (mark optional = true), add a filters feature that pulls it in, gate pub mod unified_filter; and pub mod citeproc_filter; in crates/pampa/src/lib.rs behind that feature, and make the existing json-filter and lua-filter features depend on filters. Default features stay as today, so binary and existing library consumers see no change. Parser-only consumers can then opt out with default-features = false.

Library consumers that only need the parser and writers could not build
on Linux x86_64 as a `cdylib` because pampa unconditionally re-exported
`unified_filter`, which pulls `quarto-system-runtime` → `deno_core` →
the prebuilt v8 static archive. Linking v8's local-exec TLS into a
shared object fails with `R_X86_64_TPOFF32`.

Gate the filter pipeline behind a new `filters` feature: mark
`quarto-system-runtime` optional, gate `pub mod citeproc_filter` and
`pub mod unified_filter` on `feature = "filters"`, and route both
`json-filter` and `lua-filter` through it. Default features are
unchanged, so binaries and existing library consumers see the same
dep graph. Parser-only consumers can opt out with
`default-features = false`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cscheid
Copy link
Copy Markdown
Member

cscheid commented May 14, 2026

Without any further inspection than a cursory read of the report, this is strange to me, because we build on Linux in CI all the time...

@rundel
Copy link
Copy Markdown
Contributor Author

rundel commented May 14, 2026

The build issue is not with pampa but with the q2r R package - when I try linking against the rust crates it creates the linking error with deno -> v8.

@cscheid
Copy link
Copy Markdown
Member

cscheid commented May 14, 2026

Ah! Gotcha, I understand it now. I think this makes sense for us to do right now, but I can't really guarantee that we won't violate this in the future!

I would like to figure out a way to be able to make that promise such that we can keep the commitment, but our focus isn't currently in making these libraries easy to link against for developers.

@rundel
Copy link
Copy Markdown
Contributor Author

rundel commented May 14, 2026

Totally fine by me - I dont need any guarantees at all, this is all a toy for me to play with for the foreseeable future.

Definitely something nice to have eventually once everything is stable and working.

@cscheid cscheid merged commit 2c283f2 into quarto-dev:main May 14, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants