Undecypherable Error on Aarch64 Platform

I have an OrangePi 4 LTS with Armbian installed. On my Desktop PC zig build works, compiles, runs. But on the Aarch64 (4 x Cortex-A53 2 x Cortex-A72) system. I get the following and I can’t find an answer. Perhaps my wrappers around rtaudio, rtmidi and sndfile don’t compile the same on this platform? but I don’t know where since there is no clue.

$ zig build
install
└─ install audio
   └─ compile exe audio Debug native failure
error: error: Invalid record (Producer: 'zig 0.16.0' Reader: 'LLVM 21.1.0')
       
error: process exited with error code 1
failed command: /opt/zig/zig build-exe /usr/lib/aarch64-linux-gnu/librtmidi.a -ODebug --dep audio --dep noise --dep tui -Mroot=/home/orangeserver/zig/audio/src/main.zig --dep rtmidi --dep rtaudio --dep printmidi --dep reverb --dep reverb2 --dep signals --dep filter --dep poly --dep parse -Maudio=/home/orangeserver/zig/audio/src/root.zig -ODebug --dep printmidi --dep filter --dep poly --dep parse --dep signals -Mnoise=/home/orangeserver/zig/audio/src/signals/noise.zig -ODebug -Mtui=/home/orangeserver/zig/audio/src/tui.zig -I/usr/include/rtmidi -D__UNIX_JACK__ -D__LINUX_ALSA__ -lrtmidi -ODebug -L /usr/lib/aarch64-linux-gnu --dep printmidi --dep cmidi --dep cmidi-data --dep signals -Mrtmidi=/home/orangeserver/zig/audio/src/rtmidi.zig /usr/lib/aarch64-linux-gnu/librtmidi.a -I/usr/include/rtaudio -D__LINUX_ALSA__ -D__LINUX_PULSE__ -D__UNIX_JACK__ -D_REENTRANT -lrtaudio -ODebug -L /usr/lib/aarch64-linux-gnu -Mrtaudio=/home/orangeserver/zig/audio/src/rtaudio.zig -ODebug -Mprintmidi=/home/orangeserver/zig/audio/src/printmidi.zig -ODebug -Mreverb=/home/orangeserver/zig/audio/src/freeverb.zig -ODebug -Mreverb2=/home/orangeserver/zig/audio/src/freeverb2.zig -ODebug --dep printmidi --dep filter --dep env --dep gen --dep poly --dep noise --dep sampler --dep wavguide -Msignals=/home/orangeserver/zig/audio/src/signals.zig -ODebug --dep printmidi --dep poly --dep parse --dep signals -Mfilter=/home/orangeserver/zig/audio/src/signals/filter.zig -ODebug --dep printmidi --dep rtmidi --dep rtaudio --dep signals -Mpoly=/home/orangeserver/zig/audio/src/polyman.zig -ODebug --dep poly --dep signals -Mparse=/home/orangeserver/zig/audio/src/parse.zig -ODebug --dep cmidi-data -Mcmidi=/home/orangeserver/zig/audio/src/cmidi.zig -ODebug -Mcmidi-data=/home/orangeserver/zig/audio/src/cmidi_data.zig -ODebug --dep printmidi --dep poly --dep parse --dep signals -Menv=/home/orangeserver/zig/audio/src/signals/envelope.zig -ODebug --dep printmidi --dep filter --dep poly --dep parse --dep signals -Mgen=/home/orangeserver/zig/audio/src/signals/generator.zig -ODebug --dep printmidi --dep filter --dep poly --dep parse --dep sndfile --dep signals -Msampler=/home/orangeserver/zig/audio/src/signals/sampler.zig -ODebug --dep printmidi --dep filter --dep poly --dep parse --dep signals -Mwavguide=/home/orangeserver/zig/audio/src/signals/waveguide.zig -I/usr/include/opus -I/usr/include/aarch64-linux-gnu -lsndfile -ODebug -L /usr/lib/aarch64-linux-gnu -Msndfile=/home/orangeserver/zig/audio/src/sndfile.zig -lc --cache-dir .zig-cache --global-cache-dir /home/orangeserver/.cache/zig --name audio --zig-lib-dir /opt/zig/lib/ --listen=-

Build Summary: 0/3 steps succeeded (1 failed)
install transitive failure
└─ install audio transitive failure
   └─ compile exe audio Debug native failure

error: the following build command failed with exit code 1:
.zig-cache/o/7888331c5ea8cba827cfc99548e35051/build /opt/zig/zig /opt/zig/lib /home/orangeserver/zig/audio .zig-cache /home/orangeserver/.cache/zig --seed 0xa90c3d9f -Zd11354c6b5d88ac7

I’m not sure but I’ve experienced this issue one, and I think it’s because of the LLVM bitcode, there must be a mismatch I think, but I’m not sure

Yes but there is no other LLVM or components installed, Zig is definitely using its own installed runtime. The dynamically linked C libraries are not LLVM. Is LLVM version 21.1.0 the correct version?

yeah there might be a mismatch, also if one of your deps is C++ you are better off linking it statically, because there can be issues with symbol resolutions and stuff like that.

You might need to build a debug build of the compiler and run it with debug logging enabled to get more detailed information about what is going wrong and where. But since you said it works on your desktop PC (you didn’t specify the arch, but I assume it’s x86-64) but not on AArch64, here are two ideas:

Does that include function pointers? i.e *const fn ...

// Samplers can point to the same samples but not WaveGuides.
                switch (p.signal.proc) { // proc is a *const fn()
                    sg.wg.waveguide => {
                        const size = p.signal.buffer.e - p.signal.buffer.s;
                        p.signal.buffer = self.alloc_buffer(size);
                    },
                    else => {},
                }
. . .

Udpate: Yes, it does. Creating an enum to switch instead, solved it. I wonder if an if statement would have the same error?

Plain ifs with regular == comparisons will probably work, it’s specifically switching on pointers that is broken and on the way of being removed from the language.