cross-compile libdmclient for QNX

download the source:

# git clone

autoconf the source:

# autoconf –install

set the qnx compile environment:

# source ~/qnx70/

create the file as follow:

export CC="qcc -V5.4.0,gcc_ntoaarch64le"
export CXX="q++ -V5.4.0,gcc_ntoaarch64le"

export LIBCURL_CFLAGS=-I/home/jiafei427/qnx70/target/qnx7/usr/include/curl
export LIBCURL_LIBS=-L/home/jiafei427/qnx70/target/qnx7/aarch64le/usr/lib
export SQLITE3_CFLAGS=-I/home/jiafei427/qnx70/target/qnx7/usr/include
export SQLITE3_LIBS=-L/home/jiafei427/qnx70/target/qnx7/aarch64le/usr/lib

echo "-- cleaning...."
make clean

./configure --prefix=/home/jiafei427/tmp/test/oma-dm/libdmclient/output --host=aarch64-nto-qnx CFLAGS="-I/home/jiafei427/qnx70/target/qnx7/usr/include/io-pkt/machine/ -I/home/jiafei427/qnx70/target/qnx7/usr/include/io-pkt/"

echo "-- Building"

make VERBOSE=1

echo "-- finish building"
make install

then it will compile the libdmclient to the output folder. 🙂


I tried to compile the test programs too, but there was some errors, so I just gave up.


Hope it can help others.



SCP related tips and issue resolve

Today, I had trouble to send a file to remote target board with the command following:

jiafei427@CKUBU:~/tmp$ scp /home/jiafei427/tmp/slrclub_cert.crt root@
sh: scp: cannot execute - No such file or directory
lost connection

Damn, had no clue what that meant, and googled like a forever.

used “-vvv” option, but nothing that I can recognize.


Finally found solution by myself, and actually that was a bit too easy.

Solution is simply put a “scp” binary into the target board.

scp will use the binary both in client and server side. 😦

(didn’t know that..)


Here put more examples about scp:

What is Secure Copy?

scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.


Copy the file “foobar.txt” from a remote host to the local host

$ scp /some/local/directory

Copy the file “foobar.txt” from the local host to a remote host

$ scp foobar.txt

Copy the directory “foo” from the local host to a remote host’s directory “bar”

$ scp -r foo

Copy the file “foobar.txt” from remote host “” to remote host “”

$ scp \

Copying the files “foo.txt” and “bar.txt” from the local host to your home directory on the remote host

$ scp foo.txt bar.txt

Copy the file “foobar.txt” from the local host to a remote host using port 2264

$ scp -P 2264 foobar.txt

Copy multiple files from the remote host to your current directory on the local host

$ scp\{a,b,c\} .
$ scp\{foo.txt,bar.txt\} .

scp Performance

By default scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option -c blowfish in the command line.

$ scp -c blowfish some_file

It is often suggested that the -C option for compression should also be used to increase speed. The effect of compression, however, will only significantly increase speed if your connection is very slow. Otherwise it may just be adding extra burden to the CPU. An example of using blowfish and compression:

$ scp -c blowfish -C local_file













Mount QNX file system

# df -h
/dev/emmc/ 95M 15M 80M 16% /efs/
/dev/emmc/uda0.97d7 2.9G 955M 2.0G 32% /base/
/dev/emmc/rpmb0 4.0M 4.0M 0 100%
/dev/emmc/boot1 2.0K 2.0K 0 100% /dev/emmc/boot1.
/dev/emmc/boot1 4.0M 4.0M 0 100%
/dev/emmc/boot0 4.0M 4.0M 0 100%
/dev/emmc/uda0 43G 43G 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 12G 12G 0 100% /dev/emmc/uda0.1
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.9
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.f
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.d
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.8
/dev/emmc/uda0 32M 32M 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 256M 256M 0 100% /dev/emmc/uda0.5
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.0
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 8.0K 8.0K 0 100% /dev/emmc/uda0.2
/dev/emmc/uda0 1.0K 1.0K 0 100% /dev/emmc/uda0.5
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.3
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.2
/dev/emmc/uda0 33M 33M 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 1.0K 1.0K 0 100% /dev/emmc/uda0.1
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 1.0K 1.0K 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 32M 32M 0 100% /dev/emmc/uda0.3
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 16M 16M 0 100% /dev/emmc/uda0.7
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.8
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.8
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.7
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.7
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 256K 256K 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 64M 64M 0 100% /dev/emmc/uda0.9
/dev/emmc/uda0 64M 64M 0 100% /dev/emmc/uda0.2
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 1.0M 1.0M 0 100% /dev/emmc/uda0.4
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 128K 128K 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.6
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.c
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.c
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 512K 512K 0 100% /dev/emmc/uda0.e
/dev/emmc/uda0 500K 500K 0 100% /dev/emmc/uda0.0
/dev/emmc/uda0 500K 500K 0 100% /dev/emmc/uda0.0
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.a
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.d
/dev/emmc/uda0 2.0M 2.0M 0 100% /dev/emmc/uda0.d
/dev/emmc/uda0 58G 58G 0 100%


