ThatOpen / web-ifc-viewer

Graphics engine and toolkit for client applications.
MIT License
947 stars 235 forks source link

RuntimeError: abort(CompileError: WebAssembly.instantiate(): expected magic word 00 61 73 6d, found 3c 21 44 4f @+0). Build with -s ASSERTIONS=1 for more info. #108

Closed DonHaha233 closed 2 years ago

DonHaha233 commented 2 years ago

image

vishal-sensorial commented 2 years ago

+1

I have the exact same issue trying to load the IFC viewer in a Next.js application.

agviegas commented 2 years ago

Hi! This is probably because the version of .wasm files used don't correspond to the versions of the files you are deploying. If you updated the library, you also have to update the wasm files. Are you using the version specified by the dependency of web-ifc-viewer?

HoyosJuan commented 2 years ago

+1

I have similar issues, I'm trying to play around with ifc.js using playcode.io just to test some basic things before setting up a project and everything. Here is the testing app https://playcode.io/884221/

image

agviegas commented 2 years ago

@HoyosJuan I think your problem is different. You must statically serve both WASM files in your app in order to run IFC.js.

HoyosJuan commented 2 years ago

@agviegas I have done that, playcode let's me add files to the root folder of my app. I have uploaded both wasm files there and haven't specified a wasm path using ifcManager.setWasmPath as I understand it look at the files in the root folder by default. Maybe I am missing something else? Or did I set it up wrong?

agviegas commented 2 years ago

@HoyosJuan I see that you are importing the loader from three.js. The version there is a bit outdated, we need to update it. Did you take the wasm files from the same place?

HoyosJuan commented 2 years ago

@agviegas I took the wasm files from here https://github.com/IFCjs/web-ifc-viewer/tree/master/example/files. Regarding the loader, can I take it from unpkg? ---> https://unpkg.com/browse/web-ifc-three@0.0.110/ <--- Also, is it possible to specify the wasm path from the CDN? Because here https://unpkg.com/browse/web-ifc@0.0.34/ are the files as well. Thanks Antonio :)

agviegas commented 2 years ago

@HoyosJuan you have to take a loot at the dependency of web-ifc-three and use that version of the wasm (it's 33, we'll update it soon). Let me know how it goes!

HoyosJuan commented 2 years ago

Hi @agviegas! Just to let you know that I wasn't able to specify the path. So I opened my web-ifc-api.js file to include the wasm paths from https://unpkg.com/browse/web-ifc@0.0.34/ under the wasmBinaryFile variable, and now everything is working nicely!

I don't know if it would be a good idea to let the user decide if they want to use the wasm files from the CDN or to specify the files directly from their working directory (you're the one who know the pros/cons of doing that).

Thanks!

hdoshi2 commented 2 years ago

Hi @agviegas, I am installing the latest web-ifc-viewer and copying the "web-ifc.wasm" and "web-ifc-mt.wasm" files from the "../node_modules/web-ifc/" folder into my "public" folder to run my React.js Typescript application and still getting the following issue (see image below). Am I doing this correctly? Should these files be placed in the "public" folder or somewhere else? Thanks for any advice.

I am not sure if I am following @HoyosJuan comment about "to let the user decide if they want to use the wasm files from the CDN or to specify the files directly". Any additional details about how you got it working would be very helpful.

image

arjen8 commented 2 years ago

I got the same error when I used the webworker. If you use the webworker the path to the wasm files needs to be relative to the webworker location.

image