Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to crosscompile form debian 64bit to ARM 32bit? #304

Closed
z0nk opened this issue Aug 5, 2013 · 4 comments
Closed

How to crosscompile form debian 64bit to ARM 32bit? #304

z0nk opened this issue Aug 5, 2013 · 4 comments

Comments

@z0nk
Copy link

z0nk commented Aug 5, 2013

I am trying to cross compile my node-addon.
using the following configure command: node-gyp --arch arm --host_arch=arm --arm_fpu=vfpv2 configure
The config.gypi File looks correct but I get the following error if i try to use the addon:

module.js:356
Module._extensions[extension](this, filename);
Error: /home/pi/site/test/build/Release/myaddon.node: wrong ELF class: ELFCLASS64
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/pi/temp/website/app.js:14:30)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)

And if I try to compile the addon nativ on my raspberry I get the following error:
cc1plus: error: unrecognized command line option ‘-std=c++11’

I cant find anything to solve this problem. Can someone help?
thanks!

@z0nk
Copy link
Author

z0nk commented Aug 5, 2013

Native compilation works after updating g++ and gcc from 4.6 to 4.7.2-5.
Cross compilation would still be nice.

@jandrieu
Copy link

I think you are just missing an '=' sign. Specify --arch=arm. Also, make sure you have your cross-compiler prefixes configured:

$ export AR=arm-unknown-linux-gnueabi-ar
$ export CC=arm-unknown-linux-gnueabi-gcc
$ export CXX=arm-unknown-linux-gnueabi-g++
$ export LINK=arm-unknown-linux-gnueabi-g++

Probably the best write up of this is at http://n8.io/cross-compiling-nodejs-v0.8/ although the --arch=arm is here: https://groups.google.com/forum/#!topic/nodejs/sANqg3PsZQU

@maitreyi-timesys
Copy link

I am trying to generate arm specific node-sqlite3 addon by following commands
1- Have set the env by sourcing the env generated from Toolchain
to set following
echo $CC
arm-poky-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a9 --sysroot=/home/user/ansbld/tmp/deploy/sdk/toolchain/sysroots/cortexa9-vfp-neon-poky-linux-gnueabi
echo $CXX
arm-poky-linux-gnueabi-g++ -march=armv7-a -mfloat-abi=softfp -mfpu=neon -mtune=cortex-a9 --sysroot=/home/user/ansbld/tmp/deploy/sdk/toolchain/sysroots/cortexa9-vfp-neon-poky-linux-gnueabi

2- Now invoking npm
sudo npm install sqlite3 --target_arch=arm --build-from-source=sqlite3 --target_platform=linux

This generates the lib/binding/node-v14-linux-arm/node_sqlite3.node but this is not compiled for arm platform rather for host environment

I have also tried using node-gyp and node-pre-gyp
but no success so far

@bnoordhuis
Copy link
Member

Cross-compilation is not really supported at the moment, see the discussion in #829, particularly #829 (comment). I'll close out this issue in favor of that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants