awslabs/aws-crt-nodejs

CMake errors during npm install on raspberry Pi (ARM)

jameshalsall opened this issue · 7 comments

When upgrading from 1.12.5 -> 1.13.2 I see the following output from my project's npm install operation:

npm install
 code 1
 path /home/pi/print-client/node_modules/aws-crt
 command failed
 command sh -c node ./scripts/install.js --production
 npm list tar error:
 Error: Command failed: npm list --depth 0 tar
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:24:45)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:20:19)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:54:26)
     at Object.<anonymous> (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:78:9)
     at Module._compile (node:internal/modules/cjs/loader:1105:14)
     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
     at Module.load (node:internal/modules/cjs/loader:981:32) {
   status: 1,
   signal: null,
   output: [
     null,
     'aws-crt@1.13.2 /home/pi/print-client/node_modules/aws-crt\n└── (empty)\n\n',
     ''
   ],
   pid: 25958,
   stdout: 'aws-crt@1.13.2 /home/pi/print-client/node_modules/aws-crt\n└── (empty)\n\n',
   stderr: ''
 }
 npm global list tar error:
 Error: Command failed: npm list -g --depth 0 tar
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:36:45)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:20:19)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:54:26)
     at Object.<anonymous> (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:78:9)
     at Module._compile (node:internal/modules/cjs/loader:1105:14)
     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
     at Module.load (node:internal/modules/cjs/loader:981:32) {
   status: 1,
   signal: null,
   output: [ null, '/usr/lib\n└── (empty)\n\n', '' ],
   pid: 25970,
   stdout: '/usr/lib\n└── (empty)\n\n',
   stderr: ''
 }
 Could not find tar version 6.1.11
 Looking for tar version 6.1.11 as a dependency...
 npm list tar error:
 Error: Command failed: npm list --depth 0 tar
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:24:45)
     at Object.npmDownloadAndInstallRuntimePackage (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:65:18)
     at Object.getPackageAndFetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:38:23)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:24:24)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:54:26)
     at Object.<anonymous> (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:78:9)
     at Module._compile (node:internal/modules/cjs/loader:1105:14) {
   status: 1,
   signal: null,
   output: [
     null,
     'aws-crt-build@ /home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies\n' +
       '└── (empty)\n' +
       '\n',
     ''
   ],
   pid: 25982,
   stdout: 'aws-crt-build@ /home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies\n' +
     '└── (empty)\n' +
     '\n',
   stderr: ''
 }
 npm global list tar error:
 Error: Command failed: npm list -g --depth 0 tar
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:36:45)
     at Object.npmDownloadAndInstallRuntimePackage (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:65:18)
     at Object.getPackageAndFetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:38:23)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:24:24)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:54:26)
     at Object.<anonymous> (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:78:9)
     at Module._compile (node:internal/modules/cjs/loader:1105:14) {
   status: 1,
   signal: null,
   output: [ null, '/usr/lib\n└── (empty)\n\n', '' ],
   pid: 25994,
   stdout: '/usr/lib\n└── (empty)\n\n',
   stderr: ''
 }
 Could not find tar version 6.1.11
 Could not find tar
 Downloading tar from npm for build...
 npm list axios error:
 Error: Command failed: npm list --depth 0 axios
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:24:45)
     at Object.loadAxios (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_axios.js:25:23)
     at Object.fetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:56:26)
     at Object.getPackageAndFetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:48:14)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:24:24)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:54:26)
     at Object.<anonymous> (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:78:9) {
   status: 1,
   signal: null,
   output: [
     null,
     'aws-crt-build@ /home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies\n' +
       '└── (empty)\n' +
       '\n',
     ''
   ],
   pid: 26018,
   stdout: 'aws-crt-build@ /home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies\n' +
     '└── (empty)\n' +
     '\n',
   stderr: ''
 }
 npm global list axios error:
 Error: Command failed: npm list -g --depth 0 axios
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:36:45)
     at Object.loadAxios (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_axios.js:25:23)
     at Object.fetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:56:26)
     at Object.getPackageAndFetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:48:14)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:24:24)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:54:26)
     at Object.<anonymous> (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:78:9) {
   status: 1,
   signal: null,
   output: [ null, '/usr/lib\n└── (empty)\n\n', '' ],
   pid: 26030,
   stdout: '/usr/lib\n└── (empty)\n\n',
   stderr: ''
 }
 Could not find axios version 0.24.0
 Looking for axios version 0.24.0 as a dependency...
 npm list axios error:
 Error: Command failed: npm list --depth 0 axios
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:24:45)
     at Object.npmDownloadAndInstallRuntimePackage (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:65:18)
     at Object.loadAxios (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_axios.js:29:49)
     at Object.fetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:56:26)
     at Object.getPackageAndFetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:48:14)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:24:24)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:54:26) {
   status: 1,
   signal: null,
   output: [
     null,
     'aws-crt-build@ /home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies\n' +
       '└── (empty)\n' +
       '\n',
     ''
   ],
   pid: 26042,
   stdout: 'aws-crt-build@ /home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies\n' +
     '└── (empty)\n' +
     '\n',
   stderr: ''
 }
 npm global list axios error:
 Error: Command failed: npm list -g --depth 0 axios
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:36:45)
     at Object.npmDownloadAndInstallRuntimePackage (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:65:18)
     at Object.loadAxios (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_axios.js:29:49)
     at Object.fetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:56:26)
     at Object.getPackageAndFetchNativeCode (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:48:14)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_tar.js:24:24)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:54:26) {
   status: 1,
   signal: null,
   output: [ null, '/usr/lib\n└── (empty)\n\n', '' ],
   pid: 26054,
   stdout: '/usr/lib\n└── (empty)\n\n',
   stderr: ''
 }
 Could not find axios version 0.24.0
 Could not find axios
 Downloading axios from npm for build...
 npm list cmake-js error:
 Error: Command failed: npm list --depth 0 cmake-js
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:24:45)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_cmake.js:20:19)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:58:28)
     at processTicksAndRejections (node:internal/process/task_queues:96:5) {
   status: 1,
   signal: null,
   output: [
     null,
     'aws-crt@1.13.2 /home/pi/print-client/node_modules/aws-crt\n└── (empty)\n\n',
     ''
   ],
   pid: 26082,
   stdout: 'aws-crt@1.13.2 /home/pi/print-client/node_modules/aws-crt\n└── (empty)\n\n',
   stderr: ''
 }
 npm global list cmake-js error:
 Error: Command failed: npm list -g --depth 0 cmake-js
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:36:45)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_cmake.js:20:19)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:58:28)
     at processTicksAndRejections (node:internal/process/task_queues:96:5) {
   status: 1,
   signal: null,
   output: [ null, '/usr/lib\n└── (empty)\n\n', '' ],
   pid: 26094,
   stdout: '/usr/lib\n└── (empty)\n\n',
   stderr: ''
 }
 Could not find cmake-js version 6.3.2
 Looking for cmake-js version 6.3.2 as a dependency...
 npm list cmake-js error:
 Error: Command failed: npm list --depth 0 cmake-js
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:24:45)
     at Object.npmDownloadAndInstallRuntimePackage (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:65:18)
     at Object.getPackageAndBuildSource (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_cmake.js:47:23)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_cmake.js:23:24)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:58:28)
     at processTicksAndRejections (node:internal/process/task_queues:96:5) {
   status: 1,
   signal: null,
   output: [
     null,
     'aws-crt-build@ /home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies\n' +
       '└── (empty)\n' +
       '\n',
     ''
   ],
   pid: 26106,
   stdout: 'aws-crt-build@ /home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies\n' +
     '└── (empty)\n' +
     '\n',
   stderr: ''
 }
 npm global list cmake-js error:
 Error: Command failed: npm list -g --depth 0 cmake-js
     at checkExecSyncError (node:child_process:828:11)
     at Object.execSync (node:child_process:899:15)
     at Object.npmCheckIfPackageExists (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:36:45)
     at Object.npmDownloadAndInstallRuntimePackage (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_utils.js:65:18)
     at Object.getPackageAndBuildSource (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_cmake.js:47:23)
     at Object.performStep (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/build_step_cmake.js:23:24)
     at buildFromRemoteSource (/home/pi/print-client/node_modules/aws-crt/scripts/build.js:58:28)
     at processTicksAndRejections (node:internal/process/task_queues:96:5) {
   status: 1,
   signal: null,
   output: [ null, '/usr/lib\n└── (empty)\n\n', '' ],
   pid: 26118,
   stdout: '/usr/lib\n└── (empty)\n\n',
   stderr: ''
 }
 Could not find cmake-js version 6.3.2
 Could not find cmake-js
 Downloading cmake-js from npm for build...
 Not searching for unused variables given on the command line.
 -- The C compiler identification is GNU 8.4.0
 -- Check for working C compiler: /usr/bin/cc
 -- Check for working C compiler: /usr/bin/cc -- works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Detecting C compile features
 -- Detecting C compile features - done
 -- Using submodule dependencies
 -- Configuring incomplete, errors occurred!
 See also "/home/pi/print-client/node_modules/aws-crt/build/linux-arm/CMakeFiles/CMakeOutput.log".
 info TOOL Using Unix Makefiles generator.
 info TOOL Building only the install target, as specified from the command line.
 info CMD CONFIGURE
 info TOOL Building only the install target, as specified from the command line.
 info RUN [
 info RUN   'cmake',
 info RUN   '/home/pi/print-client/node_modules/aws-crt',
 info RUN   '--no-warn-unused-cli',
 info RUN   '-G',
 info RUN   'Unix Makefiles',
 info RUN   '-DCMAKE_JS_VERSION=6.3.2',
 info RUN   '-DCMAKE_BUILD_TYPE=Release',
 info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/pi/print-client/node_modules/aws-crt/build/linux-arm/Release',
 info RUN   '-DCMAKE_JS_INC=/home/pi/.cmake-js/node-arm/v16.15.0/include/node;/home/pi/print-client/node_modules/nan',
 info RUN   '-DCMAKE_JS_SRC=',
 info RUN   '-DNODE_RUNTIME=node',
 info RUN   '-DNODE_RUNTIMEVERSION=16.15.0',
 info RUN   '-DNODE_ARCH=arm',
 info RUN   '-DCMAKE_EXPORT_COMPILE_COMMANDS=true',
 info RUN   '-DCMAKE_JS_PLATFORM=linux',
 info RUN   '-DBUILD_TESTING=OFF',
 info RUN   '-DCMAKE_INSTALL_PREFIX=crt/install',
 info RUN   '-DCMAKE_PREFIX_PATH=crt/install'
 info RUN ]
 CMake Error at CMakeLists.txt:38 (include):
   include could not find load file:

     AwsFindPackage


 CMake Error at CMakeLists.txt:44 (add_subdirectory):
   add_subdirectory given source "crt/aws-c-common" which is not an existing
   directory.


 CMake Error at CMakeLists.txt:50 (add_subdirectory):
   add_subdirectory given source "crt/aws-lc" which is not an existing
   directory.


 CMake Error at CMakeLists.txt:52 (add_subdirectory):
   add_subdirectory given source "crt/s2n" which is not an existing directory.


 CMake Error at CMakeLists.txt:55 (add_subdirectory):
   add_subdirectory given source "crt/aws-c-sdkutils" which is not an existing
   directory.


 CMake Error at CMakeLists.txt:56 (add_subdirectory):
   add_subdirectory given source "crt/aws-c-io" which is not an existing
   directory.


 CMake Error at CMakeLists.txt:57 (add_subdirectory):
   add_subdirectory given source "crt/aws-c-cal" which is not an existing
   directory.


 CMake Error at CMakeLists.txt:58 (add_subdirectory):
   add_subdirectory given source "crt/aws-c-compression" which is not an
   existing directory.


 CMake Error at CMakeLists.txt:59 (add_subdirectory):
   add_subdirectory given source "crt/aws-c-http" which is not an existing
   directory.


 CMake Error at CMakeLists.txt:60 (add_subdirectory):
   add_subdirectory given source "crt/aws-c-auth" which is not an existing
   directory.


 CMake Error at CMakeLists.txt:61 (add_subdirectory):
   add_subdirectory given source "crt/aws-c-mqtt" which is not an existing
   directory.


 CMake Error at CMakeLists.txt:62 (add_subdirectory):
   add_subdirectory given source "crt/aws-checksums" which is not an existing
   directory.


 CMake Error at CMakeLists.txt:76 (include):
   include could not find load file:

     AwsCFlags


 CMake Error at CMakeLists.txt:77 (include):
   include could not find load file:

     AwsSharedLibSetup


 CMake Error at CMakeLists.txt:78 (include):
   include could not find load file:

     AwsSanitizers


 CMake Error at CMakeLists.txt:85 (aws_set_common_properties):
   Unknown CMake command "aws_set_common_properties".


 ERR! OMG Process terminated: 1
 node:internal/process/promises:279
             triggerUncaughtException(err, true /* fromPromise */);
             ^

 Error: Process terminated: 1
     at ChildProcess.<anonymous> (/home/pi/print-client/node_modules/aws-crt/scripts/build_dependencies/node_modules/cmake-js/lib/processHelpers.js:34:32)
     at ChildProcess.emit (node:events:527:28)
     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)

