Repository navigation
Closed
Description
Trying to install a module that uses cpu-features on Apple Silicon (arm64) and getting the following error. Here are details on my Node and Yarn versions.
MacBook-Pro ➜ server git:(worker) ✗ node --version
v14.17.6
MacBook-Pro ➜ server git:(worker) ✗ which node
/Users/justin/.nvm/versions/node/v14.17.6/bin/node
MacBook-Pro ➜ server git:(worker) ✗ file /Users/justin/.nvm/versions/node/v14.17.6/bin/node
/Users/justin/.nvm/versions/node/v14.17.6/bin/node: Mach-O 64-bit executable arm64
MacBook-Pro ➜ server git:(worker) ✗ yarn --version
1.22.15
MacBook-Pro ➜ server git:(worker) ✗ which yarn
/Users/justin/.yarn/bin/yarn[1/2] ⠂ cpu-features
warning Error running install script for optional dependency: "/Users/justin/Sites/foo/server/node_modules/cpu-features: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: /Users/justin/Sites/foo/server/node_modules/cpu-features
Output:
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 2.7.18 found at \"/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python\"
gyp info spawn /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
gyp info spawn args [
gyp info spawn args '/Users/justin/.nvm/versions/node/v14.17.6/lib/node_modules/npm/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/justin/Sites/foo/server/node_modules/cpu-features/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/justin/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/justin/Library/Caches/node-gyp/14.17.6/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/justin/Library/Caches/node-gyp/14.17.6',
gyp info spawn args '-Dnode_gyp_dir=/Users/justin/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/justin/Library/Caches/node-gyp/14.17.6/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/justin/Sites/foo/server/node_modules/cpu-features',
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 info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
ACTION Configuring dependencies /Users/justin/Sites/foo/server/node_modules/cpu-features/deps/cpu_features/build/Makefile
-- The C compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for dlfcn.h
-- Looking for dlfcn.h - found
-- Looking for getauxval
-- Looking for getauxval - not found
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/justin/Sites/foo/server/node_modules/cpu-features/deps/cpu_features/build
TOUCH Release/obj.target/config_deps.stamp
ACTION Building dependencies /Users/justin/Sites/foo/server/node_modules/cpu-features/deps/cpu_features/build/libcpu_features.a
[ 11%] Building C object CMakeFiles/utils.dir/src/filesystem.c.o
[ 22%] Building C object CMakeFiles/utils.dir/src/stack_line_reader.c.o
[ 33%] Building C object CMakeFiles/utils.dir/src/string_view.c.o
[ 33%] Built target utils
[ 44%] Building C object CMakeFiles/unix_based_hardware_detection.dir/src/hwcaps.c.o
[ 55%] Building C object CMakeFiles/unix_based_hardware_detection.dir/src/unix_features_aggregator.c.o
[ 55%] Built target unix_based_hardware_detection
[ 66%] Building C object CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o
In file included from /Users/justin/Sites/foo/server/node_modules/cpu-features/deps/cpu_features/src/cpuinfo_arm.c:15:
/Users/justin/Sites/foo/server/node_modules/cpu-features/deps/cpu_features/include/cpuinfo_arm.h:118:2: error: \"Including cpuinfo_arm.h from a non-arm target.\"
#error \"Including cpuinfo_arm.h from a non-arm target.\"
^
1 error generated.
make[3]: *** [CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o] Error 1
make[2]: *** [CMakeFiles/cpu_features.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [/Users/justin/Sites/foo/server/node_modules/cpu-features/deps/cpu_features/build/libcpu_features.a] Error 2
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/justin/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 21.1.0
gyp ERR! command \"/Users/justin/.nvm/versions/node/v14.17.6/bin/node\" \"/Users/justin/.nvm/versions/node/v14.17.6/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js\" \"rebuild\"
gyp ERR! cwd /Users/justin/Sites/foo/server/node_modules/cpu-features
gyp ERR! node -v v14.17.6
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok"Metadata
Metadata
Assignees
Labels
No labels
Activity
mscdex commentedon Oct 31, 2021
Support for that platform is missing upstream. This is the relevant PR if you want to keep tabs on it and/or make your voice heard.
christhomas commentedon Mar 20, 2022
As a way to fix this temporarily so you can keep working without issue, you can run this command using a command line
arch -x86_64 yarn installThen it will use rosetta translation. It's not ideal and I would like this fixed and working natively (today I tried it and I still get this error). But it at least lets me continue without hiccups.
mscdex commentedon Mar 20, 2022
@christhomas Can you try the master branch?
wtfiwtz commentedon Aug 4, 2023
Yes, the
masterbranch works with Nodev14.21.3👍