Compiling nodejs with toolchain {solved}

hi there I being trying to figure out, how to compile nodejs with sunix toolchain but i am missing something..

is this way still valid method ??

I never used the toolchain before but I think this is it if I not mistaken for sunix-cortexa7 https://downloads.openwrt.org/releases/18.06.1/targets/sunxi/cortexa7/openwrt-sdk-18.06.1-sunxi-cortexa7_gcc-7.3.0_musl_eabi.Linux-x86_64.tar.xz

or do I

    git clone https://git.openwrt.org/openwrt/openwrt.git

and build it from the source code for openwrt ???

i downloaded the source version of node 10.15.1

but I am lost here for the most part.

HOMEPATH="/home/username/openwrt/trunk"
#These depend on your arch. Look it up on your build folder.
ARCH="mips-openwrt-linux-uclibc"
TARCH="mips_34kc_gcc-4.8-linaro_uClibc-0.9.33.2"

export AR=${HOMEPATH}/staging_dir/toolchain-${TARCH}/bin/${ARCH}-ar
export CC=${HOMEPATH}/staging_dir/toolchain-${TARCH}/bin/${ARCH}-gcc
export CXX=${HOMEPATH}/staging_dir/toolchain-${TARCH}/bin/${ARCH}-g++
export LINK=${HOMEPATH}/staging_dir/toolchain-${TARCH}/bin/${ARCH}-g++
export RANLIB=${HOMEPATH}/staging_dir/toolchain-${TARCH}/bin/${ARCH}-ranlib
export STAGING_DIR=${HOMEPATH}/staging_dir
export LIBPATH=${HOMEPATH}/staging_dir/toolchain-${TARCH}/lib
export LDFLAGS='-Wl,-rpath-link '${LIBPATH}

homepath I point at my SDK dir or source dir though neither the SDK or source have a folder called trunk

I am a little lost what to put for ARCH & TARCH

I have no clue what you use for ARCH -- ????
I think TARCH = arm_cortex-a7+neon-vfpv4_gcc-7.3.0_musl_eabi

lastly where does one place these global variables
It says to cd into Node folder and add these global variable but it does not say what or where it should be added too..

would anyone be kind enough to help me out with this

Create a package, probably as a modification to the existing one. Build it in the build environment, not as a stand-alone compile. I prefer the full build environment, https://openwrt.org/docs/guide-developer/build-system/start

If you haven't already, at least scan through https://forum.openwrt.org/search?q=nodejs

yes I looked through the forum thread already all say roughly the same-
https://openwrt.org/docs/guide-developer/build-system/start
I look through that i can not find mention how to compile NodeJs to a higher version then 8.10 (your current default) I need atleast nodejs 8.11 to a maximum 10.15.1 ..
of all the searching that gave some information how to do it is the above mention webpage that is relatively current to the the base os

I have a working cross compiler for openwrt from source... but I can not see how to tell it how to compile stable node 9.9.8 or lts 10.15.1 version of node.. can you atleast give some hint how to do that .

Branch the feed containing ./feeds/packages/lang/node/Makefile

Rework

PKG_NAME:=node
PKG_VERSION:=v8.14.1
PKG_RELEASE:=1
PKG_SOURCE:=node-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://nodejs.org/dist/${PKG_VERSION}
PKG_HASH:=b1df87803ddffb76fc6739f025f69f6b8288514fcd2f278f0d675ac3d52a6b9b

Build you own personal version

Confirm it works and send a patch to the package maintainer

1 Like

...or just import "upstream" packages?

2 Likes

thank you kindly for the reply jeff -- I tried your method actually a few times now. the first time it did not compile until I deleted patch 4.. as it was editing the cypto.cc to be the same. after that it compiled fine . but seams something is wrong with npm it compile but crashes on the openwrt device.. i will look into that more ( it complains --Cannot convert name to ASCII--- Error: npm.load() required - google say ICU issue )

but first i will try diizzy suggested method currently it is compiling currently from a fresh openwrt build so that will be a while before I can see the results

Thank you kindly diizzzy provided link worked perfectly..
here a basic how to if someone else need to upgrade Nodejs

git clone https://git.openwrt.org/openwrt/openwrt.git/
cd openwrt

git fetch --tags   ( choose version you wish to use oe v18.06.1   the current)
git checkout v18.06.1

./scripts/feeds update -a
./scripts/feeds install -a

now edit feeds.conf.default add line

ie : nano feeds.conf.default

src-git node https://github.com/nxhack/openwrt-node-packages.git

run the following

./scripts/feeds update node
rm ./package/feeds/packages/node
rm ./package/feeds/packages/node-*
./scripts/feeds install -a -p node

once done

make menuconfig 

set your Target System and Subtarget to match your device
then go to - languages ----> node.js---> and select module you will to compile for nodejs.

make

once done copy to usb stick and install into openwrt system with opkg install

@sash99 If your problem is solved, please consider marking this topic as [Solved]. (Click the pencil behind the topic...)

Thanks for the guide. I am trying this to get node 10 to my RPi, but when closing make menuconfig I get:
"WARNING: Makefile 'package/feeds/node/node/Makefile' has a dependency on 'icu-full-data', which does not exist"
I neither can install it with apt nor find it in menuconfig menus. What should I do?

oh you're using apt so it not openwrt os probably debian based of some form
try this method

Yeah, I am working on Debian PC, but trying to make node for OpenWrt.

I never had this issue
try searching these icu files
apt-cache search libicu

then install the dev tools for them and perhaps what ever else you might be missing related to icu

you could also try install node on your debian machine then install

npm install [-g] full-icu

and see if it solves your issue

Thanks! I'll try these tomorrow

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.