On 1.12.5 everything installs fine.

I believe it is related to the changes made in 001193e

Looking at the output, my guess would be that tar was not able to successfully download the CRT, so when cmake was invoked to run, it cannot find the CRT submodules.

Do you have npm installed on your Raspberry PI? If so, can you check in the scripts/build_dependencies folder of the CRT and see if there is a node_modules folder? If it was able to successfully download tar, cmake-js and axios, then the dependencies should be located in the node_modules folder.

Yes, I'm running the npm install directly on the Pi. On a clean install (no node_modules directory prior to running npm install) there is no node_modules directory created at all.

If I have a node_modules directory from a previously working npm install (using an older version of aws-crt), then the node_modules/aws-crt/scripts/build_dependencies directory is never created (again, assuming that this is because of the error).

It seems like then something about trying to run npm as a sub-process is what would be causing the issue, if I had to guess. That would explain why there is no node_modules folder found. I have tested the script locally on a Mac, but maybe something with the Raspberry PI causes it to operate differently? I'm not sure, but this will need to be investigated.

For a short-term fix, if you modify the package.json in aws-crt and move tar and cmakejs from dev-dependencies to dependencies, then it should allow building like normal. You can also add tar and cmakejs directly to your package.json and that should also fix the issue. The change in 001193e was to move these dependencies to build-time-only dependencies rather than leaving them in the dependencies section of the package.json, so undoing that should allow it to function as expected again.

Thank you for letting us know about this issue! We will look into it. 👍

Thanks so much for providing the workaround for now, that is great 👍🏻. If there is any other information I can provide just let me know!

I have been trying to reproduce this on my Raspberry Pi but so far have been unsuccessful in getting the same error. If you do not mind, can you share what PI architecture you are using, OS (and whether it is 32-bit or 64-bit), and the version of Node and NPM you are using?

Also, if possible - can you add some print statements to see where your packages are being installed and whether the aws-crt-nodejs package is creating a folder called crt? This is where the downloaded source should be dumped by tar and axios. Based on the log output, it seems like the NPM packages are being installed somewhere, just not sure where.

I tried to replicate the issue with Raspberry Pi OS 64-bit with a Debian (Debian "bullseye") version of 11.4. You can find out which OS you are using by running cat /etc/os-release and cat /etc/debian_version

That way, I can better try to reproduce this issue and hopefully find a solution. Thanks!

Apologies for the delay!

$ uname -m
armv7l

Running Raspbian GNU/Linux 10 (buster), 10.10 is the specific version 👍🏻

Not a problem! Thank you for letting us know.
We reverted the change made in 001193e, so it should be fixed now in 1.14.1 🙂