Closed artem-a closed 2 years ago
MIPS is not supported yet (take a look at https://github.com/crystal-lang/crystal/blob/master/src/compiler/crystal/codegen/target_machine.cr#L22).
We need to add MIPS ABI class to get it compiled.
Crystal ABIs built using https://github.com/rust-lang/rust/tree/master/src/librustc_trans as source of implementation, but I have no any MIPS to test :)
https://github.com/crystal-lang/crystal/blob/master/src/llvm/abi/arm.cr
You can test new architectures without hardware using QEMU. Obviously they should be validated on real hardware by the community at least once before merging.
@akzhan Do you plan to add MIPS architecture in future?
Have not seen it https://github.com/crystal-lang/crystal/wiki/Roadmap
But it should be easy to add.
Porting Crystal is a multi stage process. It's rarely easy, and sometimes very hard, especially when introducing a new architecture (e.g. the ARM EABI port was hard).
mips-linux-gnu
);Supporting MIPS wasn't on my personnal radar for different reasons, the most important being that MIPS seems mostly used in embedded systems with (very) limited memory, which Crystal ain't really aiming at —the language could, but the core/stdlib won't.
But maybe my assumption is wrong?
@ysbaddaden
Thank you! Got your point, though the crystal language provides the following very suitable for the MIPS architecture:
And this makes crystal a very good match for embedded systems.
@artem-a when you say "embedded" what kind of ram/os do you mean? I suspect @ysbaddaden is thinking of microcontrollers with RAM measured in the single megabytes or kilobytes which are incapable of running linux. Obviously that's not true for all embedded systems.
@RX14 OS OpenWRT, RAM 32/64/128 Mb mostly routers.
I would imagine that Crystal on OpenWRT would be a nice [and faster but probably not smaller] alternative to using mruby.
With careful memory usage, it sounds possible to run a crystal app on MIPS, as long as GC can run.
I don't think I'll work on this anytime soon. If someone is motivated enough, steps are above :)
I have a MIPS system with 200MB, would be great to run crystal on it since at 200mbs ram (and then the OS and other programs leave little remaining) running Ruby isn't really an option
Alright @ysbaddaden my question is that does it need to be for every single MIPS architecture? I.E., if I wish to port one of them, do I need to write an ABI for all of them, even if my specific use case is one MIPS architecture? Currently I'm looking at mipsel-unknown-none as my target on MIPS2.
Never mind my previous post, I've figured it out for myself. Thank you, and sorry for bothering.
Closing. There is nothing actionable here.
This is not discounting MIPS support - we would like to get that eventually. But it makes no sense to keep issues open for every unsupported target.
If you're interested in working on support for a new target, please start with an informal discussion at https://forum.crystal-lang.org/
Hi all!
I'm trying to compile a simple web application like "hello, world!" for MIPS architecture
app.cr
I use the command
crystal build app.cr --cross-compile --target "mips-linux-gnu"
also tried the commandcrystal build app.cr --cross-compile --target "mips-unknown-linux-gnu"
but I get an error
Unsupported arch for target triple: mips-linux-gnu
orUnsupported arch for target triple: mips-unknown-linux-gnu
Crystal compiler version
Crystal 0.22.0 [3c71228] (2017-04-20) LLVM 3.5.0
OS version
Linux xbnt-vm 4.8.0-36-generic #36~16.04.1-Ubuntu SMP Sun Feb 5 09:39:57 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Thanks.