node.jslinuxnpmarmhyperledger

Hyperledger Cactus build failing


I everyone, just after cloning the Hyperledger Cactus project from GitHub, when running 'npm run configure' I'm having the following error.

Machine configs:

This is the console output:

andre@macbook: cactus [ main โœ” ] ยป npm run configure

> configure
> yarn install --frozen-lockfile --non-interactive && yarn run build:dev:backend

yarn install v1.18.0
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
info esbuild-android-arm64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-android-arm64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-darwin-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info "esbuild-darwin-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-freebsd-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-freebsd-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-freebsd-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-freebsd-arm64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-freebsd-arm64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-32@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-32@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-32@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-linux-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-linux-arm@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-arm@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-arm@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-linux-arm64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-arm64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-mips64le@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-mips64le@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-mips64le@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-linux-ppc64le@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-linux-ppc64le@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-linux-ppc64le@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-netbsd-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-netbsd-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-netbsd-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-openbsd-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-openbsd-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-openbsd-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-sunos-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-sunos-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-sunos-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-windows-32@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-windows-32@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-windows-32@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-windows-64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-windows-64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
info esbuild-windows-64@0.13.8: The CPU architecture "arm64" is incompatible with this module.
info esbuild-windows-arm64@0.13.8: The platform "darwin" is incompatible with this module.
info "esbuild-windows-arm64@0.13.8" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] ๐Ÿ”—  Linking dependencies...
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic-native/core@5.35.0" has incorrect peer dependency "rxjs@^5.5.0 || ^6.5.0".
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic-native/splash-screen@5.35.0" has incorrect peer dependency "rxjs@^5.5.0 || ^6.5.0".
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic-native/status-bar@5.35.0" has incorrect peer dependency "rxjs@^5.5.0 || ^6.5.0".
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic/angular-toolkit@4.0.0" has unmet peer dependency "@angular-devkit/architect@^0.1200.0".
warning "workspace-aggregator-ffaefa8e-f2f8-475c-8b99-79a6efe75c20 > @hyperledger/cactus-example-carbon-accounting-frontend > @ionic/angular-toolkit@4.0.0" has unmet peer dependency "@angular-devkit/schematics@^12.0.0".
[4/4] ๐Ÿ”จ  Building fresh packages...
[10/40] โ „ pkcs11js
[2/40] โ „ electron
[3/40] โ „ grpc-tools
[6/40] โ „ secp256k1
error /Users/andre/Documents/cactus/node_modules/grpc-tools: Command failed.
Exit code: 1
Command: node-pre-gyp install
Arguments: 
Directory: /Users/andre/Documents/cactus/node_modules/grpc-tools
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.6
node-pre-gyp info using node@16.14.0 | darwin | arm64
node-pre-gyp info check checked for "/Users/andre/Documents/cactus/node_modules/grpc-tools/bin/grpc_tools.node" (not found)
node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz 
node-pre-gyp ERR! install error 
node-pre-gyp ERR! stack Error: response status 404 Not Found on https://node-precompiled-binaries.grpc.io/grpc-tools/v1.11.2/darwin-arm64.tar.gz
node-pre-gyp ERR! stack     at /Users/andre/Documents/cactus/node_modules/@mapbox/node-pre-gyp/lib/install.js:67:15
node-pre-gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:96:5)
node-pre-gyp ERR! System Darwin 21.2.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/andre/Documents/cactus/node_modules/grpc-tools/node_modules/.bin/node-pre-gyp" "install"
node-pre-gyp ERR! cwd /Users/andre/Documents/cactus/node_modules/grpc-tools
node-pre-gyp ERR! node -v v16.14.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.6




