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

Compiled node module can not be executed on Apple M1 #2391

Open
robbiewu008 opened this issue May 6, 2021 · 2 comments
Open

Compiled node module can not be executed on Apple M1 #2391

robbiewu008 opened this issue May 6, 2021 · 2 comments

Comments

@robbiewu008
Copy link

  • Node Version: v14.16.1
  • Platform: Darwin RobbiedeAir 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:41 PDT 2021; root:xnu-7195.101.2~1/RELEASE_ARM64_T8101 arm64
  • Compiler: Apple clang version 12.0.5 (clang-1205.0.22.9)
    Target: arm64-apple-darwin20.4.0
    Thread model: posix
    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
  • Module: node-usb-detection
Verbose output (from npm or node-gyp):
robbiewu@RobbiedeAir node-usb-detection-4.11.0 % node-gyp rebuild --python /usr/bin/python3 --target=12.0.4 --dist-url=https://electronjs.org/headers --verbose
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/opt/homebrew/Cellar/node@14/14.16.1_1/bin/node',
gyp verb cli   '/opt/homebrew/bin/node-gyp',
gyp verb cli   'rebuild',
gyp verb cli   '--python',
gyp verb cli   '/usr/bin/python3',
gyp verb cli   '--target=12.0.4',
gyp verb cli   '--dist-url=https://electronjs.org/headers',
gyp verb cli   '--verbose'
gyp verb cli ]
gyp info using node-gyp@8.0.0
gyp info using node@14.16.1 | darwin | arm64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb download using dist-url https://electronjs.org/headers
gyp verb find Python checking Python explicitly set from command line or npm configuration
gyp verb find Python - "--python=" or "npm config get python" is "/usr/bin/python3"
gyp verb find Python - executing "/usr/bin/python3" to get executable path
gyp verb find Python - executable path is "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp verb find Python - executing "/Library/Developer/CommandLineTools/usr/bin/python3" to get version
gyp verb find Python - version is "3.8.2"
gyp info find Python using Python version 3.8.2 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp verb get node dir compiling against --target node version: 12.0.4
gyp verb command install [ '12.0.4' ]
gyp verb download using dist-url https://electronjs.org/headers
gyp verb install input version string "12.0.4"
gyp verb install installing version: 12.0.4
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 12.0.4
gyp verb build dir attempting to create "build" dir: /Users/robbiewu/Downloads/node-usb-detection-4.11.0/build
gyp verb build dir "build" dir needed to be created? /Users/robbiewu/Downloads/node-usb-detection-4.11.0/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /Users/robbiewu/Downloads/node-usb-detection-4.11.0/build/config.gypi
gyp verb config.gypi checking for gypi file: /Users/robbiewu/Downloads/node-usb-detection-4.11.0/config.gypi
gyp verb common.gypi checking for gypi file: /Users/robbiewu/Downloads/node-usb-detection-4.11.0/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/opt/homebrew/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/robbiewu/Downloads/node-usb-detection-4.11.0/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/opt/homebrew/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/robbiewu/Library/Caches/node-gyp/12.0.4/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/robbiewu/Library/Caches/node-gyp/12.0.4',
gyp info spawn args   '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/robbiewu/Library/Caches/node-gyp/12.0.4/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/robbiewu/Downloads/node-usb-detection-4.11.0',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture arm64
gyp verb node dev dir /Users/robbiewu/Library/Caches/node-gyp/12.0.4
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
  c++ -o Release/obj.target/detection/src/detection.o ../src/detection.cpp '-DNODE_GYP_MODULE_NAME=detection' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DV8_COMPRESS_POINTERS' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-DV8_REVERSE_JSARGS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' '-DNDEBUG' -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/include/node -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/src -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/openssl/config -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/openssl/openssl/include -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/uv/include -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/zlib -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/v8/include -I../node_modules/nan  -O3 -gdwarf-2 -mmacosx-version-min=10.13 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/detection/src/detection.o.d.raw -I/opt/homebrew/opt/node@14/include  -c
In file included from ../src/detection.cpp:1:
In file included from ../src/detection.h:15:
../src/deviceList.h:7:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
typedef struct {
              ^
               ListResultItem_t
../src/deviceList.h:8:2: note: type is not C-compatible due to this member declaration
        public:
        ^~~~~~~
../src/deviceList.h:16:3: note: type is given name 'ListResultItem_t' for linkage purposes by this typedef declaration
} ListResultItem_t;
  ^
