I am trying to cross compile some Nim code in Linux / x64 in order to make it work in a Rpi 1 B. I managed to compile it, but the binary is not working: Illegal instruction (core dumped).
The command line I am using is:
nim c --cpu:arm --os:linux --cc:clang --os:linux --clang.exe="zigcc" --clang.linkerexe="zigcc" --passC:"-target arm-linux-musleabi -mtune=arm1176jzf_s" --passL:"-target arm-linux-musleabi" alarma.nim
Do you think I am using the right flags (on the zig side)? Or maybe I am hit by some of these issues?
Just to rule it out, try passing -fno-sanitize=undefined via --passC. It’s possible you’re hitting undefined behavior caught by the undefined behavior sanitizer that’s enabled by default.