digitalmars.D.ldc - Cross compile linux -> OS X
- Oleg B (3/3) Nov 20 2017 Hello. It's possible to build application on linux for OS X? And
- kinke (21/24) Nov 20 2017 Hi Oleg,
- Jacob Carlborg (7/9) Nov 21 2017 I have a Dockerfile for that [1]. Just invoke "ldc2" as usual, it's
- Oleg B (3/11) Nov 23 2017 Thanks! I try it near future.
Hello. It's possible to build application on linux for OS X? And if yes what I need to do for this? Also interesting works with libraries as gtk-d.
Nov 20 2017
On Monday, 20 November 2017 at 18:01:02 UTC, Oleg B wrote:Hello. It's possible to build application on linux for OS X? And if yes what I need to do for this? Also interesting works with libraries as gtk-d.Hi Oleg, of course it's possible, I just don't know how much of a hassle it is. The steps are always the same: 1) Compile objects/static libs via `-mtriple=x86_64-darwin` (or a more specific triple, I'm not an Apple user). 2) Get ahold of druntime/Phobos for OSX; the simplest solution is to copy the libs from the official LDC package for OSX; compiling them yourself via the ldc-build-runtime tool (https://wiki.dlang.org/Building_LDC_runtime_libraries) would be another option but requires a full C cross-toolchain. 3) Link with a linker capable of outputting OSX binaries; you'll also need the OSX C runtime libs/init objects as druntime is built on top of the C runtime. I guess Apple doesn't provide a cross-toolchain by themselves, so you may have to copy the libs/objects over from an Xcode installation and link manually via LLD. Points 1 and 2 are trivial; point 3, cross-linking, is definitely the biggest hurdle. It's not specific to D though, so any guide/tutorial you find about how to cross-compile/link C(++) code from Linux to OSX will be applicable here as well.
Nov 20 2017
On 2017-11-20 19:01, Oleg B wrote:Hello. It's possible to build application on linux for OS X? And if yes what I need to do for this? Also interesting works with libraries as gtk-d.I have a Dockerfile for that [1]. Just invoke "ldc2" as usual, it's already configured to cross-compile. [1] https://github.com/jacob-carlborg/docker-ldc-darwin/blob/master/Dockerfile -- /Jacob Carlborg
Nov 21 2017
On Tuesday, 21 November 2017 at 20:40:30 UTC, Jacob Carlborg wrote:On 2017-11-20 19:01, Oleg B wrote:Thanks! I try it near future.Hello. It's possible to build application on linux for OS X? And if yes what I need to do for this? Also interesting works with libraries as gtk-d.I have a Dockerfile for that [1]. Just invoke "ldc2" as usual, it's already configured to cross-compile. [1] https://github.com/jacob-carlborg/docker-ldc-darwin/blob/master/Dockerfile
Nov 23 2017