Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to cross-compile D source code for MIPS?

Is it possible to cross-compile D source code for MIPS?

For example, I want to compile a D "Hello, world." program that will run on TI AR7-based devices, which have MIPS32 processor and typically run Linux 2.4.17 kernel with MontaVista patches and uClibc (using the MIPS I generic target; ELF 32-bit LSB executable, MIPS, MIPS-I version 1 SYSV).

http://en.wikipedia.org/wiki/TI-AR7

like image 563
XP1 Avatar asked Jun 04 '11 20:06

XP1


People also ask

Why is cross compiling so hard?

"building a cross-compiler is significantly harder than building a compiler that targets the platform it runs on." The problem exists due to the way libraries are built and accessed. In the normal situation all the libraries are located in a specific spot, and are used by all apps on that system.

What is cross compiled code?

Cross-compilation is the act of compiling code for one computer system (often known as the target) on a different system, called the host. It's a very useful technique, for instance when the target system is too small to host the compiler and all relevant files.


1 Answers

The reference compiler, DMD, does not generate MIPS code, so you'll have to use GDC and LDC2, which support generating code for whatever architectures their backends support (GCC and LLVM, respectively).

However, it's not a simple as generating the code. To get all of D's features workable, you'll need to port druntime and phobos to MIPS, as druntime is quite architecture specific. Without that, you'll be stuck without a GC, and all the features that entails.

So it is possible, but how possible definitely depends on how dedicated you are.

like image 116
Bernard Avatar answered Sep 20 '22 18:09

Bernard