Fix libopenmpt WASM builds: STATIC_LIB=1 and tarball vendor#263
Conversation
OpenMPT's emscripten config sets STATIC_LIB=0, so make produced shared .js artifacts but never bin/libopenmpt.a. scripts/build-wasm.sh then failed path resolution even when headers were present. - Force STATIC_LIB=1 and build bin/libopenmpt.a explicitly - Switch scripts/build-wasm.sh to the 0.8.4 release tarball (not git clone) - Remove/replace broken vendor/libopenmpt trees automatically - Improve missing-header vs missing-lib diagnostics - Apply the same STATIC_LIB fix to root build-wasm.sh Co-authored-by: Noah Cohn <noahc42@gmail.com>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refactors the libopenmpt acquisition strategy for Emscripten builds from GitHub cloning to a vendored, version-pinned tarball download approach. It introduces environment and make-flag standardization, new validation and download helpers, configurable override support, and centralizes failure diagnostics. ChangesLibopenmpt Emscripten Build Refactor
Sequence Diagram(s)sequenceDiagram
participant Build as build-wasm.sh<br/>entry point
participant Ensure as ensure_libopenmpt()
participant Resolve as resolve_libopenmpt_paths()
participant Validate as is_valid_openmpt_source()
participant Download as download_libopenmpt_tarball()
participant BuildInPlace as build_libopenmpt_in_place()
participant Report as report_libopenmpt_failure()
Build->>Ensure: call ensure_libopenmpt
Ensure->>Resolve: check LIBOPENMPT_DIR and vendor paths
Resolve-->>Ensure: return found or missing paths
alt External LIBOPENMPT_DIR valid
Ensure->>Ensure: use external source
else Vendor tree exists
Ensure->>Validate: check source validity
Validate-->>Ensure: valid or incomplete
alt Incomplete vendor
Ensure->>Ensure: remove vendor/legacy dirs
end
else Vendor missing or invalid
Ensure->>Download: fetch pinned tarball from lib.openmpt.org
Download-->>Ensure: extracted to vendor
end
Ensure->>Ensure: check if libopenmpt.a exists
alt Library missing
Ensure->>BuildInPlace: build with STATIC_LIB=1 flags
BuildInPlace-->>Ensure: library created
end
alt Path resolution or build fails
Ensure->>Report: send failure with diagnostics
Report-->>Build: error exit
else Success
Ensure-->>Build: resolved include/lib paths
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
WASM builds failed at the libopenmpt stage with:
Root causes:
config-emscripten.mksetsSTATIC_LIB=0, somake CONFIG=emscriptenbuilds shared.jsoutputs but notbin/libopenmpt.a, whichemcc -lopenmptrequires.vendor/libopenmptcheckouts had no usable headers/libs.build:worklet) —libopenmpt-0.8.4+release.makefile.tar.gzextracts tolibopenmpt-0.8.4+release/.Fix
STATIC_LIB=1 SHARED_LIB=0and targetbin/libopenmpt.aexplicitlyscripts/build-wasm.shdownloads the 0.8.4 release tarball tovendor/libopenmpt-0.8.4+releasevendor/libopenmptlegacy trees.aSTATIC_LIB=1fix applied to rootbuild-wasm.shHow to verify
source /path/to/emsdk/emsdk_env.sh rm -rf vendor/libopenmpt vendor/libopenmpt-0.8.4+release npm run build:emcc npm run build:workletSummary by CodeRabbit