问题
I'm trying to cross-compile the node.js module contextify (as part of jsdom) for ARM platform on my 64bit Fedora installation. However, I seem unable to build for any other platform than the one I'm running on. I've tried different ways such as running node-gyp --arch=arm configure rebuild
, or also node-gyp configure --without-snapshot --dest-cpu=arm --dest-os=linux --with-arm-float-abi=softfp rebuild
(a command I've found online somewhere when looking for this problem).
The build runs successful without giving warnings or errors. However, it seems the target architecture just doesn't matter. I always end up with the a binary for my own 64bit system, not for ARM anything else I've tried. Using ia32
didn't change anything either - it looks like the provided parameters just have no effect. What am I doing wrong here?
Here's a complete console output:
bash-4.2# node-gyp clean configure --arch=arm rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@1.0.2
gyp info using node@0.10.29 | linux | x64
gyp info spawn python
gyp info spawn args [ '/usr/lib/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 '/src/node_modules/jsdom/node_modules/contextify/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/.node-gyp/0.10.29/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/.node-gyp/0.10.29',
gyp info spawn args '-Dmodule_root_dir=/src/node_modules/jsdom/node_modules/contextify',
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 python
gyp info spawn args [ '/usr/lib/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 '/src/node_modules/jsdom/node_modules/contextify/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/.node-gyp/0.10.29/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/.node-gyp/0.10.29',
gyp info spawn args '-Dmodule_root_dir=/src/node_modules/jsdom/node_modules/contextify',
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 make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/src/node_modules/jsdom/node_modules/contextify/build'
make: Warning: File `contextify.target.mk' has modification time 0.044 s in the future
CXX(target) Release/obj.target/contextify/src/contextify.o
SOLINK_MODULE(target) Release/obj.target/contextify.node
SOLINK_MODULE(target) Release/obj.target/contextify.node: Finished
COPY Release/contextify.node
make: warning: Clock skew detected. Your build may be incomplete.
make: Leaving directory `/src/node_modules/jsdom/node_modules/contextify/build'
gyp info ok
回答1:
You need to make sure you have the appropriate CC, CXX, etc. environment variables set up for the cross compiler before invoking node-gyp
so that it knows which compiler to use.
来源:https://stackoverflow.com/questions/25797424/cross-compile-node-js-contextify-for-arm