cross-compile zeromq/zeromq.js

since zero.node is not updating periodically, I decided to cross-compile zeromq.js from zeromq community.


  1. Download source from github.
    # git clone <a href="" data-mce-href=""></a> zeromq
  2. run command
    # npm install --arch=arm64 --verbose
  3. modify the node-gyp’s for QNX
    # vi ./node_modules/node-gyp/gyp/pylib/gyp/generator/
    change following line
    DEPFLAGS = -MMD -MF $(depfile).raw
    DEPFLAGS = -Wp,-MMD,$(depfile) -Wp,-MF,$(depfile).raw
  4. set the QNX dev environment
    # source ~/qnx70/
  5. modify the ./script/ as follow, added CC and CXX, also changed dirname to realpath to the command
    export CC="qcc -V5.4.0,gcc_ntoarmv7le"
    export CXX="q++ -V5.4.0,gcc_ntoarmv7le"
    export ZMQ_BUILD_OPTIONS="--host=aarch64-qnx"
    set -e
    if [ "$1" != "" ]; then
     echo "No ZMQ version given"
     exit 1
    export BASE=$(dirname "$0")
    export ZMQ_PREFIX=$(realpath "${BASE}/../zmq")
    export ZMQ_SRC_DIR=zeromq-$ZMQ
    cd "${ZMQ_PREFIX}"
    export CFLAGS=-fPIC
    export CXXFLAGS=-fPIC
    export PKG_CONFIG_PATH="${ZMQ_PREFIX}/lib/pkgconfig"
    echo "zeromq-$ZMQ.tar.gz"
    test -d "${ZMQ_SRC_DIR}" || tar xzf zeromq-$ZMQ.tar.gz
    cd "${ZMQ_SRC_DIR}"
    test -f configure || ./
    if [ "$ZMQ" = "4.1.6" ]; then
     ./configure "--prefix=${ZMQ_PREFIX}" --with-relaxed --enable-static --disable-shared --without-documentation ${ZMQ_BUILD_OPTIONS}
     ./configure "--prefix=${ZMQ_PREFIX}" --disable-pedantic --enable-static --disable-shared --without-docs ${ZMQ_BUILD_OPTIONS}
    make -j 2
    make install
    cd "${ZMQ_PREFIX}"
    rm -rf "${ZMQ_SRC_DIR}"
    rm -f zeromq-$ZMQ.tar.gz
  6. run the script
    #./scripts/ 4.2.2

    the you will have built output from zmq,
    jiafei427@CKUBU:~/tmp/test/node_test/zeromq/zmq$ ls
    bin include lib

  7. build again
    # npm install --arch=arm64 --verbose
  8. That’s it. :p

Leave a Reply

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

You are commenting using your 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