wasm-exprgen icon indicating copy to clipboard operation
wasm-exprgen copied to clipboard

Error while building WebAssembly interpreter, validation will not be available

Open momenimohammad23 opened this issue 7 years ago • 11 comments

C:\wasmexprgenmaster>npm run build-tools

[email protected] build-tools C:\wasmexprgenmaster node cli.js build

Starting Spec interpreter build Error while building WebAssembly interpreter, validation will not be available Error: spawn cmd ENOENT MsBuild path: C:\Program Files (x86)\msbuild\14.0\bin\msbuild.exe { Error: not found: cmake at getNotFoundError (C:\wasmexprgenmaster\node_modules\which\which.js:13:12) at F (C:\wasmexprgenmaster\node_modules\which\which.js:68:19) at E (C:\wasmexprgenmaster\node_modules\which\which.js:80:29) at C:\wasmexprgenmaster\node_modules\which\which.js:89:16 at C:\wasmexprgenmaster\node_modules\isexe\index.js:42:5 at C:\wasmexprgenmaster\node_modules\isexe\windows.js:36:5 at FSReqWrap.oncomplete (fs.js:166:21) cause: { Error: not found: cmake at getNotFoundError (C:\wasmexprgenmaster\node_modules\which\which.js:13:12) at F (C:\wasmexprgenmaster\node_modules\which\which.js:68:19) at E (C:\wasmexprgenmaster\node_modules\which\which.js:80:29) at C:\wasmexprgenmaster\node_modules\which\which.js:89:16 at C:\wasmexprgenmaster\node_modules\isexe\index.js:42:5 at C:\wasmexprgenmaster\node_modules\isexe\windows.js:36:5 at FSReqWrap.oncomplete (fs.js:166:21) code: 'ENOENT' }, isOperational: true, code: 'ENOENT' } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] build-tools: node cli.js build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] build-tools script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\WASM\AppData\Roaming\npm-cache_logs\2017-12-17T07_24_17_520Z-debug.log

momenimohammad23 avatar Dec 17 '17 10:12 momenimohammad23

It looks like the build cannor find cmake. Have you installed it? If yes can you verify it is available from your path.

Cellule avatar Dec 18 '17 08:12 Cellule

thank you for answer now the error was changed :‌

npm ERR! path C:\Windows\system32\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Windows\system32\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\WASM\AppData\Roaming\npm-cache\_logs\2017-12-18T08_19_46_746Z-debug.log

momenimohammad23 avatar Dec 18 '17 08:12 momenimohammad23

Humm this is a weird error. Can you list the commands you used? I will try to look into this more tomorrow.

Cellule avatar Dec 18 '17 08:12 Cellule

yes :) first i copy again all the code in new folder then re run cmd as administrator and do this :‌

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Windows\system32>git submodule update --init
fatal: Not a git repository (or any of the parent directories): .git

C:\Windows\system32>git init
Initialized empty Git repository in C:/Windows/System32/.git/

C:\Windows\system32>git submodule update --init

C:\Windows\system32>npm install --production
npm WARN saveError ENOENT: no such file or directory, open 'C:\Windows\system32\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:\Windows\system32\package.json'
npm WARN system32 No description
npm WARN system32 No repository field.
npm WARN system32 No README data
npm WARN system32 No license field.

up to date in 0.125s

C:\Windows\system32>npm run build-tools
npm ERR! path C:\Windows\system32\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'C:\Windows\system32\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\WASM\AppData\Roaming\npm-cache\_logs\2017-12-18T08_19_46_746Z-debug.log

C:\Windows\system32>

momenimohammad23 avatar Dec 18 '17 08:12 momenimohammad23

  • You do not need to run as administrator
  • you shouldn't work in system32, you should cd to a different folder
  • did you copy the files using git clone?
  • no need to run git init (it should already be a git folder after a clone)

Cellule avatar Dec 18 '17 10:12 Cellule

