Inspiration

Zenoh is a pub/sub, query and storage protocol that robotics uses as a ROS 2 middleware (rmw_zenoh), and that automotive and industrial teams use to move data between small devices, gateways and the cloud. Those are QNX's markets, but on 4 Nov 2026 I found no QNX support for zenoh-pico anywhere: not on repo.oss.qnx.com, not in the QNX open-source ports project, and no mention in the upstream code. A QNX controller that wants to publish its data to a Zenoh network had no client to do it with.

What it does

A QNX 8.0 program links libzenohpico.so and can then publish, subscribe, query and answer queries against Zenoh routers and peers on any other system.

  • No fork. zenoh-pico 1.10.2 can load a platform from outside its source tree as a CMake package. The port is such a package, zenohpico-qnx, plus a two-line patch. build.sh fetches the pinned upstream release, applies the patch and builds it unchanged otherwise.
  • The qnx platform profile builds zenoh-pico's own unix system layer and POSIX transports (TCP, UDP unicast and multicast, serial) with BSD semantics, because QNX 8.0's network stack, io-sock, comes from FreeBSD (SO_NOSIGPIPE, getifaddrs). It links QNX's socket library and m.
  • Random bytes for QNX. zenoh-pico needs arc4random for session ids, and QNX's libc has no getrandom, getentropy or arc4random. The port provides them from /dev/urandom. On QNX every read() is a message to the random resource manager, and zenoh-pico asks for a few bytes at a time, so small requests come from a 4 KiB pool that one read fills. Each byte is handed out once and then wiped, the child of a fork() starts with an empty pool, and if the device cannot be read the process aborts rather than hand out predictable ids.
  • A usable package. It installs headers, the library and a CMake config, so a QNX project needs only find_package(zenohpico) and target_link_libraries(my_app PRIVATE zenohpico::lib). A downstream consumer built this way runs on the target.
  • Tests on the target. test/run-on-qnx.sh copies zenoh-pico's own test suite to a QNX target over ssh and runs it; test/interop.sh checks a QNX program against the reference Rust router, zenohd, and a Linux peer.

Results on QNX 8.0 (x86_64, QEMU with KVM)

  • The library, 32 examples and 40 tests build.
  • 41 of 41 tests pass on the target: zenoh-pico's 40 and the port's own random test.
  • Interoperability with zenohd 1.10.2 and zenoh-pico on Linux, 4 of 4 checks: the QNX session sees the router; QNX publishes to Linux (5 of 5 messages arrive); Linux publishes to QNX (4 of 4); a Linux query is answered by a QNX queryable.
  • aarch64le builds with the same script. It has not run on an aarch64 target yet.

How I built it

  • QNX SDP 8.0 in WSL 2 Ubuntu 24.04, CMake 3.28 and Ninja, the SDP's GCC drivers (x86_64-pc-nto-qnx8.0.0-gcc, aarch64-unknown-nto-qnx8.0.0-gcc) through cmake/qnx-toolchain.cmake.
  • Target: a mkqnximage image under QEMU with KVM, with sshd, random and io-sock running. Test binaries and the library go over scp to /data/zp; each test runs under timeout and its log is kept in /dev/shmem.
  • Interop: zenohd 1.10.2 from the Eclipse release, a Linux build of the same zenoh-pico, and the QNX guest reaching the host through QEMU's user network.

The files that show the QNX connection

  • zenohpico-qnx/cmake/platforms/qnx.cmake: the qnx platform profile (BSD socket semantics for io-sock, socket and m libraries).
  • zenohpico-qnx/src/random_qnx.c: arc4random and arc4random_buf for QNX from the random resource manager, pooled, fork-safe.
  • zenohpico-qnx/include/zenoh_qnx_platform.h: the platform header zenoh-pico includes for QNX.
  • patches/0001-transport-include-sys-socket.h.patch: the upstream change QNX's headers need.
  • cmake/qnx-toolchain.cmake: CMake toolchain for the QNX 8.0 GCC drivers, x86_64 and aarch64le.
  • test/results-x86_64.md and test/interop-x86_64.md: the runs on the QNX target.

Challenges

  • qcc passes -pipe on to cc1, and zenoh-pico's release flags use it, so the build failed inside the compiler. The toolchain calls the SDP's GCC drivers directly.
  • Two upstream files used AF_INET and struct linger without including <sys/socket.h>. glibc pulls it in through <netdb.h>; QNX's headers do not. The fix is a two-line patch meant for upstream.
  • isinf() in QNX's <math.h> is a call into libm, not a compiler builtin, so the profile links m.
  • Upstream's z_msgcodec_test asks for random bytes constantly. Unpooled, it ran past the test runner's timeout on the target; pooled, it passes.
  • The test log of that one test is tens of megabytes and the image's /data partition is small, so logs go to RAM and only their tail is kept.

What I learned

  • On QNX, a device read is message passing to a server, so the cost of a call depends on how often you make it, not on how many bytes you ask for. That shaped the random pool.
  • zenoh-pico's out-of-tree platform mechanism makes a port possible without forking. A port can then be reviewed as a package plus one small patch.

What's next

  • Send the <sys/socket.h> patch upstream, and offer the profile as a built-in qnx platform.
  • Run on aarch64: QEMU virt and Raspberry Pi 4 and 5.
  • A QNX example that publishes resource manager or sensor data to a Zenoh network.

Built With

  • c
  • c++
  • cmake
  • io-sock
  • ninja
  • qemu
  • qnx
  • qnx-sdp-8.0
  • zenoh
  • zenoh-pico
  • zenohd
Share this project:

Updates

Submission history