www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Compiling DMD/Phobos on OSX (vs linux)

reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
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).

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. And are there any special
OSX-only prerequisites?
Aug 10 2013
parent reply Jacob Carlborg <doob me.com> writes:
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
Aug 11 2013
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Sun, 11 Aug 2013 22:11:26 +0200
Jacob Carlborg <doob me.com> wrote:

 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.
Thanks, I was indeed able to compile DMD/phobos on the system (after a loooong and surprisingly non-trivial download and install process for xcode/gcc). There did appear to be an issue with the tools repo, as I got errors about "dustmite" being a directory instead of a file, which kinda surprised me b/c I thought OSX was case-sensitive? (The tools repo *does* have the dustmite sources in a subdirectory named "DustMite".)
Aug 12 2013
parent reply Jacob Carlborg <doob me.com> writes:
On 2013-08-12 09:33, Nick Sabalausky wrote:

 Thanks, I was indeed able to compile DMD/phobos on the system (after a
 loooong and surprisingly non-trivial download and install process for
 xcode/gcc).
Oh, really? I guess I forgot to mention that you need to install the command line tools as well.
 There did appear to be an issue with the tools repo, as I got errors
 about "dustmite" being a directory instead of a file, which kinda
 surprised me b/c I thought OSX was case-sensitive? (The tools repo
 *does* have the dustmite sources in a subdirectory named "DustMite".)
No, HFS+, the filesystem on Mac OS X, is by default _not_ case-sensitive. I have hit one or two issues with this but in general it's not a problem. If you want, it's possible to choose case-sensitive, but that would most likely require you to reinstall the system. -- /Jacob Carlborg
Aug 12 2013
parent reply Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Mon, 12 Aug 2013 10:33:24 +0200
Jacob Carlborg <doob me.com> wrote:

 On 2013-08-12 09:33, Nick Sabalausky wrote:
 
 Thanks, I was indeed able to compile DMD/phobos on the system
 (after a loooong and surprisingly non-trivial download and install
 process for xcode/gcc).
Oh, really? I guess I forgot to mention that you need to install the command line tools as well.
Actually, what really took the most time by far was just downloading xcode - that sucker's like 1 or 2 gigs! All in all that wasn't too bad though. The most awkward thing about the whole deal was just using an OS that I'm *really* not accustomed to ;)
 There did appear to be an issue with the tools repo, as I got errors
 about "dustmite" being a directory instead of a file, which kinda
 surprised me b/c I thought OSX was case-sensitive? (The tools repo
 *does* have the dustmite sources in a subdirectory named
 "DustMite".)
No, HFS+, the filesystem on Mac OS X, is by default _not_ case-sensitive. I have hit one or two issues with this but in general it's not a problem. If you want, it's possible to choose case-sensitive, but that would most likely require you to reinstall the system.
I see. In that case, the "tools"'s posix.mak needs to be fixed, ideally by generating the executables into a subdirectory instead of tools's root. I'll put together a pull req.
Aug 12 2013
next sibling parent Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> writes:
On Mon, 12 Aug 2013 12:11:13 -0400
Nick Sabalausky <SeeWebsiteToContactMe semitwist.com> wrote:
 
 I see. In that case, the "tools"'s posix.mak needs to be fixed,
 ideally by generating the executables into a subdirectory instead of
 tools's root. I'll put together a pull req.
 
https://github.com/D-Programming-Language/tools/pull/74
Aug 12 2013
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2013-08-12 18:11, Nick Sabalausky wrote:

 Actually, what really took the most time by far was just downloading
 xcode - that sucker's like 1 or 2 gigs!
You can actually just download and install the command line tools. But I'm not sure if the DMD makefile is setup to handle that. I have know idea if it will find the SKD and so on. They're available here: https://developer.apple.com/downloads/index.action Requires a free Apple account. Search for "Command Line Tools". Only 113 MB.
 All in all that wasn't too bad though. The most awkward thing about
 the whole deal was just using an OS that I'm *really* not accustomed
 to ;)
Hehe :) -- /Jacob Carlborg
Aug 12 2013