www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Getting started on a Mac

reply Alexy Khrabrov <deliverable gmail.com> writes:
So I got me a new shiny dmd for Mac, the Tango with D book, and went ahead to
compile something.  What about Tango itself?  Checked it out of svn, saw a dsss
directory.  Got dsss of of svn, tried to compile that.  The sad results are in:

http://www.dsource.org/forums/viewtopic.php?t=4490

Now what about starting off on a better footing?  I mean, I have to chmod +x
dmd?!  I need to make a statement of faith that it's executable? :)

Does anyone have a straightfoward writeup on what to do from the very beginning
-- in what sequence I get D, DSSS, Tango up and running?  On a Mac, too! :)

Cheers,
Alexy
Mar 08 2009
parent reply Sean Kelly <sean invisibleduck.org> writes:
Alexy Khrabrov wrote:
 So I got me a new shiny dmd for Mac, the Tango with D book, and went ahead to
compile something.  What about Tango itself?  Checked it out of svn, saw a dsss
directory.  Got dsss of of svn, tried to compile that.  The sad results are in:
 
 http://www.dsource.org/forums/viewtopic.php?t=4490
 
 Now what about starting off on a better footing?  I mean, I have to chmod +x
dmd?!  I need to make a statement of faith that it's executable? :)
 
 Does anyone have a straightfoward writeup on what to do from the very
beginning -- in what sequence I get D, DSSS, Tango up and running?  On a Mac,
too! :)

