Repository navigation
fix(cmake): make the static wasm export relocatable (ImageMagick + zstd) - #453
Merged
Merged
Conversation
The published wasm libcvc bundle baked 15 BUILD-MACHINE absolute paths into
cvc::cvc's exported INTERFACE_LINK_LIBRARIES — libMagick++, libMagickCore, the
codec delegates (bz2/jpeg/png16/webp{,mux,demux,decoder}/sharpyuv/tiff/xml2/
lzma/Lerc), and libzstd — all under /home/runner/work/libcvc/libcvc/wasm-deps/.
Every relocated consumer's link then died with e.g.
ninja: error: '.../wasm-deps/lib/libMagick++-7.Q16HDRI.a', needed by
'bin/dbg_austin_live.js', missing and no known rule to make it
which is why the cvcdbg wasm demo3 gallery could never link/deploy (the deps
resolve error just failed first and masked it). Native/macOS/Windows were fine:
they link config-mode imported targets, so the export names ImageMagick::Magick++
etc. — relocatable — which cvcConfig.cmake.in already re-resolves.
Root cause: for a STATIC cvc (wasm --link static) even PRIVATE link deps
propagate to consumers as $<LINK_ONLY:...>, so the raw-libs ImageMagick fallback
(target_link_libraries cvc PUBLIC ${ImageMagick_LIBRARIES}), the delegate loop's
PRIVATE find_library links, and the zstd PRIVATE find_library link all baked
absolute paths into the export. The 'PRIVATE keeps it out of the interface'
assumption only holds for a SHARED lib.
Fix — make wasm behave like native (export relocatable target names):
- ImageMagick: in the raw-libs path, synthesise the ImageMagick::Magick++ /
::MagickCore UNKNOWN IMPORTED targets from the found libs and link those; the
delegate loop (now gated on the new _cvc_im_rawlibs flag, since the targets now
exist) hangs each delegate off MagickCore's interface. Imported-target
IMPORTED_LOCATIONs are build-local and never written to install(EXPORT), so the
export names only the two relocatable targets. cvcConfig.cmake.in already
recreates them (with the delegate closure) in each consumer's own prefix.
- zstd: synthesise PkgConfig::ZSTD from the find_library path instead of linking
it raw, and add zstd re-resolution to cvcConfig.cmake.in (the consumer had
none), mirroring the existing FFTW3 handling.
Mirrors the existing assimp::assimp relocatable-export handling in this file.
No behaviour change on native/macOS/Windows (they take the config-mode target
path; the new branches only run in the raw-libs fallback).
transfix
added a commit
that referenced
this pull request
Sep 28, 2026
…t fix (#456) libcvc #453 makes the STATIC wasm export relocatable, but the already-published wasm-mt bundles (libcvc +cvc.4, cvcgl +cvc.5) still carry the baked absolute paths — a recipe/source fix can't rewrite a published archive. Reship both: - libcvc 4 -> 5: clean cvcTargets.cmake wasm-mt export (no /home/runner abs paths). - cvcgl 5 -> 6: rebuild against + re-pin libcvc +cvc.5. cvcgl exact-pins the libcvc it built against, so the published +cvc.5 pins the broken +cvc.4; without this bump, installing cvc/cvcgl drags +cvc.4 back in and demo3 still fails. Native is unaffected (publish-cvcpkg auto-bumps above the recipe floor). After merge: run publish-cvcgl-wasm (dry_run=false) to ship the pair.
transfix
added a commit
that referenced
this pull request
Sep 28, 2026
…ers + reship (#457) After the relocatable-export fix (#453) the wasm demo consumer got PAST the abs-path error but failed to LINK with undefined BZ2_*/lzma_*/xmlReadMemory/xmlFreeDoc symbols: libMagickCore needs the bz2/lzma/xml2 codec delegates, and they were absent from the consumer's link line. Cause: cvcConfig.cmake.in appends the ImageMagick static delegate closure to MagickCore only when _cvc_im_synth is set — i.e. only when the pkg-config or last-resort tier synthesised the target. But on a wasm consumer the STOCK FindImageMagick tier wins (it finds the static -7.Q16HDRI libs in the prefix via find_library) and creates a delegate-LESS MagickCore without setting the flag, so the append was skipped and the delegates never made the link line. Fix: gate the delegate append on the MagickCore target existing, not on _cvc_im_synth. The append is self-guarding (find_library per delegate, missing ones skipped) and a harmless dedup for a shared ImageMagick, so it is safe to run for any MagickCore that reaches it. Verified locally against the reshipped wasm prefix: MagickCore's interface now carries libbz2/liblzma/libxml2 (+ jpeg/png/webp/tiff/sharpyuv/Lerc/z). Reship to embed the corrected consumer config: - libcvc 5 -> 6 (ships fixed cvcConfig.cmake.in) - cvcgl 6 -> 7 (rebuild + re-pin against libcvc +cvc.6; exact-pin means the old +cvc.6 cvcgl still pins the +cvc.5 libcvc with the broken consumer config) After merge: publish-cvcgl-wasm (dry_run=false) -> re-run cvcdbg demo3 nightly.
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.
The bug
The published wasm libcvc bundle bakes 15 build-machine absolute paths into
cvc::cvc's exportedINTERFACE_LINK_LIBRARIES(verified by installing the published bundle and greppingcvcTargets.cmake):Every relocated consumer's link then dies with:
This is why a downstream wasm demo gallery built against the published bundle could never link/deploy — the deps-resolve error just failed first and masked it. (
Boost::*andassimp::assimpexport correctly as relocatable targets; the assimp zlib fix works.)Root cause
For a static cvc (
wasm --link static) even PRIVATE link deps propagate to consumers as$<LINK_ONLY:...>. On wasm the stockfind_package(ImageMagick)produces no imported targets, so the raw-libs fallback links${ImageMagick_LIBRARIES}(abs) PUBLIC, the delegate loop links each codec abs path PRIVATE, and zstd links its abs path PRIVATE — all baked into the export. The "PRIVATE keeps it out of the interface" assumption only holds for a shared lib. Native/macOS/Windows are unaffected (config-mode imported targets → export namesImageMagick::Magick++etc.).Fix (make wasm behave like native — export relocatable target names)
ImageMagick::Magick++/::MagickCoreUNKNOWN IMPORTED targets and link those; delegates (loop now gated on the new_cvc_im_rawlibsflag) hang offMagickCore's interface. Imported-target locations are build-local and never written toinstall(EXPORT), so the export names only the two relocatable targets — whichcvcConfig.cmake.inalready recreates (with the delegate closure) in each consumer's prefix.PkgConfig::ZSTDinstead of linking the raw path, and add zstd re-resolution tocvcConfig.cmake.in(it had none), mirroring the existing FFTW3 handling.Mirrors the existing
assimp::assimprelocatable-export handling in the same file. No behaviour change on native/macOS/Windows (they take the config-mode path; the new branches run only in the raw-libs fallback).Verification
cvcTargets.cmakeexport inspection confirms the abs paths are gone (in progress).publish-cvcgl-wasmand relink a downstream wasm consumer against it.Coordinated with the wasm-recipe owner (no file overlap; this is a prerequisite for the held wasm-SDL3 work, which will inherit the clean export).