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

cannot work on wasm32-unknown-unknown target from rust #39

Open
walksanatora opened this issue Sep 9, 2023 · 5 comments
Open

cannot work on wasm32-unknown-unknown target from rust #39

walksanatora opened this issue Sep 9, 2023 · 5 comments

Comments

@walksanatora
Copy link

when compiling for this target and then running wasm2lua on it you end up with

Unsupported export type: 0x2
/usr/lib/node_modules/wasm2lua/resources/patches/decoder.js:618
          throw new _helperApiError.CompileError("Unexpected valtype: " + toHex(valtypeByte));
          ^

CompileError: Unexpected valtype: 0x61
    at parseCodeSection (/usr/lib/node_modules/wasm2lua/resources/patches/decoder.js:618:17)
    at parseSection (/usr/lib/node_modules/wasm2lua/resources/patches/decoder.js:1487:13)
    at Object.decode (/usr/lib/node_modules/wasm2lua/resources/patches/decoder.js:1697:25)
    at Object.decode (/usr/lib/node_modules/wasm2lua/node_modules/@webassemblyjs/wasm-parser/lib/index.js:253:21)
    at new wasm2lua (/usr/lib/node_modules/wasm2lua/js/index.js:104:42)
    at Object.<anonymous> (/usr/lib/node_modules/wasm2lua/js/bin/wasm2lua.js:85:12)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)

Node.js v20.5.1

@walksanatora
Copy link
Author

same error when exporting from wasm32-wasi

@walksanatora
Copy link
Author

nvm. but when exporting with wasm32-wasi it does complain at me Unsupported export type: 0x2

@walksanatora
Copy link
Author

and after modifying the basic function to export the add function properly you then get met with

/usr/lib/node_modules/wasm2lua/resources/patches/decoder.js:1314
      if (sectionId !== _helperWasmBytecode.default.sections.custom) throw new _helperApiError.CompileError("Unexpected section: " + toHex(sectionId));
                                                                     ^

CompileError: Unexpected section: 0x3
    at parseSection (/usr/lib/node_modules/wasm2lua/resources/patches/decoder.js:1314:76)
    at Object.decode (/usr/lib/node_modules/wasm2lua/resources/patches/decoder.js:1697:25)
    at Object.decode (/usr/lib/node_modules/wasm2lua/node_modules/@webassemblyjs/wasm-parser/lib/index.js:253:21)
    at new wasm2lua (/usr/lib/node_modules/wasm2lua/js/index.js:104:42)
    at Object.<anonymous> (/usr/lib/node_modules/wasm2lua/js/bin/wasm2lua.js:85:12)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)

Node.js v20.5.1

@walksanatora
Copy link
Author

@Vurv78
Copy link

Vurv78 commented Nov 17, 2023

@walksanatora if you want a webassembly to luau solution probably https://github.com/Rerumu/Wasynth is your best bet. although just noticed you have an issue there too, unfortunately a bit late then.

wasm2lua is still nice for everything else since they actually did the hard part supporting native lua, without luajit's ffi.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants