I’m trying to cross-compile an application to ARMv6 (original raspberry pi). If I run the command output by crystal build on the Pi, I get the following error:
cc: error: /usr/share/crystal/src/ext/libcrystal.a: No such file or directory
How do I get a libcrystal.a for a target platform which doesn’t have a compiled Crystal?
I think cross compiling is currently broken because of that libcrystal.a. That library currently results from compiling this file. Ideally we could write that file in Crystal and there wouldn’t be a need for a libcrystal.a.
Well, I definitely don’t think the Pi itself would be able to compile crystal, but I don’t see any reason cross-compiled binaries wouldn’t work. Thanks for the helpful links, I’ll look into it some more in a bit.
Well… I got all the linked binaries installed, compiled sigfault.c as libcrystal.a, and ran the command…which gave me this error:
flix.arm.o: In function `__crystal_main':
/usr/share/crystal/src/kernel.cr:543: undefined reference to `setup_sigfault_handler'
flix.arm.o: In function `crypto_scrypt':
/home/scott/Documents/code/flix/lib/scrypt/src/engine.cr:38: undefined reference to `crypto_scrypt'
collect2: error: ld returned 1 exit status
For completeness, on the cross-compiling target platform, you need to check out the Crystal repo and run make libcrystal in order to build libcrystal.a.
(Actually, you don’t need the entire repo, Makefile and src/ext folder should be enough).