www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Cross Compiling With LDC Under Single OS

reply Elina =?UTF-8?B?S8O8w6fDvGtheQ==?= <elinakucukay gmail.com> writes:
Hi, I'm new started the Dlang. I want to cross compile with LDC 
on a single operating system but when I follow the steps in the 
link below, I get a problem:

https://wiki.dlang.org/Cross-compiling_with_LDC

Under Linux;

ldc -mtriple = x86_64-windows-msvc -c foo.d -of = foo.exe

The exe file I created with the command, doesn't work in Windows 
10. Likewise, my Linux code that I compiled under Windows doesn't 
work on Linux.

Can you help me?
Dec 16 2020
parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
On 12/16/20 8:30 AM, Elina K=C3=BC=C3=A7=C3=BCkay wrote:

 https://wiki.dlang.org/Cross-compiling_with_LDC
Could someone please review whether the instructions on that page are=20 up-to-date. Thank you. Should Elina try gdc instead? Do others have experience in=20 cross-compiling with gdc? Ali
Dec 16 2020
parent reply kinke <noone nowhere.com> writes:
On Wednesday, 16 December 2020 at 21:28:19 UTC, Ali Çehreli wrote:
 On 12/16/20 8:30 AM, Elina Küçükay wrote:

 https://wiki.dlang.org/Cross-compiling_with_LDC
Could someone please review whether the instructions on that page are up-to-date. Thank you.
They are up-to-date.
 Should Elina try gdc instead? Do others have experience in 
 cross-compiling with gdc?
GDC doesn't support Windows. On Wednesday, 16 December 2020 at 16:30:07 UTC, Elina Küçükay wrote:
 The exe file I created with the command, doesn't work in 
 Windows 10. Likewise, my Linux code that I compiled under 
 Windows doesn't work on Linux.
Please be more specific, I can't provide any remote help based on 'it doesn't work'.
Dec 16 2020
parent reply Elina =?UTF-8?B?S8O8w6fDvGtheQ==?= <elinakucukay gmail.com> writes:
On Wednesday, 16 December 2020 at 22:32:02 UTC, kinke wrote:
 Please be more specific, I can't provide any remote help based 
 on 'it doesn't work'.
Thank you for all response. Dear kinke, my goal is to create an executable file on the Linux operating system that can run on Windows. In the first transmission, I reviewed the document written for LLVM, but wasn't successful. The command below creates the exe file for me but this exe file doesn't work in Windows. ldc -mtriple = x86_64-windows-msvc -c foo.d -of = foo.exe GDC does not support Windows, so I am trying to compile with LLVM. Does LDC support platform independent compilation for D language? I apologize for answering late, I did not have the opportunity to write an answer due to my exams.
Dec 18 2020
parent reply kinke <noone nowhere.com> writes:
On Friday, 18 December 2020 at 11:00:01 UTC, Elina Küçükay wrote:
 but this exe file doesn't work in Windows
I meant more specifics wrt. this - what's the error? Not a PE executable? Some missing DLL because a Visual C++ runtime 2015+ isn't installed?
 ldc -mtriple = x86_64-windows-msvc -c foo.d -of = foo.exe
The Wiki uses `ldc2 -mtriple=x86_64-windows-msvc foo.d`. `-c` means 'compile only', so you're effectively compiling a COFF object file and naming it `foo.exe`, so no, that won't work.
 Does LDC support platform independent compilation for D 
 language?
Yes, the Wiki page isn't made up. ;)
Dec 18 2020
parent reply Elina =?UTF-8?B?S8O8w6fDvGtheQ==?= <elinakucukay gmail.com> writes:
On Friday, 18 December 2020 at 13:40:09 UTC, kinke wrote:
 I meant more specifics wrt. this - what's the error? Not a PE 
 executable? Some missing DLL because a Visual C++ runtime 2015+ 
 isn't installed?
I'm compiling under in Linux. When I remove -c parameter, I will get this error: https://paste.ubuntu.com/p/7dw9CxG4BJ/ ldc -mtriple=x86_64-windows-msvc foo.d ----- I'm downloading LDC for Windows release for usage missing libraries under Linux. When I include missing library with -L-L= parameter, get an error again. ldc -mtriple=x86_64-windows-msvc -L-L=lib/mingw foo.d -of=foo.exe I may not have written clearly, I don't have very good English. As I mentioned, I just started the D language and my goal is to make a very simple D console program workable for Windows.
Dec 18 2020
parent reply Jacob Carlborg <doob me.com> writes:
On 2020-12-18 18:00, Elina Küçükay wrote:

 I'm compiling under in Linux. When I remove -c parameter, I will get 
 this error: https://paste.ubuntu.com/p/7dw9CxG4BJ/
 
 ldc -mtriple=x86_64-windows-msvc foo.d
 
 -----
 I'm downloading LDC for Windows release for usage missing libraries 
 under Linux. When I include missing library with -L-L= parameter, get an 
 error again.
 
 ldc -mtriple=x86_64-windows-msvc -L-L=lib/mingw foo.d -of=foo.exe
The first error that you linked to indicate that you're missing the standard library and runtime library compiled for Windows. You can get those by downloading the Windows version of LDC, unpack it and place the files in the lib32/lib64 directory in the lib32/lib64 directory of your Linux LDC version. This is available here in the documentation [1]. The second error, is that the same error or a new error? You need to include the error in your message so we can see it to be able to help you. [1] https://wiki.dlang.org/Cross-compiling_with_LDC#Default_libraries -- /Jacob Carlborg
Dec 18 2020
parent Elina =?UTF-8?B?S8O8w6fDvGtheQ==?= <elinakucukay gmail.com> writes:
On Friday, 18 December 2020 at 19:07:48 UTC, Jacob Carlborg wrote:
 The first error that you linked to indicate that you're missing 
 the standard library and runtime library compiled for Windows. 
 You can get those by downloading the Windows version of LDC, 
 unpack it and place the files in the lib32/lib64 directory in 
 the lib32/lib64 directory of your Linux LDC version. This is 
 available here in the documentation [1].

 The second error, is that the same error or a new error? You 
 need to include the error in your message so we can see it to 
 be able to help you.

 [1] 
 https://wiki.dlang.org/Cross-compiling_with_LDC#Default_libraries
Thank you for your response. I solved it.
Dec 19 2020