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="https://github.com/zeromq/zeromq.js.git" data-mce-href="https://github.com/zeromq/zeromq.js.git">https://github.com/zeromq/zeromq.js.git</a> zeromq
    
  2. run command
    # npm install --arch=arm64 --verbose
    
  3. modify the node-gyp’s make.py for QNX
    # vi ./node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
    change following line
    DEPFLAGS = -MMD -MF $(depfile).raw
    to
    DEPFLAGS = -Wp,-MMD,$(depfile) -Wp,-MF,$(depfile).raw
    
  4. set the QNX dev environment
    # source ~/qnx70/qnxsdp-env.sh
    
  5. modify the ./script/build_libzmq.sh as follow, added CC and CXX, also changed dirname to realpath to the command
    
    #!/bin/sh
    
    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
     ZMQ=$1
    else
     echo "No ZMQ version given"
     exit 1
    fi
    
    export MACOSX_DEPLOYMENT_TARGET=10.9
    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 || ./autogen.sh
    if [ "$ZMQ" = "4.1.6" ]; then
     ./configure "--prefix=${ZMQ_PREFIX}" --with-relaxed --enable-static --disable-shared --without-documentation ${ZMQ_BUILD_OPTIONS}
    else
     ./configure "--prefix=${ZMQ_PREFIX}" --disable-pedantic --enable-static --disable-shared --without-docs ${ZMQ_BUILD_OPTIONS}
    fi
    make -j 2
    make install
    
    cd "${ZMQ_PREFIX}"
    rm -rf "${ZMQ_SRC_DIR}"
    rm -f zeromq-$ZMQ.tar.gz
    
  6. run the script
    #./scripts/build_libzmq.sh 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
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