Compiling DMD/Phobos on OSX (vs linux)

Jacob Carlborg doob at me.com
Sun Aug 11 13:11:26 PDT 2013


On 2013-08-11 03:57, Nick Sabalausky wrote:
> I'm familiar with building DMD/Phobos on linux32/64 (and I assume
> freebsd is much the same, aside from having to install GNU make), but I
> know OSX is different in that the 32/64-bits bins are combined. I don't
> have access to a modern OSX machine ATM, but I might have a little
> bit of time with one tomorrow (I'm pretty sure it's either 10.6 or 10.7
> - I know it's a Core i7 laptop FWIW).

Both of these should be fine and are modern enough for developing using DMD.

> So I wanted to ask, is there anything I should know about doing a full
> build of DMD/Phobos on OSX? Is it just like doing a 32-bit-only or
> 64-bit-only build on linux, but just without using -m32/-m64? Or do I
> do one arch and then the other? Or does it differ between the different
> components (dmd/druntime/phobos)? Etc.

If you run "make -f posix.mak" it will build only build for the default 
architecture, that is most likely 64bit. Only 64bit binaries of DMD are 
distributed. For Phobos a universal (fat) binary is distributed. Search 
for "lipo" in the Phobos makefile. lipo is the tool used to combine 
multiple architectures to a single binary. You can verify the result by 
running "file path/to/binary". It will tell which architectures are 
available in the binary. These tools work both with executables, dynamic 
and static libraries.

> And are there any special OSX-only prerequisites?

The developer tools, aka Xcode, available in App Store.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list