I end up with the following line in order to crosscompile from Linux in x64 with the target RPi1:
nim c --cpu:arm --os:linux --cc:clang --os:linux --clang.exe="zigcc" --clang.linkerexe="zigcc" --passC:"-target arm-linux-musleabi -mcpu=arm1176jzf_s -fno-sanitize=undefined" --passL:"-target arm-linux-musleabi -mcpu=arm1176jzf_s" alarma.nim
Now I want to compile with SSL support. I tried: -d:ssl but that is not working. I have openssl-1.1.1 in the RPi.
Any idea about what can I do to crosscompile with SSL support?
Using -d:nimDebugDlOpen gives the following when run:
Dynamic loading not supported
could not load: libcrypto.so.1.1
Thank you both.
The puppy solution is not working either because it aims to load dinamically libcurl:
could not load: libcurl.so(|.4)
As Yardinico mentioned, the issue was about mixing static and dynamic.
For the record, fixed by compiling with:
nim c -d:ssl -d:sslVersion=1.1 --cpu:arm --os:linux --cc:clang --os:linux --clang.exe="zigcc" --clang.linkerexe="zigcc" --passC:"-target arm-linux-gnueabihf -mcpu=arm1176jzf_s -fno-sanitize=undefined" --passL:"-target arm-linux-gnueabihf -mcpu=arm1176jzf_s" alarma
using arm-linux-gnueabihf as target.
IIRC, OpenSSL, at least v3, gets dlopen()'d no matter what you do, which will then attempt to dynamically load things that are already statically linked. We played some low-level games to redirect the loader ourselves.
The tech world uses static binaries heavily. It shouldn't so hard to get one in Nim (even when it's supported, it's often not easy).