Thread overview
Must I compile on the target architecture?
Dec 25, 2015
Jakob Jenkov
Dec 25, 2015
Lucien
Dec 25, 2015
Adam D. Ruppe
Dec 26, 2015
Jakob Jenkov
Dec 26, 2015
Orfeo
Dec 28, 2015
Joakim
Dec 29, 2015
FrankLike
December 25, 2015
Hi, just a quick question:

If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for that machine? What is the standard process for cross platform compilation?
December 25, 2015
On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote:
> Hi, just a quick question:
>
> If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for that machine? What is the standard process for cross platform compilation?

You're right.

Simply copy your files to the target and compile.
December 25, 2015
On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote:
> If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for that machine? What is the standard process for cross platform compilation?

For building Windows apps on Linux, I just run the Windows version of dmd on wine, right from the linux box.

For Linux programs built on Windows... you'll prolly just want to copy it to a linux box.
December 26, 2015
> For Linux programs built on Windows... you'll prolly just want to copy it to a linux box.

Thanks, both of you.

I guess the easiest would be to compile it on a virtual machine with the OS I want to build for. I mean, I could run a Linux VM on my Windows box and compile my code there. Or the other way around.
December 26, 2015
On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote:
> Hi, just a quick question:
>
> If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for that machine? What is the standard process for cross platform compilation?

See also [Should I compile D program on Linux for windows?](http://stackoverflow.com/questions/13501595/should-i-compile-d-program-on-linux-for-windows/13502264#13502264)
December 28, 2015
On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote:
> Hi, just a quick question:
>
> If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for that machine? What is the standard process for cross platform compilation?

I'll also note that ldc supports cross-compilation out of the box.  The only issue is that you'll need a linker to link the resulting objects, but you can usually install one in Cygwin.  I believe gdc also supports some cross-compilation, though I've not tried it.  Dmd isn't a cross-compiler, though it is capable of being turned into one: nobody has put in the remaining work yet.
December 29, 2015
On Friday, 25 December 2015 at 12:43:05 UTC, Jakob Jenkov wrote:
> Hi, just a quick question:
>
> If I write a program in D and I use Windows for development but want it to run on Linux, do I have to copy the source code to the target Linux machine and compile it there, to make an executable for that machine? What is the standard process for cross platform compilation?

GDC is best for cross platform compilation,download it from gdcproject.org.