Skip to content

Cross-compilation not working anymore #1066

@kissadam21

Description

@kissadam21

Hi all,

We encountered a new problem with cross-compiling the package. We use rclnodejs on an embedded device, so we need to be able to compile it for another architecture and it worked perfectly like this:

export npm_config_arch=arm64
export npm_config_target_arch=arm64
export CC=/usr/bin/aarch64-linux-gnu-gcc
export CXX=/usr/bin/aarch64-linux-gnu-g++
source /opt/ros/humble/local_setup.sh
npm install

After this we could just copy and use it on the target hardware. Unfortunately, probably with these changes #1051 the cross compilation stopped working, we receive the following error:

npm ERR! command failed
npm ERR! command sh -c -- npm run generate-messages
npm ERR! > [email protected] generate-messages
npm ERR! > node scripts/generate_messages.js && node scripts/generate_tsd.js
npm ERR! 
npm ERR! Start generation of ROS2 JavaScript messages...
npm ERR! Caught error: Error: /devenv/UserApplication/example/node_modules/@rclnodejs/ref-napi/build/Release/binding.node: cannot open shared object file: No such file or directory
npm ERR! Start TypeScript declaration file generation...
npm ERR! Generation is done.
npm ERR! node:internal/modules/cjs/loader:1282
npm ERR!   return process.dlopen(module, path.toNamespacedPath(filename));
npm ERR!                  ^
npm ERR! 
npm ERR! Error: /devenv/UserApplication/example/node_modules/@rclnodejs/ref-napi/build/Release/binding.node: cannot open shared object file: No such file or directory
npm ERR!     at Object.Module._extensions..node (node:internal/modules/cjs/loader:1282:18)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1076:32)
npm ERR!     at Function.Module._load (node:internal/modules/cjs/loader:911:12)
npm ERR!     at Module.require (node:internal/modules/cjs/loader:1100:19)
npm ERR!     at require (node:internal/modules/cjs/helpers:119:18)
npm ERR!     at load (/devenv/UserApplication/example/node_modules/node-gyp-build/node-gyp-build.js:22:10)
npm ERR!     at Object.<anonymous> (/devenv/UserApplication/example/node_modules/@rclnodejs/ref-napi/lib/ref.js:8:53)
npm ERR!     at Module._compile (node:internal/modules/cjs/loader:1198:14)
npm ERR!     at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
npm ERR!     at Module.load (node:internal/modules/cjs/loader:1076:32) {
npm ERR!   code: 'ERR_DLOPEN_FAILED'
npm ERR! }

One thing that can be important to mention is that the generate_tsd.js is not doing anything new; the exact same thing is being done in generate_messages.js.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions