NOTE: This post refers to Node v0.8.x. For new v0.10.x please visit this.
In my previous post I’ve described how to install Node v.0.6.19 into your Fox Board G20. Now I will show how to install the “fresh” 0.8 release of Node. For the identical steps please visit this.
-
Step 1 to step 4
The same as this.
-
Step 5: download Node source code
To download Node source code simply use customized nvm:
debarm:~$ nvm download v0.8.0
-
Step 6: customize SConstruct file
After a while you have the Node source code and you must customize the v8 script:
debarm:~$ nano ~/nvm/src/node-v0.8.0/deps/v8/SConstruct
'gcc': { 'all': { 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'], 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'], }, 'visibility:hidden': { # Use visibility=default to disable this. 'CXXFLAGS': ['-fvisibility=hidden'] },
and modify as follow:
'gcc': { 'all': { 'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv5tej', '-mthumb-interwork'], 'CXXFLAGS': ['-fno-rtti', '-fno-exceptions', '-march=armv5tej', '-mthumb-interwork'], }, 'visibility:hidden': { # Use visibility=default to disable this. 'CXXFLAGS': ['-fvisibility=hidden'] },
and finally this:
'armeabi:softfp' : { 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], 'vfp3:on': { 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] }, 'simulator:none': { 'CCFLAGS': ['-mfloat-abi=softfp'], } },
in this one:
'armeabi:softfp' : { 'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'], # 'vfp3:on': { # 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS'] # }, 'simulator:none': { 'CCFLAGS': ['-mfloat-abi=soft'], } },
-
Step 7: customize common.gypi
By default the v8 installer recognize the Fox Board as an armv7, but isn’t right (see this).
Edit common.gypi:
debarm:~$ nano ~/nvm/src/node-v0.8.0/deps/v8/build/common.gypy
and change this:
{ 'variables': { 'use_system_v8%': 0, 'msvs_use_common_release': 0, 'gcc_version%': 'unknown', 'v8_compress_startup_data%': 'off', 'v8_target_arch%': '<(target_arch)',
as follow:
{ 'variables': { 'armv7%': 0, 'arm_neon%': 0, 'use_system_v8%': 0, 'msvs_use_common_release': 0, 'gcc_version%': 'unknown', 'v8_compress_startup_data%': 'off', 'v8_target_arch%': '<(target_arch)',
-
Step 8: customize macro-assembler-arm.cc
As workaround for "For thumb inter-working we require an architecture which supports blx" error message during v8 compilation, you must customize macro-assembler-arm.cc source code:
debarm:~$ nano ~/nvm/src/node-v0.8.0/deps/v8/src/arm/macro-assembler-arm.cc
from this:
// We do not support thumb inter-working with an arm architecture not supporting // the blx instruction (below v5t). If you know what CPU you are compiling for // you can use -march=armv7 or similar. #if defined(USE_THUMB_INTERWORK) && !defined(CAN_USE_THUMB_INSTRUCTIONS) # error 'For thumb inter-working we require an architecture which supports blx' #endif
to this:
// We do not support thumb inter-working with an arm architecture not supporting // the blx instruction (below v5t). If you know what CPU you are compiling for // you can use -march=armv7 or similar. // #if defined(USE_THUMB_INTERWORK) && !defined(CAN_USE_THUMB_INSTRUCTIONS) // # error 'For thumb inter-working we require an architecture which supports blx'; // #endif
-
Step 9: install Node
Now use again nvm:
debarm:~$ nvm foxinstall v0.8.0
After a few hours (be patient!) you have compiled the latest Node version and you must use it:
debarm:~$ nvm use v0.8.0
Done! Now you can verify all:
debarm:~$ node -v debarm:~$ npm -v
If all versions appear, you can install your desired Node packages using npm as you know:
debarm:~$ npm install express
You can also set the default Node version as follow:
debarm:~$ nvm alias default v0.8.0
Good programming with Node!
Arm , Node.js
About Marcello Gesmundo
I'm the founder of Yoovant company. I'm an engineer and an artist: what could be better than combine the technologies with the arts?
Do you know whether these instructions would also apply for the Raspberry Pi?
Hi Rob,
I don’t have a Raspberry Pi to try (sorry), but for his processor, you can avoid step 7 and check your cpuinfo:
and change step 6 accordingly. For example, if your cpu doesn’t have thumb feature and shows ARM11 as cpu architecture, you can use:
If you have some difficulty please copy and paste here your cpuinfo result.
Marcello