I recently dusted off an older chromebook to have a smaller portable typewriter with me. It’s a Samsung Chromebook 2 (XE303C12) with has a ARMv7 Cortex-A15 architecture, which arch linux describes as arm7l and I only read as “arm7”.
Aside from handling emails, I also want to work on side-projects a little. For this, I need (well… want) to use crystal. Writing is easy as vim has been compiled to almost everything. Compiling is harder, as crystal requires crystal to compile.
I heard about cross-compilation, but have no experience in it. The most understandable approach right now would be iterative upgrading from the early crystal versions (ruby works). Both solutions leave me rahter… unsatisfied.
Would it be possible to support arm7 officially and build that centrally? Or am I missing something here?
I’ve cross compiled to ARMv7 successfully, it should work. Although, I think the bigger issue you might face is just that’s 32bit instead of 64bit, and I don’t think Crystal supports 32bit as much anymore.
Ah, I see. That’s actually a very helpful answer. So, I missed the limited 32bit-support
Maybe I will just retire the Chromebook as the battery is also not the best anymore. At least for crystal-programming, it seems not suitable. To my own surprise, while I want to keep electronic waste to a minimum, I choose crystal instead of the hardware in this case.
That’s not to say it won’t work, just that you’re on your own a bit, as it falls outside common use cases. If you want to try it out and see how it goes, I’d say go for it .
I agree on utilizing older devices when they still work ok, but at some point the hardware architecture is really the limitation, not so much of the lifespan.
Hmm. So I took a look a the current assortment of chromebook or small laptop, saw an overwhelming and wide arrangement and did the only logical thing. I went to Cross-compilation, looked up my target-triplet and did the first step of cross-compilation. I was hoping that I could get a compiler for the target, but arm7l-unknown-linux-gnueabihf seems harder to find. Or I am clueless again. Since I set up syncthing earlier, the transfer-part seems easier that anticipated. Tonight, I might compile me some crystal (or fail at doing so). And yes, I leave this here in this much detail to help DenverCoder09 in the future.
Current steps were:
llvm-config --host-target on the chromebook
git checkout of crystal-lang/crystal and build-depencies installed
make crystal release=1 interpreter=1 target=arm7l-unknown-linux-gnueabihf
The flag interpreter=1 did not work for me. I will not debug this now. Without it, it produces the .build/crystal.o cleanly.
On the one hand, this is sad, because I wanted the REPL. On the other hand, this gives me something I can try to compile. Since that was my goal, I’ll take the win. Most packaged binaries also come without the interpreter, so I might as well grow up and compile my code.
Not having the interpreter is secondary, but it’s good to know that this is known.
As for the actual compilation: my first try failed. I am a little occupied with work at the moment, so it will take a while for the next try, including more detailed error-messages and a little research.
For now just know: I survived the first attempt and will try again.
For now, I will abandon this project. My goal was to have a little program that helps me focus. On a full-powered machine with modern architecture, window-managers and everything, that is helpful. On a small chromebook, whose only approximation of a GUI is fbterm and tmux, the distractions are rather minimal.
Therefore, I will not try again to cross-compile crystal for the outdated architecture. Also, after reading the docs for cross-compilation again today, I find it complete and helpful enough. Thanks for your help regarding this.