digitalmars.D.ldc - cross compiling linux -> windows
- Oleg B (10/10) Mar 22 2017 Hello. I'm try to cross build example program and get some error.
- kinke (3/5) Mar 22 2017 Hi Oleg, MinGW isn't supported anymore, see release notes. Using
- Oleg B (3/8) Mar 22 2017 Thanks, it works and now I get .obj output. ldc not support cross
- kinke (13/23) Mar 22 2017 With LDC 1.3, you'll be able to at least generate static libs for
- David Nadlinger (15/17) Mar 22 2017 Well, in theory LDC doesn't care what linker it uses, so it
- Laeeth Isharc (3/15) Mar 22 2017 fwiw dmd works under wine, last I checked. I have no idea about
- Oleg B (2/4) Mar 23 2017 dmd for win64 use m$ linker
Hello. I'm try to cross build example program and get some error. % ldc2 -mtriple=i686-w32-mingw32.static print_void_array.d /home/obutko/workspace/ldc2-1.2.0-beta1-linux-x86_64/bin/../import/cor /stdc/wchar_.d(80): Error: undefined identifier 'FILE' ... /home/obutko/workspace/ldc2-1.2.0-beta1-linux-x86_64/bin/../import/cor /stdc/stdio.d(830): Error: undefined identifier 'FILE' ... and I don't understand how to fix it. If I add flag `-d-version=CRuntime_Windows` compiler fails with `Error: version identifier 'CRuntime_Microsoft' is reserved and cannot be set` Maybe I have fundamentally wrong logic for doing this?
Mar 22 2017
On Wednesday, 22 March 2017 at 12:35:16 UTC, Oleg B wrote:Hello. I'm try to cross build example program and get some error.Hi Oleg, MinGW isn't supported anymore, see release notes. Using the 32-bit MSVC triple `i686-pc-windows-msvc` should work.
Mar 22 2017
On Wednesday, 22 March 2017 at 13:08:07 UTC, kinke wrote:On Wednesday, 22 March 2017 at 12:35:16 UTC, Oleg B wrote:Thanks, it works and now I get .obj output. ldc not support cross linking and I must use external tools for this?Hello. I'm try to cross build example program and get some error.Hi Oleg, MinGW isn't supported anymore, see release notes. Using the 32-bit MSVC triple `i686-pc-windows-msvc` should work.
Mar 22 2017
On Wednesday, 22 March 2017 at 14:03:01 UTC, Oleg B wrote:On Wednesday, 22 March 2017 at 13:08:07 UTC, kinke wrote:With LDC 1.3, you'll be able to at least generate static libs for any target. Linking executables and shared libraries is a different beast. If you can't/don't want to use the MS linker, you can use LLVM's LLD as cross-linker (works for MSVC targets, but can't emit .pdb debuginfos). You'll still need the MS libs though (Visual C runtime, WinSDK) and will have to play around with command-line options or environment variables to get it to work. If there's more interest wrt. cross-linking to Windows, I can integrate that into LDC 1.3 too, I've already prepared for this but then put it aside as cross-linking to non-Windows via an integrated LLD is non-trivial.On Wednesday, 22 March 2017 at 12:35:16 UTC, Oleg B wrote:Thanks, it works and now I get .obj output. ldc not support cross linking and I must use external tools for this?Hello. I'm try to cross build example program and get some error.Hi Oleg, MinGW isn't supported anymore, see release notes. Using the 32-bit MSVC triple `i686-pc-windows-msvc` should work.
Mar 22 2017
On Wednesday, 22 March 2017 at 14:03:01 UTC, Oleg B wrote:Thanks, it works and now I get .obj output. ldc not support cross linking and I must use external tools for this?Well, in theory LDC doesn't care what linker it uses, so it supports cross-toolchains just fine. No matter how your (cross-)compiler is implemented, to create executables (or shared libraries) for a given target you will need the appropriate C runtime and so on to link against. In our case, this is taken care of by a (g)cc-compatible linker driver resp. link.exe for Windows. LDC doesn't rely on these "external tools" for cross-compilation any more than for creating native executables. Of course, in the case of Linux -> Windows, getting an equivalent link.exe in a Linux environment might be a bit challenging without resorting to tricks like linking in a VM. MinGW-w64 would be much easier to get working in this scenario. - David
Mar 22 2017
On Wednesday, 22 March 2017 at 12:35:16 UTC, Oleg B wrote:Hello. I'm try to cross build example program and get some error. % ldc2 -mtriple=i686-w32-mingw32.static print_void_array.d /home/obutko/workspace/ldc2-1.2.0-beta1-linux-x86_64/bin/../import/cor /stdc/wchar_.d(80): Error: undefined identifier 'FILE' ... /home/obutko/workspace/ldc2-1.2.0-beta1-linux-x86_64/bin/../import/cor /stdc/stdio.d(830): Error: undefined identifier 'FILE' ... and I don't understand how to fix it. If I add flag `-d-version=CRuntime_Windows` compiler fails with `Error: version identifier 'CRuntime_Microsoft' is reserved and cannot be set` Maybe I have fundamentally wrong logic for doing this?fwiw dmd works under wine, last I checked. I have no idea about ldc.
Mar 22 2017
On Thursday, 23 March 2017 at 00:18:14 UTC, Laeeth Isharc wrote:fwiw dmd works under wine, last I checked. I have no idea about ldc.dmd for win64 use m$ linker
Mar 23 2017