[GRASSweb-list]scott: web macosx_grass50compile.html,NONE,1.1

grass at intevation.de grass at intevation.de
Wed Apr 28 10:12:47 EDT 2004

Author: scott

Update of /grassrepository/web
In directory doto:/tmp/cvs-serv3755

Added Files:
Log Message:
Added initial instructions for Mac compile

--- NEW FILE: macosx_grass50compile.html ---

<B><p>Initial Notes:</b>a
<p>A comprehensive review of, or set of instructions for, compiling GRASS on a
Mac is not here yet.  In the meantime, here are some notes put together by
Scott Mitchell (smitch AT mac dot com).  Suggestions / additions welcome.
<p>Compiling GRASS under Mac OS X requires the development tools to be installed.  This is a separate package if you installed OS X yourself, and depending on the software version, it is either on one of the install disks, or you need to download it from Apple (it's free).  If OS X came pre-installed on your computer, the developer tools may have been installed for you, depending on the computer model and when it was purchased.  If not, they may be on a CD that came with the computer, and if not you also need to download them from Apple.
<p>Two checks I can think of off the top of my head to see if they are installed are to (1) check to see if you have a /Developer directory in your boot drive, or (2) at a command line prompt, type the command gcc and press enter - if you get a "Command not found" error, or something to that effect, you likely don't have the tools installed.  If you get "gcc: no input files", then you've got the tools.
<p>Beyond having the necessary compilers and libraries provided by the development environment, you also need all of the other <a href="../grass5/source/REQUIREMENTS.html">prerequisites</a> for GRASS.  If you are experienced in building Unix/Linux applications, you may elect to obtain and compile them all yourself.  Otherwise, you will probably want to use some form of packaging system.  In either case, refer back to the main <a href="macgrass.html">GRASS on Mac page</a> for more details.
<p>Once you have all the prerequisities in place, compiling GRASS is relatively
straightforward, or at least it's pretty much the same on this platform as others, except perhaps that some required libraries are in non-standard locations 
from the point of view of other platforms.  For example, if you have used FINK 
to install related tools, those will be located under the /sw directory.  Some
of the required bits are provided by Apple and are typically under /usr,
and if you compiled and installed anything manually, it may be under /usr/local.

<p>For more compilation advice, until I receive any other great suggestions,
the best I can offer is to show the procedure I have been using successfully
on my own machines.
I have most of the required extras installed by fink.  These include the graphics libraries, Postgresql, unixodbc, FFTW, lesstif, and libdl.  Freetype is provided by
Apple's X11 on my Panther machines, and by fink on the Jaguar one (which also 
has XFree86 provided by fink instead of by Apple).  I have compiled PROJ4 and
GDAL myself and installed them in to the default /usr/local hierarchy, mostly
using the instructions and defaults that come with those packages.  So for 
PROJ I just did the typical set of commands to compile it:
<pre>	./configure
	sudo make install </pre>
For GDAL, there was a small change, which was necessary at one time to get
the compile to work for Macs - I don't know if that is still the case, but
it's safe to keep it this way as far as GRASS compatibility:
<pre>	./configure --with-python=no </pre>
and then it gets standard:
<pre>	make
	sudo make install
<p>Next, I'm ready to set up the GRASS compile, in the GRASS source directory.
Note that I'm assuming that you've obtained and extracted the source, and have
read all the directions that come with it - this document is not duplicating
any of the other directions on this site, just pointing out parts that may be
different than on other systems.
<p>So first I need to configure the build so that it finds all my extra
libraries.  Instead of typing in the location for ALL of the libraries that
are provided by my FINK installation, I use the generic --with-includes=
and --with-libs= to tell configure to add the /sw/[lib,include] directories
to all of its searches for the requirements.  Some of the other switches used
are described below.
<p>So my configure command (copied from my last compile of v5.3-cvs) is:
./configure  --with-includes="/usr/X11R6/include /sw/include" \
	--with-libs="/usr/X11R6/lib /sw/lib" --with-motif --with-glw \
	--with-postgres=yes --with-gdal=/usr/local/bin/gdal-config \
	--with-proj --with-freetype \
	--with-freetype-includes=/usr/X11R6/include/freetype2 --enable-64-bit 
	--enable-shared --with-gd 
	--with-postgres-includes=/sw/include/postgresql \
<p>Notes on the above switches:
<ul><li>The --enable-64-bit is because this was on a G5 computer, so if anything in
the code can take advantage of the 64 bit platform, that turns it on.  To be
honest, I haven't checked to see if this actually does anything yet.  If you
are doing this on a G4, skip that one.</li>
<li>The --enable-shared tells GRASS to build shared versions of the GRASS 
libraries instead of building them in to each binary module, resulting in 
much smaller files being built.  I THINK this actually now depracated in that
this is not the default for modern versions of GRASS 5.3 and higher.  If you
want to do my homework and check that for me, search the mailing list archives,
the relevant post is probably by Paul Kelly or Glynn Clements.  In any case,
it doesn't hurt to leave it in here.
<P>After that, the <pre>makei</pre> command builds the software.  Check the error log file.
If all looks good, <pre>sudo make install</pre> will put everything in place. 
<P>Please do get back to me using "smitch at mac dot com" with suggestions or problems regarding these instructions.

More information about the grass-web mailing list