:( again Error on build

c:\>mkdir wasmfuzzer

c:\>git clone https://github.com/Cellule/wasm-exprgen
Cloning into 'wasm-exprgen'...
remote: Counting objects: 452, done.
remote: Compressing objects: 100% (156/156), done.
remote: Total 452 (delta 289), reused 452 (delta 289), pack-reused 0Receiving objects:  85% (385/
Receiving objects: 100% (452/452), 251.16 KiB | 75.00 KiB/s, done.
Resolving deltas: 100% (289/289), done.

c:\>git submodule update --init
fatal: Not a git repository (or any of the parent directories): .git

c:\>git init
Initialized empty Git repository in c:/.git/

c:\>git submodule update --init

c:\>npm install --production
npm WARN saveError ENOENT: no such file or directory, open 'c:\package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'c:\package.json'
npm WARN !invalid#2 No description
npm WARN !invalid#2 No repository field.
npm WARN !invalid#2 No README data
npm WARN !invalid#2 No license field.

up to date in 0.141s

c:\>npm run build-tools
npm ERR! path c:\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'c:\package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\WASM\AppData\Roaming\npm-cache\_logs\2017-12-20T05_13_55_134Z-debug.log

c:\>

momenimohammad23 avatar Dec 20 '17 05:12 momenimohammad23

@Cellule help me , i need a javascrip fuzzer

momenimohammad23 avatar Dec 20 '17 05:12 momenimohammad23

You are ignoring a lot of errors.

  1. You are creating the folder wasmfuzzer, but not actually using it.
  2. After the clone, you have to go in the new folder the clone created.
  3. You don't have to and should not call git init
  4. Make sure every command you do doesn't output an error before you move on to the next step.

Cellule avatar Dec 20 '17 06:12 Cellule

thank you so much ;-) i build it success ... and now i have test.* files in output directory how i can run the fuzzer ? whan i run js file in nodejs the result is -> checksum = 2C3738DE and when run js file in chrome or firefox ->

on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)
test.js:885 on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)
shell_printErr @ test.js:885
abort @ test.js:3083
getBinary @ test.js:2353
doNativeWasm @ test.js:2437
Module.asm @ test.js:2603
(anonymous) @ test.js:2835
test.js:885 failed to compile wasm module: abort("on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)") at Error
    at jsStackTrace (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:1804:13)
    at stackTrace (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:1821:12)
    at abort (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:3094:44)
    at getBinary (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:2353:7)
    at doNativeWasm (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:2437:66)
    at Object.Module.asm (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:2603:23)
    at file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:2835:1
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
shell_printErr @ test.js:885
doNativeWasm @ test.js:2439
Module.asm @ test.js:2603
(anonymous) @ test.js:2835
test.js:882 on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)
test.js:885 on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)
shell_printErr @ test.js:885
abort @ test.js:3083
getBinary @ test.js:2353
doWasmPolyfill @ test.js:2481
Module.asm @ test.js:2607
(anonymous) @ test.js:2835
test.js:3100 Uncaught abort("on the web, we need the wasm binary to be preloaded and set on Module['wasmBinary']. emcc.py will do that for you when generating HTML (but not JS)") at Error
    at jsStackTrace (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:1804:13)
    at stackTrace (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:1821:12)
    at abort (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:3094:44)
    at getBinary (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:2353:7)
    at doWasmPolyfill (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:2481:14)
    at Object.Module.asm (file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:2607:23)
    at file:///C:/wasmfuzzer/wasm-exprgen/output/test.js:2835:1
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.

momenimohammad23 avatar Dec 23 '17 10:12 momenimohammad23

The result you have by running the javascript file is expected. This tool is not a fuzzer exactly, it simply generates random WebAssembly code using CSmith. CSmith is a tool design to produce random c code and, using emscripten, it compiles that c code into WebAssembly. The goal is mainly to find functional errors in WebAssembly engines and possibly test some edge cases.

This tool wasn't intended to produce html files however. It shouldn't be too hard to modify the command passed to emscripten to do so. You can look at https://github.com/Cellule/wasm-exprgen/blob/master/src/generate.js#L106

Cellule avatar Dec 23 '17 19:12 Cellule

hi again after research and read your code i find a solution to generate .html with emcc when I add aditional command to your code the js , c , wasm generate success but it dosend generate html file its my change ti cli.js file

builder: function builder(_yargs) { return _yargs.options(_extends({}, commonGenOptions, { source: { required: true, string: true, describe: "Source file to regenerate" }, emargs: { string: true, describe: "Space separated extra arguments to pass to emcc", default: "-s WASM=1 -o test.html" } })); },

refrance site

momenimohammad23 avatar Jan 06 '18 10:01 momenimohammad23