maierfelix / webgpu

WebGPU for Node [Deprecated, Unmaintained]
MIT License
244 stars 17 forks source link

GPU.h not found #31

Open tari3x opened 4 years ago

tari3x commented 4 years ago

Here's the full trace trying to build webgpu on linux, I suspect I might need to install some system package, but I'm not sure which.

avatar@linux-zc13:~/tmp/webgpu> npm run all --dawnversion=0.0.1

> webgpu@0.1.16 all /home/avatar/tmp/webgpu
> npm run generate && npm run build

> webgpu@0.1.16 generate /home/avatar/tmp/webgpu
> node --experimental-modules --experimental-json-modules ./generator/index.mjs

(node:28957) ExperimentalWarning: Importing JSON modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Code minification is disabled!
Generating bindings for 0.0.1...
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'size_t'
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'size_t'
Warning: Unexpected node category 'callback'
Warning: Unexpected member type 'buffer map callback'
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'void *'
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'size_t'
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'size_t'
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'void const *'
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'size_t'
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'size_t'
Warning: Unexpected node category 'callback'
Warning: Unexpected member type 'device lost callback'
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'size_t'
Warning: Unexpected node category 'native'
Warning: Unexpected member type 'size_t'
Warning: Expected 'length' property to be set for 'char' type
Warning: Cannot handle fixed String length in 'GPUAdapterProperties'.'name'
Warning: Unexpected member type 'void*' in 'GPUSurfaceDescriptorFromMetalLayer'.'layer'
Warning: Unexpected member type 'void*' in 'GPUSurfaceDescriptorFromWindowsHWND'.'hinstance'
Warning: Unexpected member type 'void*' in 'GPUSurfaceDescriptorFromWindowsHWND'.'hwnd'
Warning: Unexpected member type 'void*' in 'GPUSurfaceDescriptorFromXlib'.'display'
Warning: Cannot handle fixed String length in 'GPUAdapterProperties'.'name'
Warning: Unexpected member type 'void*' in 'GPUSurfaceDescriptorFromMetalLayer'.'layer'
Warning: Unexpected member type 'void*' in 'GPUSurfaceDescriptorFromWindowsHWND'.'hinstance'
Warning: Unexpected member type 'void*' in 'GPUSurfaceDescriptorFromWindowsHWND'.'hwnd'
Warning: Unexpected member type 'void*' in 'GPUSurfaceDescriptorFromXlib'.'display'
Successfully generated bindings!

> webgpu@0.1.16 build /home/avatar/tmp/webgpu
> node ./build.js

Compiling bindings for version 0.0.1...
Platform: linux | x64
Node: 14.9.0
V8: 8.4.371.19-node.13

Copying files..
Done!

Compiling bindings..
Copying /home/avatar/tmp/dawn//out/Shared/libshaderc_spvc.so -> ./generated/0.0.1/linux/build/Release//libshaderc_spvc.so
Failed to copy /home/avatar/tmp/dawn//out/Shared/libshaderc_spvc.so -> ./generated/0.0.1/linux/build/Release//libshaderc_spvc.so

/home/avatar/tmp/webgpu/build.js:130
          throw error;
          ^
[
  [Error: ENOENT: no such file or directory, lstat '/home/avatar/tmp/dawn/out/Shared/libshaderc_spvc.so'] {
    errno: -2,
    code: 'ENOENT',
    syscall: 'lstat',
    path: '/home/avatar/tmp/dawn/out/Shared/libshaderc_spvc.so'
  }
]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webgpu@0.1.16 build: `node ./build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the webgpu@0.1.16 build 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!     /home/avatar/.npm/_logs/2020-09-09T23_25_39_051Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! webgpu@0.1.16 all: `npm run generate && npm run build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the webgpu@0.1.16 all 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!     /home/avatar/.npm/_logs/2020-09-09T23_25_39_081Z-debug.log
exit 1
avatar@linux-zc13:~/tmp/webgpu> make: Entering directory '/home/avatar/tmp/webgpu/generated/0.0.1/linux/build'
  TOUCH Release/obj.target/action_after_build.stamp
  CXX(target) Release/obj.target/addon-linux/src/index.o
../src/index.cpp:7:10: fatal error: 'GPU.h' file not found
#include "GPU.h"
         ^~~~~~~
1 error generated.
make: *** [addon-linux.target.mk:189: Release/obj.target/addon-linux/src/index.o] Error 1
make: Leaving directory '/home/avatar/tmp/webgpu/generated/0.0.1/linux/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/avatar/.nvm/versions/node/v14.9.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Linux 4.12.14-lp151.28.67-default
gyp ERR! command "/home/avatar/.nvm/versions/node/v14.9.0/bin/node" "/home/avatar/.nvm/versions/node/v14.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build"
gyp ERR! cwd /home/avatar/tmp/webgpu/generated/0.0.1/linux
gyp ERR! node -v v14.9.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
kainino0x commented 4 years ago

GPU.h is in this repo: https://github.com/maierfelix/webgpu/blob/master/src/GPU.h so there must be an include paths issue.

tari3x commented 4 years ago

What part of the build should be setting the include path? I tried export CPLUS_INCLUDE_PATH=src/, but that didn't change anything. I vaguely remember that make overrides that?

kainino0x commented 4 years ago

Sorry, I don't know anything about the build in this repo. Try looking at some of the build config files to see if there's a place the include path can be changed? Maybe it's hardcoded to use a path that's wrong on your system, or uses a backslash or something?

tari3x commented 4 years ago

Making the change below helped with this one. I am now hitting a different error, reported separately.

--- a/generator/templates/binding-gyp.njk
+++ b/generator/templates/binding-gyp.njk
@@ -77,6 +77,7 @@
               "<!@(node -p \"require('node-addon-api').include\")",
               "<(dawn)/third_party/vulkan-headers/include",
               "<(root)/lib/include",
+              "<(root)/src",
               "<(dawn)/src/include",
               "<(dawn)/out/Shared/gen/src/include",
               "<(dawn)/third_party/shaderc/libshaderc/include",