1 warning generated.
  c++ -o Release/obj.target/detection/src/deviceList.o ../src/deviceList.cpp '-DNODE_GYP_MODULE_NAME=detection' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DV8_COMPRESS_POINTERS' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-DV8_REVERSE_JSARGS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' '-DNDEBUG' -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/include/node -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/src -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/openssl/config -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/openssl/openssl/include -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/uv/include -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/zlib -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/v8/include -I../node_modules/nan  -O3 -gdwarf-2 -mmacosx-version-min=10.13 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/detection/src/deviceList.o.d.raw -I/opt/homebrew/opt/node@14/include  -c
In file included from ../src/deviceList.cpp:5:
../src/deviceList.h:7:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
typedef struct {
              ^
               ListResultItem_t
../src/deviceList.h:8:2: note: type is not C-compatible due to this member declaration
        public:
        ^~~~~~~
../src/deviceList.h:16:3: note: type is given name 'ListResultItem_t' for linkage purposes by this typedef declaration
} ListResultItem_t;
  ^
1 warning generated.
  c++ -o Release/obj.target/detection/src/detection_mac.o ../src/detection_mac.cpp '-DNODE_GYP_MODULE_NAME=detection' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DV8_COMPRESS_POINTERS' '-DV8_31BIT_SMIS_ON_64BIT_ARCH' '-DV8_REVERSE_JSARGS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' '-DNDEBUG' -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/include/node -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/src -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/openssl/config -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/openssl/openssl/include -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/uv/include -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/zlib -I/Users/robbiewu/Library/Caches/node-gyp/12.0.4/deps/v8/include -I../node_modules/nan  -O3 -gdwarf-2 -mmacosx-version-min=10.13 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=gnu++1y -stdlib=libc++ -fno-rtti -fno-exceptions -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/detection/src/detection_mac.o.d.raw -I/opt/homebrew/opt/node@14/include  -c
In file included from ../src/detection_mac.cpp:1:
In file included from ../src/detection.h:15:
../src/deviceList.h:7:15: warning: anonymous non-C-compatible type given name for linkage purposes by typedef declaration; add a tag name here [-Wnon-c-typedef-for-linkage]
typedef struct {
              ^
               ListResultItem_t
../src/deviceList.h:8:2: note: type is not C-compatible due to this member declaration
        public:
        ^~~~~~~
../src/deviceList.h:16:3: note: type is given name 'ListResultItem_t' for linkage purposes by this typedef declaration
} ListResultItem_t;
  ^
1 warning generated.
  c++ -bundle -undefined dynamic_lookup -Wl,-search_paths_first -mmacosx-version-min=10.13 -arch arm64 -L./Release -stdlib=libc++ -L/opt/homebrew/opt/node@14/lib -o Release/detection.node Release/obj.target/detection/src/detection.o Release/obj.target/detection/src/deviceList.o Release/obj.target/detection/src/detection_mac.o -framework IOKit
gyp info ok

But the compiled detection.node can not be executed.

Failed to open serial port /dev/cu.usbserial-0001 due to error: + Error: dlopen(/Users/robbiewu/.vscode/extensions/vsciot-vscode.vscode-arduino-0.4.2/out/node_modules/usb-detection/build/Release/detection.node, 1): no suitable image found.  Did find:
	/Users/robbiewu/.vscode/extensions/vsciot-vscode.vscode-arduino-0.4.2/out/node_modules/usb-detection/build/Release/detection.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
	/Users/robbiewu/.vscode/extensions/vsciot-vscode.vscode-arduino-0.4.2/out/node_modules/usb-detection/build/Release/detection.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
@robbiewu008 robbiewu008 changed the title Cannot generate the correct bin for Apple M1 Compiled node module can not be executed on Apple M1 May 6, 2021
@cclauss cclauss added the Arm label May 6, 2021
@cclauss cclauss added the macOS label Dec 5, 2021
@mlshv
Copy link

mlshv commented Mar 29, 2022

Any updates on this issue?

@cclauss
Copy link
Contributor

cclauss commented Mar 29, 2022

gyp info using node-gyp@8.0.0
gyp verb find Python - version is "3.8.2"

https://www.python.org/downloads/release/python-391/ is the first release that supports M1 so please retry with
node-gyp v9 and Python 3.10.4 and let us know if that helps.

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

No branches or pull requests

3 participants