Here's what I do to install DMD: - unzip to ~/dmd - sudo mkdir /opt/dmd-1.040 (or whatever) - sudo ln -s /opt/dmd-1.040 /opt/dmd - cd /opt/dmd - sudo cp -r ~/dmd . - sudo ln -s osx/bin - sudo ln -s osx/lib - cd bin - sudo chmod a+x dmd obj2asm etc Add /opt/dmd/bin to your path and you're ready to go. Now I install my D import files to /usr/local/include/d, which requires changing dmd.conf to something like the following: DFLAGS=-I/usr/local/include/d -L-L/usr/local/lib -L-L% P%/../lib (I'm guessing a bit about having two link paths... I only use /usr/local/lib) Now DMD will look for import files only in /usr/local/include/d and for lib files (hopefully) in /usr/local/lib and /opt/dmd/lib. When you install Tango, copy the import files to /usr/local/include/d and the library files to /usr/local/lib and you should be all set. There's also a manual install doc on the Tango website you can follow, but this should cover the basics. I run out of /usr/include/d because I publish everything directly from SVN.
Mar 08 2009
next sibling parent reply Alexy Khrabrov <deliverable gmail.com> writes:
Sean Kelly Wrote:
 
 Now DMD will look for import files only in /usr/local/include/d and for 
 lib files (hopefully) in /usr/local/lib and /opt/dmd/lib.  When you 
 install Tango, copy the import files to /usr/local/include/d and the 
 library files to /usr/local/lib and you should be all set.
 
 There's also a manual install doc on the Tango website you can follow, 
 but this should cover the basics.  I run out of /usr/include/d because I 
 publish everything directly from SVN.

Well, I can't compile DSSS with dmd and thus can't compile Tango yet -- any way to do that yet? Should I try DSSS binary from a .dmg for gdc, or some binary version of Tango? Ideally, if there's a way to do it for the developers, Tango binaries for dmd would come handy!
Mar 08 2009
parent reply John Stoneham <captnjameskirk yahoo.com> writes:
Alexy Khrabrov Wrote:
 Well, I can't compile DSSS with dmd and thus can't compile Tango yet -- any
way to
 do that yet?  Should I try DSSS binary from a .dmg for gdc, or some binary
version of
 Tango?  Ideally, if there's a way to do it for the developers, Tango binaries
for dmd would 
 come handy!

You don't need DSSS to compile Tango on OS X, just DMD itself. Grab Tango SVN and follow the linux/dmd "manual build and install" instructions here: http://www.dsource.org/projects/tango/wiki/LinuxInstallDmd Skip the "install-dmd.sh" step and follow the manual steps. There is an OS X binary of DSSS 0.78 from the DSSS page which works for me. I also built DSSS from source, but then I used gdc to build it I believe. But the binary should work fine. I found that I had to add -L-ltango-base-dmd to the dmd.conf DFLAGS in order to get DMD to link properly with Tango when compiling something from the command line. This isn't necessary when using DSSS or rebuild. However, I did have to edit the dmd-posix rebuild conf file to take out "-version=Posix" in the compiler flags.
Mar 08 2009
next sibling parent reply Alexy Khrabrov <deliverable gmail.com> writes:
John Stoneham Wrote:

 You don't need DSSS to compile Tango on OS X, just DMD itself. Grab Tango SVN
and follow the linux/dmd "manual build and install" instructions here: 
 http://www.dsource.org/projects/tango/wiki/LinuxInstallDmd

Awesome John! It worked like a charm. Now I was curious to use the binary DSSS I got and I said at the top of tango, dsss build -- apparently it started chugging along, then said gdc not found. As it was built with gdc obviously. Now what would I hack in tango/dsss.conf if I were to build it with dmd I got?
Mar 08 2009
parent reply Christopher Wright <dhasenan gmail.com> writes:
Alexy Khrabrov wrote:
 John Stoneham Wrote:
 
 You don't need DSSS to compile Tango on OS X, just DMD itself. Grab Tango SVN
and follow the linux/dmd "manual build and install" instructions here: 
 http://www.dsource.org/projects/tango/wiki/LinuxInstallDmd

Awesome John! It worked like a charm. Now I was curious to use the binary DSSS I got and I said at the top of tango, dsss build -- apparently it started chugging along, then said gdc not found. As it was built with gdc obviously. Now what would I hack in tango/dsss.conf if I were to build it with dmd I got?

If dsss works but complains that gdc is missing, you need to look at the files in /etc/rebuild (or wherever you installed dsss to). You should copy dmd-posix-tango to dmd-osx-tango or something similar and change any usage of "Posix" to "Darwin". Then edit the file 'default' in that directory and change it to say 'dmd-osx-tango'.
Mar 09 2009
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Christopher Wright wrote:

 If dsss works but complains that gdc is missing, you need to look at the 
 files in /etc/rebuild (or wherever you installed dsss to). You should 
 copy dmd-posix-tango to dmd-osx-tango or something similar and change 
 any usage of "Posix" to "Darwin".

version(darwin) is predefined, so it should not be added again. Instead, GDC uses version(Unix) where DMD uses version(Posix)... --anders
Mar 09 2009
prev sibling parent reply Alexy Khrabrov <deliverable gmail.com> writes:
OK, so now I have Tango; if I used to have Phobos, what do I now set the
include paths to -- only Tango?  I've saw the Tangobos project saying it allows
for code using either.  Does it mean I'd be better off with Tangobos?  Then
what do I set my include paths to?  What are the choices people make on which
one or both or all three libraries to use, and why?  Is it fair to say folks
use just Tango and are happy with it and that's where D is going?
Mar 08 2009
parent John Stoneham <captnjameskirk yahoo.com> writes:
Alexy Khrabrov Wrote:

 OK, so now I have Tango; if I used to have Phobos, what do I now set the
include paths
 to -- only Tango?  I've saw the Tangobos project saying it allows for code
using either.  
 Does it mean I'd be better off with Tangobos?  Then what do I set my include
paths to?
 What are the choices people make on which one or both or all three libraries
to use, 
 and why?  Is it fair to say folks use just Tango and are happy with it and
that's where D is
 going?

If you're going to use dmd on the command line, you should probably keep two copies of dmd.conf, one for phobos and one for tango. Using dsss/rebuild is easier once you have dmd-posix (for phobos) and dmd-posix-tango config files set up. Then you just use "dsss -dc=dmd-posix-tango build" or "dsss -dc=dmd-posix build" for tango or phobos as needed. For some more details, look at: http://www.dsource.org/projects/tango/wiki/PhobosTangoCooperation Tangobos is a port of Phobos to the Tango runtime. It's not something you would use when writing a new project, it's mainly for an intermediate step in porting legacy Phobos-based projects. For your own projects, you can use Tango or Phobos, whichever one you feel more comfortable with. If you're planning on using D2, Tango is not there yet (I think there's an experimental branch for D2, not sure if it "works" yet) so you may have to use Phobos. Play around with both. If you're coming from a C background (not C++) then you might feel more comfortable with Phobos. If you've used C++/STL/Boost then you might feel more comfortable with Tango. The projects on dsource that I've been interested in almost all now support both libraries, so if you're default setup is to compile with Tango, they will compile (you may need a "-version=Tango" flag or similar). There are some active projects that only support Tango, but I don't think there are many new/active projects that only support Phobos. I get the feeling that new development is leaning towards Tango, but that's just my feeling.
Mar 09 2009
prev sibling parent reply =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Sean Kelly wrote:

 Does anyone have a straightfoward writeup on what to do from the very 
 beginning -- in what sequence I get D, DSSS, Tango up and running?  On 
 a Mac, too! :)

Here's what I do to install DMD: - unzip to ~/dmd - sudo mkdir /opt/dmd-1.040 (or whatever) - sudo ln -s /opt/dmd-1.040 /opt/dmd - cd /opt/dmd - sudo cp -r ~/dmd . - sudo ln -s osx/bin - sudo ln -s osx/lib - cd bin - sudo chmod a+x dmd obj2asm etc Add /opt/dmd/bin to your path and you're ready to go. Now I install my D import files to /usr/local/include/d, which requires changing dmd.conf to something like the following: DFLAGS=-I/usr/local/include/d -L-L/usr/local/lib -L-L% P%/../lib (I'm guessing a bit about having two link paths... I only use /usr/local/lib) Now DMD will look for import files only in /usr/local/include/d and for lib files (hopefully) in /usr/local/lib and /opt/dmd/lib. When you install Tango, copy the import files to /usr/local/include/d and the library files to /usr/local/lib and you should be all set. There's also a manual install doc on the Tango website you can follow, but this should cover the basics. I run out of /usr/include/d because I publish everything directly from SVN.

Seems a bit complicated, don't you think ??? It would be nicer if it went something like: 1) Install compiler package 2) Install library package 3) ... there is no step 3 But maybe that's just me. Everyone loves zip. --anders
Mar 09 2009
parent reply Sean Kelly <sean invisibleduck.org> writes:
Anders F Björklund wrote:
 
 Seems a bit complicated, don't you think ???

To be fair, if you want to use Phobos all you have to do is make DMD executable and put it in your path.
 It would be nicer if it went something like:
 1) Install compiler package

It would be easy enough to write an install script. Or did you mean something like an RPM? I don't even know what the OSX equivalent is.
Mar 09 2009
parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Sean Kelly wrote:

 It would be nicer if it went something like:
 1) Install compiler package

It would be easy enough to write an install script. Or did you mean something like an RPM? I don't even know what the OSX equivalent is.

It's called PackageMaker, creates .pkg (or .dmg) files... Like http://dsource.org/projects/tango/wiki/MacOSXInstall --anders
Mar 09 2009