Fix standalone esminiJS WASM build: generate CommonMini/version.cpp#825
Open
jdsika wants to merge 1 commit into
Open
Fix standalone esminiJS WASM build: generate CommonMini/version.cpp#825jdsika wants to merge 1 commit into
jdsika wants to merge 1 commit into
Conversation
The esminiJS Emscripten/WASM target links CommonMini, whose CommonMini.cpp references ESMINI_GIT_REV, ESMINI_GIT_TAG, ESMINI_GIT_BRANCH and ESMINI_BUILD_VERSION. Those symbols are *defined* in a generated version.cpp (produced from version.cpp.in by CommonMini/version.cmake). The full esmini build generates it via CommonMini/CMakeLists.txt, but the standalone esminiJS build never did, so linking failed with "undefined symbol: ESMINI_GIT_REV" (and the other three) after all objects compiled. Invoke version.cmake from the esminiJS CMakeLists the same way CommonMini does (cmake -DESMINI_BUILD_VERSION=... -P version.cmake). The existing COMMONMINI_SOURCES glob then picks up the generated version.cpp, so no source list change is needed. Under a shallow checkout git describe yields nothing and the values resolve to "N/A", which is harmless. This makes the esminiJS WASM target build+link standalone (emcmake + Ninja). Refs: esmini#357 Signed-off-by: Carlo van Driesten <carlo.van-driesten@bmw.de>
jdsika
force-pushed
the
fix/esminijs-standalone-version
branch
from
July 24, 2026 11:34
f174540 to
c30b626
Compare
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.
Problem
Building the standalone esminiJS Emscripten/WASM target
(
EnvironmentSimulator/Libraries/esminiJS, per itsbuild.sh/CMakeLists.txt)compiles all objects but then fails to link:
Those symbols are referenced by
CommonMini.cppand defined in a generatedversion.cpp(produced fromversion.cpp.inbyCommonMini/version.cmake). Thefull esmini build generates it via
CommonMini/CMakeLists.txt, but the standaloneesminiJStarget never triggers that generation, soversion.cppis missing fromthe link.
Fix
Invoke
version.cmakefrom theesminiJSCMakeLists.txtexactly the wayCommonMini/CMakeLists.txtalready does(
cmake -DESMINI_BUILD_VERSION=... -P version.cmake). The existingCOMMONMINI_SOURCESglob then picks up the generatedCommonMini/version.cpp, sono source-list change is needed. 20 lines, one file.
Under a shallow checkout
git describeyields nothing and the values resolve to"N/A", which is harmless.Verification
With this change the
esminiJStarget builds and links standalone viaemcmake cmake -G Ninja -DCMAKE_BUILD_TYPE=Release+SINGLE_FILE=1, producing aworking
esmini.js. I ran it in headless Chromium:get_road_geometry()returnslane surfaces / lane centers and
step_frame()advances entities, withreset()restarting the run (endless-loop playback).
Refs #357.
Note
Happy to follow up on distribution (an npm package / a prebuilt WASM release asset)
if that's useful — there is currently no published artifact, which is the main thing
keeping downstream projects from consuming esminiJS directly.