Open fanzhiri opened 3 years ago
fanzhiri@fanzhirideAir awtk-nodejs % node demos/button.js
binding.js bindings opts:awtk.node
binding.js bindings opts.module_root:/Users/fanzhiri/GitHub/awtk-nodejs
binding.js bindings exports.getFileName():/Users/fanzhiri/GitHub/awtk-nodejs/awtk.js
binding.js bindings path.extname(opts.bindings):.node
binding.js opts.path :undefined
binding.js opts.path :undefined
binding.js opts.path :undefined
/Users/fanzhiri/GitHub/awtk-nodejs/node_modules/bindings/bindings.js:127
throw e;
^
Error: dlopen(/Users/fanzhiri/GitHub/awtk-nodejs/build/Release/awtk.node, 0x0001): tried: '/Users/fanzhiri/GitHub/awtk-nodejs/build/Release/awtk.node' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/local/lib/awtk.node' (no such file), '/usr/lib/awtk.node' (no such file)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at bindings (/Users/fanzhiri/GitHub/awtk-nodejs/node_modules/bindings/bindings.js:117:48)
at Object.
我先修改了awtk/awtk_config.py中TARGET_ARCH
if is32bit: if MACH == 'i686' or MACH == 'i386' or MACH == 'x86': TARGET_ARCH='x86' else: TARGET_ARCH='arm' else: TARGET_ARCH='' 这一句改为如下 TARGET_ARCH='arm64'
编译好awtk再去编译awtk-nodejs 然后想运行demo,就看到如下错误了
fanzhiri@fanzhirideAir awtk-nodejs % node demos/button.js /Users/fanzhiri/GitHub/awtk-nodejs/node_modules/bindings/bindings.js:121 throw e; ^ Error: dlopen(/Users/fanzhiri/GitHub/awtk-nodejs/build/Release/awtk.node, 1): no suitable image found. Did find: /Users/fanzhiri/GitHub/awtk-nodejs/build/Release/awtk.node: mach-o, but wrong architecture /Users/fanzhiri/GitHub/awtk-nodejs/build/Release/awtk.node: mach-o, but wrong architecture at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at bindings (/Users/fanzhiri/GitHub/awtk-nodejs/node_modules/bindings/bindings.js:112:48) at Object. (/Users/fanzhiri/GitHub/awtk-nodejs/awtk.js:1:31)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)