www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Must I compile on the target architecture?

reply Jakob Jenkov <jakob jenkov.com> writes:
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?
Dec 25 2015
next sibling parent Lucien <lucien.perregaux gmail.com> writes:
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.
Dec 25 2015
prev sibling next sibling parent reply Adam D. Ruppe <destructionator gmail.com> writes:
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.
Dec 25 2015
parent Jakob Jenkov <jakob jenkov.com> writes:
 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.
Dec 26 2015
prev sibling next sibling parent Orfeo <orfeo.davia gmail.com> writes:
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
Dec 26 2015
prev sibling next sibling parent Joakim <dlang joakim.fea.st> writes:
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.
Dec 28 2015
prev sibling parent FrankLike <1150015857 qq.com> writes:
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.
Dec 28 2015