PS. can't use this 43G of free spaces, so I needed to create a qnx6 filesystem on it and mount it


# df -n /dev/emmc/uda0.97d7b011-54da-4835-b3c4-917ad6e73d74.17
Filesystem Mounted on Type
/dev/emmc/uda0.97d7 /base/ qnx6

# df -n /dev/emmc/uda0.aa9a5c4c-4f1f-7d3a-014a-22bd33bf7191.47
Filesystem Mounted on Type
/dev/emmc/uda0 /dev/emmc/uda0.a blk-partition

# mkqnx6fs /dev/emmc/uda0.aa9a5c4c-4f1f-7d3a-014a-22bd33bf7191.47

# mount -t qnx6 /dev/emmc/uda0.aa9a5c4c-4f1f-7d3a-014a-22bd33bf7191.47 /shit/

# df -nh /shit
Filesystem Mounted on Type
/dev/emmc/uda0.aa9a /shit/ qnx6

# df -Ph /shit
Filesystem Size Used Available Capacity Mounted on
/dev/emmc/uda0.aa9a 43G 1.3G 41G 4% /shit/




[node.js] Error: setuid user id does not exist


# npm config ls -g
Error: setuid user id does not exist
at /base/usr/npm/node_modules/uid-number/uid-number.js:49:16
at ChildProcess.exithandler (child_process.js:197:7)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Error: ENOENT: no such file or directory, open 'npm-debug.log.3559331957'
at Error (native)

modify the file /base/usr/npm/node_modules/uid-number/uid-number.js

Goto line 11 and replace uidSupport = process.getuid && process.setuid with uidSupport = false


problem solved.

node.js dev. tips for myself

default location for node_modules:




with following command you can check the node-modules location which npm will install to:

$ npm prefix -g


when you want to develop node.js code in Sublime, install Docblock(comment_generator) and Nodejs(autocomplete) for sublime!



CRTL+B to run the program and observe result inside sublime




Posting Source Code in WordPress

Posting Source Code

While doesn’t allow you to use potentially dangerous code on your blog, there is a way to post source code for viewing. We have created a shortcode you can wrap around source code that preserves its formatting and even provides syntax highlighting for certain languages, like so:

#button {
    font-weight: bold;
    border: 2pxsolid#fff;

To accomplish the above, just wrap your code in these tags:

your code here

The language (or lang) parameter controls how the code is syntax highlighted. The following languages are supported:

  • actionscript3
  • bash
  • clojure
  • coldfusion
  • cpp
  • csharp
  • css
  • delphi
  • diff
  • erlang
  • fsharp
  • go
  • groovy
  • html
  • java
  • javafx
  • javascript
  • latex (you can also render LaTeX)
  • matlab (keywords only)
  • objc
  • perl
  • php
  • powershell
  • python
  • r
  • ruby
  • scala
  • sql
  • text
  • vb
  • xml

If the language parameter is not set, it will default to “text” (no syntax highlighting).

Code in between the source code tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

Configuration Parameters

The shortcodes also accept a variety of configuration parameters that you may use to customize the output. All are completely optional.

  • autolinks (true/false) — Makes all URLs in your posted code clickable. Defaults to true.
  • collapse (true/false) — If true, the code box will be collapsed when the page loads, requiring the visitor to click to expand it. Good for large code posts. Defaults to false.
  • firstline (number) — Use this to change what number the line numbering starts at. It defaults to 1.
  • gutter (true/false) — If false, the line numbering on the left side will be hidden. Defaults to true.
  • highlight (comma-seperated list of numbers) — You can list the line numbers you want to be highlighted. For example “4,7,19”.
  • htmlscript (true/false) — If true, any HTML/XML in your code will be highlighted. This is useful when you are mixing code into HTML, such as PHP inside of HTML. Defaults to false and will only work with certain code languages.
  • light (true/false) — If true, the gutter (line numbering) and margin (see below) will be hidden. This is helpful when posting only one or two lines of code. Defaults to false.
  • padlinenumbers (true/false/integer) — Allows you to control the line number padding. true will result in automatic padding, false will result in no padding, and entering a number will force a specific amount of padding.
  • title (string) — Set a label for your code block. Can be useful when combined with the collapseparameter.



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:

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"

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="--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.