Hi there, I am trying to compile this project into a WASM module with the associated JS loader/import object so that I can use it in a bigger project as an ES module. So far I've just been trying to follow the instructions on emscripten.org and webassembly.org to get set up, but I can't get this to build. Here's how my environment is set up:
$ emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.16
clang version 6.0.1 (emscripten 1.38.16 : 1.38.16)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Users/matt/Sites/juj/emsdk/clang/e1.38.16_64bit
INFO:root:(Emscripten: Running sanity checks)
Here's the toolchain stuff:
$ python --version
Python 2.7.15
$ node --version
v8.9.1
$ git --version
git version 2.19.1
$ java -version
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.0 (clang-1000.11.45.5)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ g++
clang: error: no input files
$ cmake
Usage
cmake [options] <path-to-source>
cmake [options] <path-to-existing-build>
Specify a source directory to (re-)generate a build system for it in the
current working directory. Specify an existing build directory to
re-generate its build system.
Run 'cmake --help' for more information.
I got the "Hello, world!\n" example project working fine, but when I try to follow the instructions for this project I get this:
$ /Users/matt/Sites/juj/emsdk/emscripten/1.38.16/emmake make VERSION=latest
/Users/matt/Sites/juj/emsdk/emscripten/1.38.16/em++ -s MODULARIZE=1 -s 'EXPORT_NAME="Box2D"' -s NO_FILESYSTEM=1 -s EXPORT_BINDINGS=1 -s RESERVED_FUNCTION_POINTERS=20 --post-js box2d_glue.js --memory-init-file 0 -s NO_EXIT_RUNTIME=1 glue_stub.cpp -s EXPORTED_RUNTIME_METHODS=[] -O3 --llvm-lto 1 --closure 1 -IBox2D_v2.3.1 box2d.bc -o build/Box2D_v2.3.1_min.js
error: undefined symbol: _ZN12b2ChainShape5ClearEv
warning: To disable errors for undefined symbols use `-s ERROR_ON_UNDEFINED_SYMBOLS=0`
error: undefined symbol: _ZN12b2MotorJoint11SetMaxForceEf
error: undefined symbol: _ZN12b2MotorJoint12SetMaxTorqueEf
error: undefined symbol: _ZN12b2MotorJoint15SetLinearOffsetERK6b2Vec2
error: undefined symbol: _ZN12b2MotorJoint16SetAngularOffsetEf
error: undefined symbol: _ZN12b2MotorJoint19SetCorrectionFactorEf
error: undefined symbol: _ZN15b2MotorJointDef10InitializeEP6b2BodyS1_
error: undefined symbol: _ZN6b2Body16SetFixedRotationEb
error: undefined symbol: _ZNK12b2MotorJoint11GetMaxForceEv
error: undefined symbol: _ZNK12b2MotorJoint12GetMaxTorqueEv
error: undefined symbol: _ZNK12b2MotorJoint15GetLinearOffsetEv
error: undefined symbol: _ZNK12b2MotorJoint16GetAngularOffsetEv
error: undefined symbol: _ZNK12b2MotorJoint19GetCorrectionFactorEv
error: undefined symbol: _ZNK13b2PulleyJoint17GetCurrentLengthAEv
error: undefined symbol: _ZNK13b2PulleyJoint17GetCurrentLengthBEv
error: undefined symbol: _ZTI15b2ContactFilter
Error: Aborting compilation due to previous errors
ERROR:root:'/Users/matt/Sites/juj/emsdk/node/8.9.1_64bit/bin/node /Users/matt/Sites/juj/emsdk/emscripten/1.38.16/src/compiler.js /tmp/tmpbov1fu.txt /Users/matt/Sites/juj/emsdk/emscripten/1.38.16/src/library_pthread_stub.js' failed (1)
make: *** [box2d.js] Error 1
I'm pretty inexperienced with C/C++ and this whole toolchain is kinda foreign to me, but what I'd really like is something like this:
WebAssembly
.instantiateStreaming(fetch('box2d.wasm'), importObject)
.then(obj => {
// obj.instance (or maybe module?) is the Box2D "namespace" here?
});
… on a scale of 1 to 10 how far off am I in my expectations? What am I missing?
Hi there, I am trying to compile this project into a WASM module with the associated JS loader/import object so that I can use it in a bigger project as an ES module. So far I've just been trying to follow the instructions on emscripten.org and webassembly.org to get set up, but I can't get this to build. Here's how my environment is set up:
$ emcc -v emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.16 clang version 6.0.1 (emscripten 1.38.16 : 1.38.16) Target: x86_64-apple-darwin18.2.0 Thread model: posix InstalledDir: /Users/matt/Sites/juj/emsdk/clang/e1.38.16_64bit INFO:root:(Emscripten: Running sanity checks)Here's the toolchain stuff:
I got the
"Hello, world!\n"example project working fine, but when I try to follow the instructions for this project I get this:I'm pretty inexperienced with C/C++ and this whole toolchain is kinda foreign to me, but what I'd really like is something like this:
… on a scale of 1 to 10 how far off am I in my expectations? What am I missing?