Skip to contentSkip to conversation

Cross-compiling Node-RED 0.10.10 on Openembedded Yocto project LINUX

DISCUSSION Jeff Hatch 1 participant 1 message Sep 17, 2015

lore
Share & tools
lore

Jeff Hatch

author
#0 lore raw

I'm running into some difficulty building Node-RED 0.10.10 for an ARM architecture project. I am trying to build using the Openembedded Yocto core
to cross-compile the firmware for the project I am working on. There are some
custom modifications that we have made to Node-RED, primarily adding our own
nodes integrated for our hardware. These changes have been integrated using
diffs applied to the code from GitHub. Due to these changes, I need to follow
the development procedure:

# git clone https://github.com/node-red/node-red.git
# cd node-red
# npm install
# sudo npm install -g grunt-cli
# grunt build
# node red

Previously the build was using "npm install --production" and built successfully, and Node-RED would run just fine on our ARM based product. This
is no longer sufficient for building and running Node-RED 0.10.10 in the manner
we wish to build and install it because it appears that the build is now generating files that don't get created with "npm install --production". I am
presuming that Node-RED 0.11.1 will have the same requirement(s).

There is a command in the Yocto project bitbake recipes called oe_runnpm that
allows the running of npm commands in the build with the appropriate environment all set up. This is not working with the "grunt build" command.
Whether grunt is installed locally or globally the following error indicating that,
from what I can tell, grunt is using the build server architecture instead of
the cross-compile ARM architecture occurs:

ERROR: QA Issue: Architecture did not match (40 to 62)
on /work/arm926ejste-mlinux-linux-gnueabi/node-red/0.10.4-r47/packages-split/node-red/opt/node-red/node_modules/grunt-sass/node_modules/node-sass/vendor/linux-x64-11/binding.node

The following is what my bitbake recipe looks like:

DESCRIPTION = "Node-RED"
HOMEPAGE = "http://nodered.org"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=2ee41112a44fe7014dce33e26468ba93" DEPENDS = "nodejs nodejs-native"
PR = "r47"

inherit npm
inherit update-rc.d

.
.
.

S = "${WORKDIR}/git"

INITSCRIPT_NAME = "node-red"
INITSCRIPT_PARAMS = "defaults 99 21"

do_install() {

    # npm install dependencies
    oe_runnpm install
    # npm install more stuff
    oe_runnpm install grunt-cli
    ./node_modules/grunt-cli/bin/grunt build
    oe_runnpm install serialport nodemailer

    # remove dupe deps
    oe_runnpm dedupe

    # install node-red
    install -d ${D}/opt/node-red
    cp -r * ${D}/opt/node-red/

    # install -d -p ${D}/opt/node-red/nodes/mts
    # cp -r ${WORKDIR}/apps/lora ${D}/opt/node-red/nodes/mts/

    install -d ${D}${sysconfdir}/init.d
    install -m 0755 ${WORKDIR}/node-red.init

${D}${sysconfdir}/init.d/node-red

    install -d ${D}${bindir}
    install -m 0755 ${WORKDIR}/update-flows ${D}${bindir}/
}

I am not very familiar with this grunt utility. Is there any guidance or an
alternative that you could give me that might work to get this build to succeed? This error is related to grunt-sass which requires node-sass, which
requires libsass. The version of node-js being integrated with this is 0.10.40.

Thank You,

Signature · 11 lines
Jeff Hatch
Senior Software Engineer


1 (763) 717 - 5574   DIRECT
1 (763) 228 - 3603   MOBILE

2205 Woodale Drive 
Mounds View, MN 55112

www.multitech.com