I need to compile node.js on a 32-bit system to be compatible with code I already have.
I started with the source code from nodejs.org and compiled it. Then I began by changing lines 164-166 in the common.gypi file. It was:
164 [ 'target_arch=="x64"', {
165 'cflags': [ '-m64' ],
166 'ldflags': [ '-m64' ],
167 }],
and now it is:
164 [ 'target_arch=="x64"', {
165 'cflags': [ '-m32' ],
166 'ldflags': [ '-m32' ],
167 }],
When I tried to make it again, I am getting these errors:
../deps/v8/src/execution.h:259: error: integer constant is too large for ‘long’ type
../deps/v8/src/execution.h:260: error: integer constant is too large for ‘long’ type
../deps/v8/src/execution.h:259: error: a function call cannot appear in a constant-expression
../deps/v8/src/execution.h:260: error: a function call cannot appear in a constant-expression
These errors are referring to these lines:
#ifdef V8_TARGET_ARCH_X64
static const uintptr_t kInterruptLimit = V8_UINT64_C(0xfffffffffffffffe);
static const uintptr_t kIllegalLimit = V8_UINT64_C(0xfffffffffffffff8);
I believe this code is from google’s v8 source code.
I would appreciate any suggestions on either how to fix these particular compiling errors and/or how to compile the 64-bit node.js on a 32-bit system. Most the the research I’ve done is how to compile something 32-bit for a 64-bit system.
If you want to build an x86_32 version of node, you are modifying the parameters for the wrong target architecture. Instead, give the
--dest-cpuparameter to the configure script, like this:If these commands finish successfully, there should be a working x86_32 binary in
./out/Release/node:You can install it in your running system (at the prefix that you specified in the
--prefixparameter above) withsudo make install.Note that this requires a working C and C++ compiler to be set up. On Debian/Ubuntu,
sudo apt-get install build-essential(orbuild-essential:i386if you’re cross-compiling) should get you started. On rpm-based distributions, trysudo yum groupinstall "Development Tools" "Development Libraries".