vincent / recast.js

A wrapper for the RecastDetour navigation library for node and the browser
http://vincent.github.io/recast.js/tests/test.webgl.html
108 stars 21 forks source link

TypeError: Module.Pointer_stringify is not a function error with getnavmeshvertices #26

Closed N8n5h closed 4 years ago

N8n5h commented 5 years ago

Hi, I was trying to manually compile recast.js to test to later add some custom code. I didn't touch any file and compilation works, but the problem comes when trying to run this

recast.OBJLoader(path_mesh, function() {
      recast.buildSolo();
      recast.getNavMeshVertices( recast.cb( function ( vertices ) {      
      }));
});

it just throws the next error at the line

recast.getNavMeshVertices


/home/user/.../recast.js:1028
throw ex;
^

TypeError: Module.Pointer_stringify is not a function at _invoke_generic_callback_string (/home/user/.../recast.js:9559:66) at Z18getNavMeshVerticesi (wasm-function[362]:863) at ZN10emscripten8internal7InvokerIvJiEE6invokeEPFviEi (wasm-function[363]:13) at __ZN10emscripten8internal7InvokerIvJitEE6invokeEPFvitEit (wasm-function[372]:15) at Module.dynCall_vii (/home/user/.../recast.js:11552:39) at dynCall_vii76 (eval at makeDynCaller (/home/user/.../recast.js:9049:19), :4:12) at Object.getNavMeshVertices (eval at new (/home/user/.../recast.js:8860:27), :8:1) at /home/user/.../buildnavjs:24:16 at _OBJDataLoader (/home/user/.../recast.js:221:3) at /home/user/.../recast.js:682:7

I also noticed that it compiles to multiple files with different extensions instead of one big js file, I was wondering if that might be relevant...

To compile I followed the steps outlined here https://github.com/vincent/recast.js/blob/master/building.md
I compiled using the latest version of emscripten:
```bash
~/emscripten/emsdk/fastcomp/emscripten/emcc -v
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 1.38.39
clang version 6.0.1 (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-emscripten--core-emscripten--fastcomp--clang 98df4be387dde3e3918fa5bbb5fc43e1a0e1daac) (/b/s/w/ir/cache/git/chromium.googlesource.com-external-github.com-emscripten--core-emscripten--fastcomp 1b4148f39a69c7fc62edadd85e4122b68694dfb7) (emscripten 1.38.31 : 1.38.31)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/user/emscripten/emsdk/fastcomp/fastcomp/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
shared:INFO: (Emscripten: Running sanity checks)
shared:WARNING: java does not seem to exist, required for closure compiler, which is optional (define JAVA in /home/user/.emscripten if you want it)
shared:WARNING: closure compiler will not be available
N8n5h commented 5 years ago

Ok, by reading a bit about pointer_stringify it seems that it was removed and that UTF8ToString should be used instead: https://emscripten.org/docs/getting_started/FAQ.html#why-do-i-get-typeerror-module-something-is-not-a-function