cross-compile node.js for QNX

I was able to cross-compile the node-0-10-ver from this link.

FYI. my build-script was abit differ from the original one as follow:


#!/bin/bash#!/bin/bash
if [ ! -d "${QNX_HOST}" ]; then  echo "QNX_HOST must be set to the path of the QNX host toolchain."  exit 1fi
if [ ! -d "${QNX_TARGET}" ]; then  echo "QNX_TARGET must be set to the path of the QNX target toolchain."  exit 1fi
if [ "${QCONF_OVERRIDE}" != "" ]; then  cp -p $QCONF_OVERRIDE /tmp/owbqsk$$.mk  echo "all:" >>/tmp/owbqsk$$.mk  echo ' echo $(INSTALL_ROOT_nto)' >>/tmp/owbqsk$$.mk  STAGE_DIR=`make -s -f /tmp/owbqsk$$.mk`  rm /tmp/owbqsk$$.mkfi
if [ "${STAGE_DIR}" == "" ]; then  echo Staging directory could not be determined. Using NDK.else  echo Using staging directory: ${STAGE_DIR}fi
if [ "${1}" == "clean" ]; then  make -f Makefile clean  exit 1fi

echo Building for aarch64 #CPU="aarch64"CPU="arm"CPUDIR="${CPU}le-v7"CPUTYPE="${CPU}v7le"BUSUFFIX="${CPU}v7"CPU_VER="cortex-a9"#CPU_CFLAGS="-mtune=${CPU_VER} -mfpu=vfpv3"CPU_CFLAGS="-mtune=${CPU_VER} -mfpu=vfpv3-d16"

QNX_TOOL_DIR="${QNX_HOST}/usr/bin"QNX_COMPILER="${QNX_TOOL_DIR}/ntoarmv7-gcc"QNX_COMPILER="${QNX_TOOL_DIR}/qcc"QNX_TOOL_PREFIX="${QNX_TOOL_DIR}/nto${BUSUFFIX}"
if [ "${STAGE_DIR}" == "" ]; then   QNX_LIB="${QNX_TARGET}/${CPUDIR}/lib"  QNX_USR_LIB="${QNX_TARGET}/${CPUDIR}/usr/lib"  QNX_INC="${QNX_TARGET}/usr/include"else  QNX_LIB="${STAGE_DIR}/${CPUDIR}/lib"  QNX_USR_LIB="${STAGE_DIR}/${CPUDIR}/usr/lib"  QNX_INC="${STAGE_DIR}/usr/include"fi
COMP_PATHS=" \  -Wl,-rpath-link,${QNX_LIB} \  -Wl,-rpath-link,${QNX_USR_LIB} \  -L${QNX_LIB} \  -L${QNX_USR_LIB} \  -I${QNX_INC}"
export CC="${QNX_COMPILER}"export CFLAGS="-V5.4.0,gcc_ntoarmv7le -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-V5.4.0,gcc_ntoarmv7le -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie -D__QNXNTO__ ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-V5.4.0,gcc_ntoaarch64le -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-Vgcc_nto${CPUTYPE} -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-Vgcc_nto${CPUTYPE} -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CFLAGS="-Vgcc_nto${CPUTYPE} -g -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -D__QNXNTO65__ ${COMP_PATHS} ${CPU_CFLAGS}" for QNX650export CXX="${QNX_COMPILER}"#export CXXFLAGS="-Vgcc_nto${CPUTYPE}_cpp-ne -g -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -pie ${COMP_PATHS} ${CPU_CFLAGS}"#export CXXFLAGS="-Vgcc_nto${CPUTYPE}_cpp-ne -g -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -Wl,--export-dynamic ${COMP_PATHS} ${CPU_CFLAGS}"#export CXXFLAGS="-Vgcc_nto${CPUTYPE}_cpp-ne -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -Wl,--export-dynamic ${COMP_PATHS} ${CPU_CFLAGS}"#export CXXFLAGS="-V5.4.0,gcc_ntoaarch64le -g -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -Wl,--export-dynamic ${COMP_PATHS} ${CPU_CFLAGS}"export CXXFLAGS="-V5.4.0,gcc_ntoarmv7le -g -lang-c++ -Wformat -Wformat-security -Werror=format-security -Wl,-z,relro -fPIE -Wl,--export-dynamic ${COMP_PATHS} ${CPU_CFLAGS}"export AR="${QNX_TOOL_PREFIX}-ar"export LINK="${QNX_COMPILER}"export LDFLAGS="${CXXFLAGS} -lcrypto -lssl"export RANLIB="${QNX_TOOL_PREFIX}-ranlib"
export __QNXNTO=1
# The set of GYP_DEFINES to pass to gyp.export GYP_DEFINES="OS=qnx want_separate_host_toolset=0"#export GYP_GENERATORS="make-linux"
CONFIGURE_OPTIONS=""

CONFIGURE_OPTIONS="--dest-cpu=arm --dest-os=qnx --with-arm-float-abi=softfp --without-snapshot --without-dtrace"
./configure --shared-openssl --shared-zlib ${CONFIGURE_OPTIONS}
if [ "${1}" == "test" ]; then  make testelse  make -j4fi

 

Anyway I couldn’t to make it run on aarch64 since I’m running out of time.

 

 

 

Ref.:

http://blog.hemnik.com/2014/06/nodejs-for-qnx-source-code.html

http://fastr.github.io/articles/cross-compiling-node.js-for-arm.html

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s