warning Error running install script for optional dependency: "/Users/andre/Documents/cactus/node_modules/cpu-features: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /Users/andre/Documents/cactus/node_modules/cpu-features
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@7.1.2
gyp info using node@16.14.0 | darwin | arm64
gyp info find Python using Python version 3.9.10 found at \"/opt/homebrew/opt/python@3.9/bin/python3.9\"
gyp http GET https://nodejs.org/download/release/v16.14.0/node-v16.14.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v16.14.0/node-v16.14.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v16.14.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v16.14.0/SHASUMS256.txt
(node:56976) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
gyp info spawn args [
gyp info spawn args   '/Users/andre/Documents/cactus/node_modules/@npmcli/run-script/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/andre/Documents/cactus/node_modules/cpu-features/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/andre/Documents/cactus/node_modules/@npmcli/run-script/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/andre/Library/Caches/node-gyp/16.14.0/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/andre/Library/Caches/node-gyp/16.14.0',
gyp info spawn args   '-Dnode_gyp_dir=/Users/andre/Documents/cactus/node_modules/@npmcli/run-script/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/andre/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/andre/Documents/cactus/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/andre/Documents/cactus/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/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build
  TOUCH Release/obj.target/config_deps.stamp
  ACTION Building dependencies /Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build/libcpu_features.a
gmake[1]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[2]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 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
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 33%] Built target utils
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 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
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 55%] Built target unix_based_hardware_detection
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[3]: Entering directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
[ 66%] Building C object CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o
In file included from /Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/src/cpuinfo_arm.c:15:
/Users/andre/Documents/cactus/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.
gmake[3]: *** [CMakeFiles/cpu_features.dir/build.make:76: CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o] Error 1
gmake[3]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[2]: *** [CMakeFiles/Makefile2:142: CMakeFiles/cpu_features.dir/all] Error 2
gmake[2]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
gmake[1]: *** [Makefile:136: all] Error 2
gmake[1]: Leaving directory '/Users/andre/Documents/cactus/node_modules/cpu-features/deps/cpu_features/build'
make: *** [/Users/andre/Documents/cactus/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/andre/Documents/cactus/node_modules/@npmcli/run-script/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.2.0
gyp ERR! command \"/usr/local/bin/node\" \"/Users/andre/Documents/cactus/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd /Users/andre/Documents/cactus/node_modules/cpu-features
gyp ERR! node -v v16.14.0
gyp ERR! node-gyp -v v7.1.2
gyp ERR! not ok"
info This module is OPTIONAL, you can safely ignore this error

Already tried installing node-pre-gyp, but I think it might have something to do with the CPU architecture.

Do you have any suggestion? Thank you in advance.


Solution

  • The answer that @slimas9 gave is what led me to remember this command. But on m1 mac there is a command called arch which would help you in this scenario as it also helps me.

    My problem was that some package in a node app would try to run cpu-features which fails to compile on my m1 mac because of architecture and header problems

    Here is an example

    yarn install
    yarn install v1.22.17
    [1/4] ๐Ÿ”  Resolving packages...
    [2/4] ๐Ÿšš  Fetching packages...
    [3/4] ๐Ÿ”—  Linking dependencies...
    [4/4] ๐Ÿ”จ  Building fresh packages...
    [1/2] โข€ cpu-features
    ... cut out all the noisy stuff that isn't needed to explain ...
    [ 66%] Building C object CMakeFiles/cpu_features.dir/src/cpuinfo_arm.c.o
    In file included from /Users/chris/projects/docker-config-gen/node_modules/cpu-features/deps/cpu_features/src/cpuinfo_arm.c:15:
    /Users/chris/projects/docker-config-gen/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
    

    So what I remembered was you can run any terminal command through another terminal command that apple made called arch. It works by letting you pass any command as arguments to the program and specify the arch you want to use. So with this problematic cpu-features package, I would use it like this

    arch -x86_64 yarn install
    

    and under the hood, arch will take the -x86_64 parameter and enable rosetta translation for the command on the right, which is just yarn install but could be any command and arch will just execute it as a subcommand. Yarn installs without a single complaint. But of course, now you're running x86_64 software under translation, so it'll be slower. It would be better in the future to try installing it again without arch helping to see if they fix the problem with cpu-features and let me run natively. But for the immediate future. My problem is solved!

    Try it out and see if that helps. Remember to keep in mind that in the future, you should try the native way again to see if they fix it. So you don't waste your 20 hour battery life translating x86 software ;)