Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Emscripten upstream version isn't working #10

Closed
ThorstenBux opened this issue Dec 30, 2019 · 15 comments
Closed

Using Emscripten upstream version isn't working #10

ThorstenBux opened this issue Dec 30, 2019 · 15 comments
Assignees
Labels
bug Something isn't working code design emscripten All about emscripten and jsartoolkit5 javascript all about javascript code NFT nft markerless technology

Comments

@ThorstenBux
Copy link

I just want to note that to not forget. I've build with emscripten-upstream and ran into these issues:

  1. LibJPEG from your libJPEG repo isn't working. I think that is to be expected because your version of libJPEG is build with fastcomp.

  2. Runtime error because memory growth isn't allowed. That can be fixed by adding
    FLAGS += ' -s ALLOW_MEMORY_GROWTH=1 ' to makeem.js which we could add per default anyways.

  3. Runtime error when copying the JS video stream image to C++ compile code.

Uncaught TypeError: Cannot perform %TypedArray%.prototype.set on a detached ArrayBuffer
    at Uint8Array.set (<anonymous>)
    at ARController._copyImageToHeap (VM44 artoolkit_wasm.js:1)
    at ARController.detectMarker (VM44 artoolkit_wasm.js:1)
    at ARController.process (VM44 artoolkit_wasm.js:1)
    at Object.process (VM54 artoolkit.three.js:152)
    at tick (nft_threejs_wasm.html:96)

I didn't follow this bug till the end, hence this note to keep it in mind.

@ThorstenBux
Copy link
Author

This might fix it. It seems to be memory growth related" emscripten-core/emscripten#6747

@ThorstenBux
Copy link
Author

Update: it is not upstream related I get it on fastcomp too

@ThorstenBux
Copy link
Author

I tracked this down to be a wasm issue. Maybe only on macos Chrome as you haven't noticed it so far.

I fixed the memory growth and the TypeError now I'm getting

Uncaught RuntimeError: float unrepresentable in integer range
    at wasm-function[176]:0x77e7
    at wasm-function[949]:0x3ee6a
    at wasm-function[950]:0x3eebe
    at wasm-function[951]:0x3f033
    at wasm-function[952]:0x3f17e
    at wasm-function[1070]:0x46410
    at wasm-function[1027]:0x445f8
    at wasm-function[1028]:0x446f2
    at wasm-function[1029]:0x44722
    at wasm-function[1178]:0x4fdfd

which might be fixable by trap mode: https://emscripten.org/docs/compiling/WebAssembly.html

@ThorstenBux
Copy link
Author

The none wasm examples work (build and run successfully) with memory_growth enabled. I haven't printed the pinball marker yet.

@ThorstenBux
Copy link
Author

getting [error] Out of memory!! on Safary iOS

@ThorstenBux
Copy link
Author

@kalwalt
Copy link
Owner

kalwalt commented Dec 30, 2019

@ThorstenBux i switched to an older Emscripten version, because you and @nicolocarpignoli used this. But sure better use the latest with upstream. Recently. I did a node script to build the libjpeg.bc by yourself https://github.com/kalwalt/libjpeg-for-jsartoolkit5/blob/master/tools/makem.js in this way you can build your own libjpeg.
About Allow Memory growth, wasn't already enabled?
Yes the trap mode should solve the wasm issue, strange that you get that error though... I Will look Into your branch this afternoon. Thanks ! ☺️

@ThorstenBux
Copy link
Author

Currently I'm having issues with upstream and fastcomp. I guess it is because of the version but still need to verify.

@ThorstenBux
Copy link
Author

@kalwalt the issue is that even if I just use the committed, pre-build libs I can't run the NFT wasm examples successfully.

@kalwalt
Copy link
Owner

kalwalt commented Dec 30, 2019

Pay attention that changing emscripten version you need to clear the emscripten cache.

@kalwalt
Copy link
Owner

kalwalt commented Dec 30, 2019

@kalwalt the issue is that even if I just use the committed, pre-build libs I can't run the NFT wasm examples successfully.

No, with the prebuild libjpeg.bc and the emscripten fastcomp you Will get the wasm error. I think It works only with latest upstream emscripten.

@kalwalt
Copy link
Owner

kalwalt commented Dec 30, 2019

i'm testing your branch, i see that the NFT examples are not tracking properly. Maybe because was removed the 'use strict'?

@kalwalt
Copy link
Owner

kalwalt commented Dec 30, 2019

@ThorstenBux It was removed with this commit a91d8bd try to add it again and let me know.

@kalwalt kalwalt self-assigned this Dec 30, 2019
@kalwalt kalwalt added bug Something isn't working code design javascript all about javascript code NFT nft markerless technology emscripten All about emscripten and jsartoolkit5 labels Dec 30, 2019
@kalwalt
Copy link
Owner

kalwalt commented Dec 31, 2019

i opened this issue #11 for anyone has some troubles and problems with Emscripten.

@ThorstenBux
Copy link
Author

Closing because this is fixed with Docker setup

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working code design emscripten All about emscripten and jsartoolkit5 javascript all about javascript code NFT nft markerless technology
Projects
None yet
Development

No branches or pull requests

2 participants