Ship the iOS and web PDFium binaries inside the published artefacts - #13
Merged
Conversation
Maven consumers got `ld: library 'pdfium' not found` on iOS and `Can't resolve './pdfium_glue.mjs'` on web: the published klibs carried the Kotlin bindings but none of the binaries the linker and the bundler need. iOS now links a static libpdfium.a that cinterop packs into the klib (`staticLibraries` in pdfium.def), so nothing has to be embedded, signed or pointed at with -L. bblanchon ships Apple platforms as a dylib only, and the one prebuilt static archive available (paulocoutinhox/pdfium-lib) is compiled against Chromium's bundled libc++ without shipping its objects, so it fails to link with undefined `std::__Cr::` symbols. NucleusFramework/pdfium-binaries therefore runs bblanchon's own harness with `build_type=static` (`pdf_is_complete_lib = true`, `use_custom_libcxx = false`) and publishes an `ios-static-<build>` release per PDFium version, which installPdfiumIos downloads for the current pin. Web serves pdfium.wasm, the worker, the runtime and the glue from the archive root and evals the glue from Kotlin, so webpack no longer has to resolve `./pdfium_glue.mjs` and consumers need no copy task. PackagedBinariesTest locks both in, and the auto-release defers a version bump until the matching static iOS build is published.
Apple cinterop cannot run on a Linux host — KGP disables cross compilation for targets that declare cinterops — so :pdfium:check on ubuntu produced no iOS klibs and PackagedBinariesTest failed on an empty file collection. The iOS half now reports as skipped there and runs in a dedicated macOS pre-merge job, which is also the host that publishes. pdfium.dll.lib was tracked only because the `*.dll` ignore rule doesn't match it; installPdfiumJvmResources stages both Windows import libraries from the bblanchon archive on every build, so they were pure churn on each version bump.
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.
Closes #11.
Summary
Consumers of
dev.nucleusframework:pdfiumhitld: library 'pdfium' not foundon iOS andCan't resolve './pdfium_glue.mjs'on web — the published klibs shipped the Kotlin bindings but not the binaries the linker and the bundler need. Android and JVM already embedded theirs.iOS — a static archive packed into the klib
pdfium.defdeclaresstaticLibraries = libpdfium.awith per-targetlibraryPaths, so cinterop packs the archive intodefault/targets/<target>/included/. The machine code travels with the artefact: no-L, noThirdParty/drop, nopdfium.frameworkto embed, nothing to codesign, no extra Xcode build phase..dylibonly, and a dylib cannot be carried this way. The one prebuilt static archive available (paulocoutinhox/pdfium-lib) is compiled against Chromium's bundled libc++ but ships none of its objects, so it fails to link against Apple's libc++ with undefinedstd::__Cr::symbols.build_type=static— which setspdf_is_complete_lib = trueanduse_custom_libcxx = false, the combination that makes the archive self-contained. It syncs from upstream daily and publishes anios-static-<build>release per PDFium version (stripped: 16 MB per slice instead of 268 MB).:pdfium:installPdfiumIosdownloads the one matching thepdfium-bblanchonpin.pdfium-auto-releasenow defers a version bump until the matching static build exists, so master never points at a version the iOS cinterop cannot resolve.Web — assets at the archive root
pdfium.wasm,pdfium_worker.mjs,pdfium_runtime.mjsandpdfium_glue.mjsare published at the resource root instead of a nestedpdfium/directory, and the glue is eval'd from Kotlin rather than imported, so webpack no longer has to resolve./pdfium_glue.mjsand consumers need no copy task.Removed
dev.nucleusframework.pdfiumGradle plugin and itsincludeBuild, its CI publishing steps,EmbedPdfiumDylibTask, the klib zip-surgery task, and theLIBRARY_SEARCH_PATHSworkaround inConfig.xcconfig. The Xcode phase is back to the stockembedAndSignAppleFrameworkForXcode.Test plan
:pdfium:checkpasses (includes the newpackagingTest)packagingTestassertslibpdfium.ainside both published cinterop klibs, no-lpdfiumin the manifest, and the four web assets at the archive root — wired to the…Cinterop-pdfiumKlibpacking tasks so it reads the artefacts consumers actually get:example:linkDebugFrameworkIosArm64and…IosSimulatorArm64link withisStatic = trueisStatic = false(the configuration reported in Missing binaries #11);otool -Lshows nolibpdfiumdependency and the FPDF code is inside the binaryNote
Upstream builds the iOS objects with
minos 17.0, so apps targeting below iOS 17 get a benignld: warning: object file was built for newer iOS version. That was already the case with the dylib.