Skip to content

A fast, helpful, and open-source document parser

chore: switch pdfium musl to the actual musl build

Clelia (Astra) Bertelli7cba797800fd
diff --git a/Cargo.lock b/Cargo.lock
index cb368c8..ae144e2 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1248,7 +1248,7 @@ dependencies = [
[[package]]
name = "liteparse-pdfium-sys"
-version = "1.0.0"
+version = "1.0.1"
dependencies = [
"bindgen",
"flate2",
diff --git a/crates/pdfium-sys/Cargo.toml b/crates/pdfium-sys/Cargo.toml
index b2d4f9d..201e4cc 100644
--- a/crates/pdfium-sys/Cargo.toml
+++ b/crates/pdfium-sys/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "liteparse-pdfium-sys"
-version = "1.0.0"
+version = "1.0.1"
edition.workspace = true
license.workspace = true
repository.workspace = true
diff --git a/crates/pdfium-sys/build.rs b/crates/pdfium-sys/build.rs
index e7349f1..c5c44b5 100644
--- a/crates/pdfium-sys/build.rs
+++ b/crates/pdfium-sys/build.rs
@@ -141,7 +141,8 @@ fn pdfium_asset_stem() -> &'static str {
"aarch64-apple-darwin" => "pdfium-mac-arm64",
"x86_64-apple-darwin" => "pdfium-mac-x64",
// Universal macOS binary works for both, but we prefer arch-specific
- "x86_64-unknown-linux-gnu" | "x86_64-unknown-linux-musl" => "pdfium-linux-x64",
+ "x86_64-unknown-linux-gnu" => "pdfium-linux-x64",
+ "x86_64-unknown-linux-musl" => "pdfium-linux-musl-x64",
"aarch64-unknown-linux-gnu" | "aarch64-unknown-linux-musl" => "pdfium-linux-arm64",
"armv7-unknown-linux-gnueabihf" => "pdfium-linux-arm",
"x86_64-pc-windows-msvc" | "x86_64-pc-windows-gnu" => "pdfium-win-x64",
diff --git a/scripts/build-musl-node.sh b/scripts/build-musl-node.sh
index f936010..022a74f 100644
--- a/scripts/build-musl-node.sh
+++ b/scripts/build-musl-node.sh
@@ -57,5 +57,14 @@ for needed in $(ldd "$NODE_FILE" 2>/dev/null | awk '{print $1}' | grep -E '^lib'
cp -v "$src" "./$needed"
done
+# NOTE: the prebuilt libpdfium.so from run-llama/pdfium-binaries is a glibc
+# binary. To run it on musl (Alpine), the user MUST have the gcompat package
+# installed (`apk add gcompat`). gcompat provides:
+# - the glibc dynamic loader at /lib/ld-linux-x86-64.so.2
+# - the FORTIFY_SOURCE wrapper symbols (__memcpy_chk, __vsnprintf_chk, ...)
+# This is a runtime requirement of the musl @llamaindex/liteparse-linux-x64-musl
+# package and is documented in the npm package README. Until the pdfium-binaries
+# fork ships a musl-native build, this is the practical path forward.
+
echo "Bundled libs in $(pwd):"
-ls -la *.so* *.node
+ls -la *.so* *.node 2>/dev/null