db-migrate / node-db-migrate

Database migration framework for node
Other
2.32k stars 360 forks source link

cpu-features: Apple Silicon not supported #761

Open nodesocket opened 2 years ago

nodesocket commented 2 years ago

I'm submitting a...

Summary

When installing on Apple Silicon (arm64) with yarn I get the following error. Is this something that can safely be ignored, or do you actually need the cpu-features package?

[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 node-gyp@5.1.0
gyp info using node@14.17.6 | 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"

Environment / Setup

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

db-migrate version: 0.11.12
plugins with versions: "db-migrate-pg": "1.2.2"            
wzrdtales commented 2 years ago
npm ls cpu-features
test@1.0.0 /home/tobi/serious_projects/db-migrate/test
└─┬ db-migrate@1.0.0-beta.16
  └─┬ tunnel-ssh@4.1.6
    └─┬ ssh2@1.4.0
      └── cpu-features@0.0.2

It is a dependency of ssh2. So no ssh tunneling for you :/ . You're in bad luck with your apple hardware right now, I know it is a pain in the ass which is why in all projects we're working on we officially banned m1 hardware completely (after it cost us many many hours of trying). So this means I also don't have any such hardware available, and wont have, so you're on your own if you want to fix this issue. The SSH Tunnel feature is especially important in enterprise environments with tight security constraints, so you might or might not need it.

If you want this fixed, please go upstream to tunnel-ssh, ssh2 and https://github.com/mscdex/cpu-features and see if they either already fixed that issue (kindly report me if this is the case then we can give it a bump) or open tickets there respectively.

ryanb commented 2 years ago

I ran into the same gyp error on my Intel MacBook Pro. Perhaps the ssh tunneling features could be moved into a separate package so those that don't need it have a simpler set of dependencies?

andy-isoc commented 2 years ago

Same issue as above. Maybe ssh could be made an optional or peer dependency?

LMS007 commented 2 years ago

Also have the issue, +1 for optional peer dep.

wzrdtales commented 2 years ago

I understand you feel pain, but you must realize that this is a massively used package and not a wish palace. We won't make this an optional peer dependency because this would be a breaking change. A breaking change only for a minority group is not acceptable.

I repeat what I wrote already earlier. Check with the upstream module to get it working with m1, and then we will happily bump the package. Unfortunately, it is what you buy in when you buy an m1, an incomplete ecosystem, this is something you have to deal with, not everyone else. So no +1 in this issue will ever help it get resolved, only your brainpower can help and would be very appreciated, by us, by the maintainer of the packages mentioned and the open source community.

ryanb commented 2 years ago

We won't make this an optional peer dependency because this would be a breaking change.

Another option is to extract a core npm package without the dependency which this package uses. That wouldn't be a breaking change. I can understand it's more work to maintain two packages so not ideal.

I repeat what I wrote already earlier. Check with the upstream module to get it working with m1, and then we will happily bump the package. Unfortunately, it is what you buy in when you buy an m1, an incomplete ecosystem, this is something you have to deal with, not everyone else. So no +1 in this issue will ever help it get resolved, only your brainpower can help and would be very appreciated, by us, by the maintainer of the packages mentioned and the open source community.

I'm on an Intel Mackbook Pro and ran into this error. It's not specific to M1.

Thanks for your time considering this issue.

wzrdtales commented 2 years ago

well then you placed your answer in the wrong issue, this issue is about m1 only @ryanb . please file a new issue and try to point down the issue so that can be solved independently.

Diluka commented 2 years ago

As far as I see, macOS(intel), Windows, docker image node:14 neither support to install.

wzrdtales commented 2 years ago

nah that is wrong. works on intel just fine, works on docker image node:14 just fine (never use alpine and slim images, they can't work when native addons are implied, if you need it slim in total put together a proper build pipeline). windows was never on the supported so not sure.

wzrdtales commented 2 years ago

i locked this issue, since every new comment is about non apple silicon problems. please open a separate ticket and properly 100% reproducible document the issue