Skip to content

Instantly share code, notes, and snippets.

@albi90

albi90/how to

Last active Jan 20, 2019
Embed
What would you like to do?
Compiling node-webkit on raspberry pi
cd ~
mkdir .gyp
nano .gyp/include.gypi
paste the following
{
'variables': {
'linux_use_gold_binary' : 0,
'linux_use_gold_flags' : 0,
'target_arch': 'arm',
'disable_nacl': 1, # NaCL does not build for ARM.
'linux_use_tcmalloc': 0, # tcmalloc does not build for ARM.
'armv7': 0, # Optional, for targeting ARMv7.
'armv6': 1, # Optional, for targeting ARMv6.
'arm_thumb': 0, # Optional, for targeting thumb. Combine with armv7 to target thumb2.
'arm_neon': 0, # Optional, to disable NEON. 1 is the default, and most people want to keep it that way.
'arm_fpu': 'vfp', # Optional, to select which version of vfp to use if NEON is off. Default is vfpv3.
'verbose': 1,
'use_system_yasm': 0,
'werror' : ''
}
}
-Save
nano arm.env
paste the following
export CXX=g++
export CC=gcc
export AR=ar
export AS=as
export RANLIB=ranlib
export CFLAGS="-I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -march=armv6 -mfpu=vfp -mfloat-abi=hard"
export CCFLAGS=$CFLAGS
export CXXFLAGS="-I/usr/include/gtk-2.0 -I/usr/include/glib-2.0/ -I/usr/lib/glib-2.0/include/ -I/usr/include/pango-1.0 -I/usr/include/cairo/ -I/usr/include/librsvg-2 -O3 -march=armv6 -mfpu=vfp -mfloat-abi=hard"
export GYP_DEFINES="target_arch=arm disable_nacl=1 linux_use_tcmalloc=0 armv6=1 arm_thumb=0 use_libjpeg_turbo=0"
export GYP_GENERATORS='make'
-Save
source arm.env
sudo nano /etc/dphys-swapfile
overwrite the file contients with
CONF_MAXSWAP=3072
CONF_SWAPSIZE=3072
-Save
sudo dphys-swapfile setup
sudo dphys-swapfile swapon
-Get the src for node-webkit (i wont document that here)
cd src/third_party/ffmpeg
nano ffmpeg.gyp and replace "armv7-a" with "armv6", "vfp16-d3" with "vfp" and remove mtune=cortex-a8 and mthumb options.
./configure --arch=armel --target-os=linux --enable-gpl
cp config.h chromium/config/Chromium/linux/arm/
cd ../../
nano third_party/node/deps/v8/SConstruct
-change
'all': {
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS'],
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions'],
},
-to
'all': {
'CCFLAGS': ['$DIALECTFLAGS', '$WARNINGFLAGS', '-march=armv6'],
'CXXFLAGS': ['-fno-rtti', '-fno-exceptions', '-march=armv6'],
},
-change
'armeabi:softfp' : {
'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0'],
'vfp3:on': {
'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS']
},
'simulator:none': {
'CCFLAGS': ['-mfloat-abi=softfp'],
}
},
-to
'armeabi:softfp' : {
'CPPDEFINES' : ['USE_EABI_HARDFLOAT=0']
# 'vfp3:on': {
# 'CPPDEFINES' : ['CAN_USE_VFP_INSTRUCTIONS']
# },
# 'simulator:none': {
# 'CCFLAGS': ['-mfloat-abi=softfp'],
# }
},
-Save
nano build/common.gypi
-change
['OS=="linux" and target_arch=="arm" and chromeos==0', {
# Set some defaults for arm/linux chrome builds
'linux_breakpad%': 0,
'linux_use_tcmalloc%': 0,
# sysroot needs to be an absolute path otherwise it generates
# incorrect results when passed to pkg-config
'sysroot%': '<!(cd <(DEPTH) && pwd -P)/arm-sysroot',
}], # OS=="linux" and target_arch=="arm" and chromeos==0
-to
['OS=="linux" and target_arch=="arm" and chromeos==0', {
# Set some defaults for arm/linux chrome builds
'linux_breakpad%': 0,
'linux_use_tcmalloc%': 0,
# sysroot needs to be an absolute path otherwise it generates
# incorrect results when passed to pkg-config
#'sysroot%': '<!(cd <(DEPTH) && pwd -P)/arm-sysroot',
}], # OS=="linux" and target_arch=="arm" and chromeos==0
now just run
make nw -j4 BUILDTYPE=Release
the compile will take about 3 days so you better have a good magazine to read
@singhularity

This comment has been minimized.

Copy link

@singhularity singhularity commented Feb 2, 2014

Hi,
I ran into trouble trying to follow this gist. I get stuck when trying to find the ffmpeg.gyp, I don't see it in the source for node-webkit. Can you please update this gist if it has changed or if possible point me to a compiled raspi version of node-webkit if you have one?

Appreciate the help!

@ndhunju

This comment has been minimized.

Copy link

@ndhunju ndhunju commented Jul 9, 2014

@singhularity have you found a better way to use node-webkit on RaspberryPi? I would really appreciate if you could point it to me.
@albi90 I really appreciate your efforts to make nw runnable on RaspberryPi! would love to know if you have improved the compilation time or maybe you could forward me the compiled code.. thank you :)

@jlank

This comment has been minimized.

Copy link

@jlank jlank commented Nov 21, 2014

@albi90 could you also shoot me the compiled code if you have it? I was all geeked up to compile it on my Pi but my SD card is too small to compile chromium (says it needs 14G of space), thanks!

@jalbam

This comment has been minimized.

Copy link

@jalbam jalbam commented Aug 14, 2016

Hello,

I have just created a repository with the node-webkit binary port that runs on Raspbian, tested and working on Raspberry Pi 1 and Raspberry Pi 3 so it is ARMv6 and ARMv7 compatible.

Here you can check it: https://github.com/jalbam/nwjs_rpi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.