Inspiration
Erlang was originally built for telecom switches that could not go down, and QNX runs things such as cars, medical devices, and automated lines that cannot go down. They solve neighboring problems, yet you could not run one on the other. In 2025 Jonatan Männchen showed that Erlang/OTP 28 could boot on QNX 8.0 (x86_64, Erlang shell). I wanted to finish the job: the full Elixir and Phoenix stack, on the ARM hardware QNX actually ships on, with the build fix sent upstream so the next person doesn't have to start from a patch.
I also wanted to avoid the overuse of either technology. The BEAM is soft real-time, so I didn't build something where Elixir ran the hard real-time loop, that is always a job for QNX itself. Instead, I designed it to let each system do what it is already good at.
What it does
elixir-qnx runs Erlang/OTP 28, Elixir 1.20 and a Phoenix LiveView app on QNX 8.0, on both x86_64 and aarch64, in QEMU.
The demo is an operations console for a simulated lab analyzer:
- QNX runs the real-time work. The analyzer's sampling loop is a native C process that the microkernel schedules at real-time priority 20 (round-robin), launched with
on -p. - OTP keeps it alive. An Elixir supervisor owns the process through a port. If you crash it, QNX reports the SIGABRT, OTP restarts it, and telemetry resumes with no operator action.
- Phoenix operates it. A LiveView console streams live readings, injects faults (overheat, stuck sensor, crash) and pushes calibration changes without a restart. It reads the analyzer's real pid and priority back from QNX's
pidin, so the console shows what the kernel reports rather than what the app assumes.
The project also contributes upstream: erlang/otp#12150 makes OTP's QNX cross-compilation multi-arch and adds an aarch64 configuration.
How it was built
- Toolchain in Docker. The QNX SDP host tools only run on x86_64 Linux, so everything lives in a
linux/amd64container (Rosetta on Apple Silicon). QNX Software Center installs SDP 8.0 headless, with credentials passed as BuildKit secrets so they never land in an image layer. - Cross-compiling OTP. I started from Jonatan's QNX compatibility patch and added my own: an aarch64 xcomp config, plus a Makefile fix that derives the compiler (
ntox86_64-gccorntoaarch64-gcc) from the target triple instead of hardcoding x86. - Elixir. Elixir compiles to portable BEAM bytecode, so the precompiled release runs unchanged on the cross-compiled runtime. The Phoenix app is compiled on the host and shipped as beams.
- Images.
mkqnximagewith custom snippets bakes OTP, Elixir, the app and theqcc-built analyzer into a bootable image. On first boot they are unpacked and installed, and proof lines are printed to the console. - One switch for architecture.
ARCH=aarch64leruns the same build, image and boot scripts for ARM.
Challenges
- aarch64 wouldn't boot. The SDP baseline install omits two packages a QEMU ARM image needs: the board startup (
startup-qemu-virt) and the virtio disk driver (devb-virtio). Each one failed with a different error, and I had to find their package names in Software Center's catalogue. - No hardware acceleration on ARM. Apple's Hypervisor.framework only exposes a GICv3 interrupt controller, and QNX's
startup-qemu-virttakes a GICv2 path in this configuration and asserts. I fell back to TCG emulation, which is slower but does the job I needed it to. - The hardcoded x86 compiler. OTP's emulator Makefile used
ntox86_64-gccfor dependency generation, so ARM builds silently used the wrong compiler. This is the core of the upstream PR. - Small QNX-isms. The stock image omits
sshd-auth, which breaks sshd until it is added to the image. Mix's symlinkedprivdirectories dangle on the guest, which 404'd the Phoenix JavaScript. And on QNX 8 a non-root user can't see other users' processes inpidin, which is why the console queries priority itself.
Accomplishments
- A real Phoenix LiveView app on QNX, on ARM.
- A real-time architecture: the kernel schedules the critical loop, and the demo proves it with QNX's own
pidinoutput instead of a label. - Crash recovery across the native/BEAM boundary: a native process dies and comes back at the same real-time priority without a person touching it.
- An upstream PR to Erlang/OTP that credits and builds on prior community work, with that author's permission.
- A fully reproducible build: anyone with a free QNX Everywhere license can rebuild the whole thing from the README.
What was learned
- Where the line between hard and soft real-time sits in practice, and that the best design is often for each system to supervise rather than to imitate.
- How QNX images are put together: IFS versus data partitions, board startups, how drivers are packaged, and
mkqnximagecustomization. - That OTP's cross-compile system is well designed, and the port needed only a few targeted changes rather than a rewrite.
- How open source contribution works: building on someone else's unmerged work, asking permission, signing the CLA, and keeping the PR small enough to review. I'm still new to open source work, especially as it pertains to contributing to other people's work.
What's next for elixir-qnx
- Getting PR #12150 reviewed and merged, so QNX is a supported OTP cross target.
mix releasesupport that bundles the QNX runtime, so apps ship as a single artifact.- Talking to QNX natively from Elixir, for example a NIF or port driver for Neutrino message passing, so the BEAM can be a first-class client of QNX resource managers.
- Hardware acceleration on Apple Silicon, if QNX's virt startup gains a GICv3 path. It is also possible I just completely butchered my implementation, so worth a second go-around when time permits.
Built With
- elixir
- otp
- phoenix
- qnx