Inspiration
Developers keep opening the same issue on open-source projects: "Does it build on QNX?" cpptrace #235 ("Are we gonna support qnx?"), paho.mqtt.c #1558 ("Makefile for QNX 8.0"), spdlog #2162. The answer is usually "not yet", because every port is hand-made by someone who already knows how QNX differs from Linux. QNX SDP 8.0 is now free for non-commercial use, so the missing piece is not access. It is the porting knowledge.
What it does
Run one command (or the GitHub Action) on a repository. No human is in the loop until the final patch review.
portwright takes an unmodified upstream checkout and:
- cross-builds it with QNX SDP 8.0,
- reads every compiler and linker error and matches it to a documented Linux-to-QNX difference (each rule links to the QNX documentation),
- applies the rule's minimal,
__QNX__-guarded fix and rebuilds, repeating until the build is clean, - when no rule matches, asks any OpenAI-compatible model for a fix, and keeps it only if the next QNX build has fewer errors (accepted fixes become new, unverified rules),
- boots QNX 8.0 in QEMU and runs the library's own test suite there,
- writes a reviewable patch, an HTML port record (error, cause, fix, test), and an upstream pull request draft.
Results
All numbers are the ported libraries' own test results on QNX 8.0 (x86_64, QEMU). They describe our ports, not QNX itself.
Ten libraries, zero human edits, all ten build for QNX 8.0. Three pass all of their own tests on QNX, six pass most, one was not tested.
| Library | How portwright got it building | Own tests on QNX 8.0 |
|---|---|---|
| cpptrace | 5 documented rules + /proc run-time scans, 3 builds | 155 / 155 pass |
| zlib-ng | builds unmodified | 2 / 2 pass |
| Mbed TLS | rule: link libsocket | selftest: all pass |
| yaml-cpp | builds unmodified | 1007 / 1008 pass |
| fmt | rule: link libregex | 567 / 569 pass |
| spdlog | 3 existing rules, no new ones | 216 / 216 pass one by one; a combined run crashes |
| libzmq | model fallback only (rules switched off) | 106 pass, 9 skip, 3 fail |
| libuv | model fallback added -lm |
434 / 472 pass |
| cJSON | builds unmodified | 18 / 20 test programs pass |
| Eclipse Paho MQTT C | rule: <net/netbyte.h> for htobe32 |
builds; tests need an MQTT broker |
Two rules (libregex, net/netbyte.h) were written after the first attempt failed, checked against the SDP files, and the library was re-run from an unmodified checkout. Every failure is listed in docs/RESULTS10.md.
Upstream contributions (hand-minimized from portwright's output, reviewed before sending):
- cpptrace: https://github.com/jeremy-rifkin/cpptrace/pull/340 (closes #235; 7 files, +71/-2; 160/160 tests on QNX 8.0)
- libzmq: https://github.com/zeromq/libzmq/pull/4956 (CMake fix for QNX 8.0, 7 lines)
- spdlog: not sent. Its maintainer declined QNX support in #3568, and we respect that; the patch is kept in our repository instead.
How we built it
pip install+portwright-port <name> <git-url> <ref>: one command from upstream URL to patch and HTML port record (error, cause, fix, test).portwright-action: a GitHub Action that adds a QNX 8.0 build check to any CMake repository and uploads the port record. It runs on a self-hosted runner with the SDP installed (the SDP stays under your own license);scripts/action-local.shruns the same step anywhere, e.g. on Eclipse Paho MQTT C (logs/action-local-paho).- QNX SDP 8.0 on a GitHub Codespace (Linux x86_64), QNX 8.0 x86_64 image built with mkqnximage and run in QEMU without KVM.
- Python engine: build-system detection, diagnostic parser, YAML rule base (22 rules; 14 checked against the target or the SDP files), patcher with per-rule recipes, QEMU runner that serves test binaries over HTTP into the guest.
- Model fallback through any OpenAI-compatible endpoint; we used free tiers (Gemini 3.6 Flash, gpt-oss-120b on Groq).
Challenges
- QNX differences that only show at run time: no
/proc/self/exe(QNX has/proc/self/exefile), no/proc/self/maps(QNX has/proc/self/pmapas CSV with 1/2/4 protection bits). We verified both on the target before writing the rules. - Strict
-std=c++11builds hide POSIX declarations on QNX unless_QNX_SOURCEis set, and configure checks must see the same define, orstrlcpyis detected as missing and redefined. - Keeping upstream patches small enough for maintainers: the cpptrace PR went from 14 files in our first hand port to 7 files.
Accomplishments
- Ten popular libraries build for QNX 8.0 with zero human edits; each was checked with its own tests on QNX 8.0 where the tests can run.
- Two upstream pull requests opened against active projects.
- A codelab that a new user ran end to end in about 18 minutes on a fresh Codespace.
What we learned
Most porting failures fall into a small set of documented differences. Encoding them as rules with a build-improvement gate made the model fallback safe to use.
What's next
- More rules from more libraries, with each rule verified on the target before it is marked verified.
- aarch64 targets.
Evidence of QNX use (where to look)
toolchains/qnx-x86_64.cmake,toolchains/qnx-aarch64le.cmake: CMake toolchains for QNX SDP 8.0 (qcc/q++).rules/qnx80.yaml: 22 documented Linux-to-QNX differences (e.g./proc/self/exefile,/proc/self/pmap,libsocket,libregex,<net/netbyte.h>), each with a QNX documentation link; 14 checked on the QNX 8.0 target or against SDP files.scripts/make-vm.sh,scripts/qemu-run.py: build a QNX 8.0 x86_64 image withmkqnximageand run test binaries inside it.logs/auto-*/: build logs, patches and the QEMU test output for every library in the table;docs/reports/*.htmlrenders each one.logs/upstream-check/: QNX 8.0 build and QEMU test results of the two upstream pull request branches.
Links
- Code: https://github.com/Dream-no24/portwright
- Codelab (port a library to QNX 8.0 in a free Codespace, about 20 minutes): https://github.com/Dream-no24/portwright/blob/main/docs/CODELAB.md
- Results table with every failure: https://github.com/Dream-no24/portwright/blob/main/docs/RESULTS10.md
- Upstream: https://github.com/jeremy-rifkin/cpptrace/pull/340 , https://github.com/zeromq/libzmq/pull/4956