[GRASS5] GDAL binaries for OSX

Hi,

just downloaded the GDAL binary for OSX from
http://mpa.itc.it/markus/grass57/macosx/

Brand new Mac OSX 10.3 system; Fink installed but not used yet.
(i.e. /sw directory tree exists, and /sw/bin $PATHs set)

Un-tar.gz'd it into a local directory,

$ cd gdal-1.1.9-cvs-30-oct-2003-macosx-bin/
$ su
# cp bin/* /sw/bin/
# cp lib/* /sw/lib/
# cd /sw/lib
# ln -s libgdal.1.1.9.dylib libgdal.1.1.dylib
# exit
$
$ gdalinfo --formats
dyld: ../bin/gdalinfo can't open library: /Users/markus/gdal/gdal-1.1.9-cvs-30-oct-2003-linux-bin/lib/libgdal.1.dylib (No such file or directory, errno = 2)
Trace/BPT trap

???

Note 1: Fink must be installed for this GDAL install.
Note 2: the above webpage ask you to copy non-existant files to /sw/include

thanks,
Hamish
(who knows very little about OSX)

On Tue, Dec 09, 2003 at 09:42:53PM +1300, Hamish wrote:

Hi,

just downloaded the GDAL binary for OSX from
http://mpa.itc.it/markus/grass57/macosx/

Hi Hamish,

in a few days this page will be reomved :slight_smile:
I am waiting for a person to take over these efforts,
so I'll leave it as-is for now.

[...]

dyld: ../bin/gdalinfo can't open library: /Users/markus/gdal/gdal-1.1.9-cvs-30-oct-2003-linux-bin/lib/libgdal.1.dylib (No such file or directory, errno = 2)
Trace/BPT trap

Looks like a path problem.

[...]

Note 1: Fink must be installed for this GDAL install.

Yes. I thought that GDAL/GRASS without FINK is impossible?

Note 2: the above webpage ask you to copy non-existant files to /sw/include

Sorry. The next maintainer will do better.

thanks,
Hamish
(who knows very little about OSX)

I know nothing about OSX, that's why I will leave it to others.

Markus

I'd like to help out on this, and have started writing a page on notes specific to setting up GRASS on OS X. I'll make it available for previewing soon, would like to get comments. I am experienced at kludging things together on OS X, as well as Solaris and Linux, and have been collecting information from the mailing list for a while. I am not an expert programmer, though, so will keep running into walls and needing help to get around them.

GDAL and GRASS are not impossible without fink, but fink certainly makes it easier. I think in general, the type of person that can get all of the other required bits compiled and in place without fink can also handle GRASS compilation better than most, so we don't have to worry so much about them. The Linux-world comparison would be to say that you can download and install "manually" all the pieces that are needed for GRASS to work by yourself, but many of them are easier to get / already provided by default in a packaged linux system like RedHat/Debian/Mandrake etc... (in .debs, .rpms, ...). The extra complication is that many of these pieces are already installed by default on a typical Linux installation, whereas they need to be added to an OS X system before it can get GRASS going. Apple has included more of the typical tools with the OS and its development system as the OS has matured, so this is getting simpler.

Having said that, fink is not even the ONLY package manager for OS X - I know of at least one other packaging project. But fink is the one I am familiar with, so it's the one I can give somewhat experienced advice with.

Regarding making things available for download, one reason I haven't stepped in faster is that my network connection here is still sub-standard. I may be able to arrange some hosting with a colleague at another university, but for now am concentrating on putting information together that presumably can be added to the web site.

Thanks, Markus, for all your efforts on this !

Cheers,
Scott

On 9-Dec-03, at 05:00, Markus Neteler wrote:

On Tue, Dec 09, 2003 at 09:42:53PM +1300, Hamish wrote:

Hi,

just downloaded the GDAL binary for OSX from
http://mpa.itc.it/markus/grass57/macosx/

Hi Hamish,

in a few days this page will be reomved :slight_smile:
I am waiting for a person to take over these efforts,
so I'll leave it as-is for now.

[...]

dyld: ../bin/gdalinfo can't open library: /Users/markus/gdal/gdal-1.1.9-cvs-30-oct-2003-linux-bin/lib/libgdal.1.dylib (No such file or directory, errno = 2)
Trace/BPT trap

Looks like a path problem.

[...]

Note 1: Fink must be installed for this GDAL install.

Yes. I thought that GDAL/GRASS without FINK is impossible?

Note 2: the above webpage ask you to copy non-existant files to /sw/include

Sorry. The next maintainer will do better.

thanks,
Hamish
(who knows very little about OSX)

I know nothing about OSX, that's why I will leave it to others.

Markus

_______________________________________________
grass5 mailing list
grass5@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5

------
Scott W. Mitchell Scott_Mitchell@carleton.ca
Department of Geography and Environmental Studies
Carleton University, B349 Loeb Building (Office A209)
1125 Colonel By Drive, Ottawa, ON Canada K1S 5B6
+1-613-520-2600 ext 2695 Fax: 1-613-520-4301

FWIW, I have a GRASS page for building on Mac OS X (sorry for not mentioning this earlier):

<http://webpages.charter.net/kyngchaos/macosx/grassinstall.html&gt;

I do not use Fink at all, or any other package manager. It's currently for GRASS 5.3 CVS on Jaguar. There are a few hacks here and there to get things working, tho some may be unnecessary. I'm working on updating it for Panther. It's mostly finished, I just need check a couple things and upload the changes.

I've built 5.7 with no problems and little fuss as well (again, no Fink), tho I haven't tried to use it yet. If there's interest I can add that to my web page.

I'm also working on frameworks for many required libraries to make things easier for the average Mac user to install.

I'd like to get more active in helping out. I probably couldn't handle downloadable binaries on my home web site, but I might be able to work something out at my job (I AM the IT guy there ^_^). Let me check on that possibility...

On Dec 9, 2003, at 8:05 AM, Scott Mitchell wrote:

I'd like to help out on this, and have started writing a page on notes specific to setting up GRASS on OS X. I'll make it available for previewing soon, would like to get comments. I am experienced at kludging things together on OS X, as well as Solaris and Linux, and have been collecting information from the mailing list for a while. I am not an expert programmer, though, so will keep running into walls and needing help to get around them.

GDAL and GRASS are not impossible without fink, but fink certainly makes it easier. I think in general, the type of person that can get all of the other required bits compiled and in place without fink can also handle GRASS compilation better than most, so we don't have to worry so much about them. The Linux-world comparison would be to say that you can download and install "manually" all the pieces that are needed for GRASS to work by yourself, but many of them are easier to get / already provided by default in a packaged linux system like RedHat/Debian/Mandrake etc... (in .debs, .rpms, ...). The extra complication is that many of these pieces are already installed by default on a typical Linux installation, whereas they need to be added to an OS X system before it can get GRASS going. Apple has included more of the typical tools with the OS and its development system as the OS has matured, so this is getting simpler.

Having said that, fink is not even the ONLY package manager for OS X - I know of at least one other packaging project. But fink is the one I am familiar with, so it's the one I can give somewhat experienced advice with.

Regarding making things available for download, one reason I haven't stepped in faster is that my network connection here is still sub-standard. I may be able to arrange some hosting with a colleague at another university, but for now am concentrating on putting information together that presumably can be added to the web site.

-----
William Kyngesburye <williamk@mappingspecialists.com>
Mapping Specialists <http://www.mappingspecialists.com>

Don't Panic

I'd like to help out on this, and have started writing a page on notes
specific to setting up GRASS on OS X. I'll make it available for
previewing soon, would like to get comments.

Here a some of my notes which may be useful for your write-up.
This is for a binary only install.

GRASS 5.7 on OSX 10.3

1) Install Apple's X11 and friends
Our new system came with OSX 10.3 preinstalled, and past the point of custom
install so I had to download Apple's X11 from their website[1]. After
installing that, I headed over to Applications/Installers/Developer Tools
and double clicked Developer.mpkg; from the custom install list I
choose Devel Tools Software, MacOSX SDK, BSD SDK, and X11 SDK.

2) Setup a root password
Open Apps/Utilities/Terminal and type 'sudo su' and set a strong password.

3) Install R-statistics[2]
This is optional, but useful for geostats. Click on CRAN, choose a mirror,
click on R Binaries, macosx, and download RAqua.dmg. Double click on that
package and install tcltk, libreadline, and finally RAqua. This installs
the OSX port of R to Applications/StartR. I made a link to this application
so I could start R from the command line by typing "R":
(as root)
mkdir /usr/local/bin (if it doesn't already exist)
ln -s /Applications/StartR.app/Contents/MacOS/StartR /usr/local/bin/R

Next, start R and type:
install.packages("akima")
install.packages("VR")
install.packages("GRASS")
install.packages("RODBC")
install.packages("grasper")
install.packages("mgcv")
install.packages("shapefiles")
.. and any other packages that might look interesting to you

The GRASS website has a useful R primer[3].

4) Setup X startup files.
OSX's Terminal looks for .bash_profile but not .bashrc. Apple's X11 looks for
.bashrc but not .bash_profile. Solution (kludge) follows:

.bash_profile:
. ~/.bashrc # does this need to be a hard path for the GRASS init script?

.bashrc:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ls='ls -FG'
alias ll='ls -la'
alias la='ls -A'
alias dir='/bin/ls'
PATH="$PATH":/usr/local/bin

I also disabled the xterm& in /etc/X11/xinit/xinitrc.

5) Install Fink[4]
Download & run the Fink Installer. Double click on "Fink 0.6.2 Installer.pkg"
and after that is setup, drag the FinkCommander folder to your desktop.
Check this line has been added to all users' .bashrc:
. /sw/bin/init.sh
I ran 'fink configure' to setup which Fink mirror to talk to, but that's not
a strict requirement.
May need to log out & back in to take effect.

6) Run FinkCommander
Setup to use stable packages, it has already guessed to use the 10.3 branch.
This branch is missing some packages as of this writing, but saves time vs.
compiles. I installed: wget, gimp, dlcompat-shlibs (needed for Gimp),
tcklk (yes, again), and gmt. I would have installed nedit and octave if they
were in the stable archive at the time in binary form. Gimp brings down a lot
of goodies like the netpbm tools and libpng which will probably be needed
later. Someone noted about needing the TclTk from unstable for compile??

7) Install PROJ.4 and GDAL
Download[5] and follow Markus's instructions to install PROJ and GDAL.
Then as root, make the following two links:
ln -s /sw/lib/libgdal.1.1.9.dylib /usr/local/lib/libgdal.1.1.dylib
Forget what the second one was, thought it for Proj. What breaks?

These are probably better dealt with by getting /sw/lib added to OSX's
ld path, where ever that lives.

8) Install GRASS
Download[5] and follow Markus's instructions. I found it better to use
wget instead of Safari to do the download to keep the MD5 hash the same
as Safari automatically unpacks the archive.
(as root)
grass57-20_11_2003-powerpc-apple-darwin6.8-install.sh \
    grass57-20_11_2003-powerpc-apple-darwin6.8-bin.tar.gz \
    /usr/local/grass57

mkdir ~/grassdata
and install the Spearfish, Leics, and Radim's g51test data sets there.

9) Add links to the X11 menu
Start X11 (Apps/Utilities), choose Customize.. from the Applications menu.
Add Item, Add Item. Double click on blanks & fill in:
Name Command
GRASS 5.7 xterm -geometry 123x25+5+400 -e grass57
The GIMP gimp

10) Enjoy. Everything seems to work, even NVIZ.

[1] http://www.apple.com/macosx/features/x11/download/
[2] http://www.r-project.org/
[3] http://grass.ibiblio.org/statsgrass/grass_geostats.html
[4] http://fink.sourceforge.net/
[5] http://mpa.itc.it/markus/grass57/macosx/ [TEMPORARY]

Hamish

Hamish wrote:

OSX's Terminal looks for .bash_profile but not .bashrc. Apple's X11 looks for
.bashrc but not .bash_profile. Solution (kludge) follows:

The terminals don't look for these files; bash does. However, exactly
which files depends upon the argument list:

       A login shell is one whose first character of argument
       zero is a -, or one started with the -login flag.

       An interactive shell is one whose standard input and outĀ­
       put are both connected to terminals (as determined by
       isatty(3)), or one started with the -i option. PS1 is set
       and $- includes i if bash is interactive, allowing a shell
       script or a startup file to test this state.

       Login shells:
         On login (subject to the -noprofile option):
               if /etc/profile exists, source it.

               if ~/.bash_profile exists, source it,
                 else if ~/.bash_login exists, source it,
                   else if ~/.profile exists, source it.

         On exit:
               if ~/.bash_logout exists, source it.

       Non-login interactive shells:
         On startup (subject to the -norc and -rcfile options):
               if ~/.bashrc exists, source it.

It appears that OSX' Terminal application starts bash as a login
shell. Whether or not xterm starts bash as a login shell depends upon
the [+/-]ls switch:

       -ls This option indicates that the shell that is
               started in the xterm window will be a login shell
               (i.e., the first character of argv[0] will be a
               dash, indicating to the shell that it should read
               the user's .login or .profile).

               Note that this is incompatible with -e, since the
               login program does not provide a way to specify
               the command to run in the new shell. If you specĀ­
               ify both, xterm uses -ls.

       +ls This option indicates that the shell that is
               started should not be a login shell (i.e. it will
               be a normal ``subshell'').

and the loginShell X resource:

       loginShell (class LoginShell)
               Specifies whether or not the shell to be run in
               the window should be started as a login shell.
               The default is ``false.''

The general idea behind a "login" shell is that the "top level" shell
(the one which is started automatically when you log in on a terminal)
should be a login shell, but subsequent shells (e.g. those started by
typing "bash" in an existing shell, using the "spawn shell" feature in
a program, etc) shouldn't be.

The bash_profile files (/etc/bash_profile, ~/.bash_profile) are only
run for login shells, so you can do things like:

  PATH="$PATH:/usr/local/bin"
  export PATH

and $PATH won't end up getting ":/usr/local/bin" appended repeatedly.

Also, if you set environment variables in bash_profile, they will be
inherited by subshells; if you change them, the changes will be
inherited by subshells. OTOH, if you set environment variables in
~/.bashrc, those settings will replace any changed versions.

In general, environment variables should be set in bash_profile, while
aliases functions should be defined in bashrc.

Whether or not xterm should spawn a login shell depends to an extent
upon whether your X startup scripts (e.g. ~/.xsession or ~/.xinitrc)
source bash_profile. If they don't, then you probably need to use
"xterm -ls" or set loginShell to True, e.g. by adding:

  XTerm*vt100.loginShell: True

to ~/.Xdefaults.

Alternatively, you can have ~/.bashrc source ~/.bash_profile, but only
if $SHLVL is 1, e.g.

  if [ "$SHLVL" = 1 ] ; then
    . ~/.bash_profile
  fi

At startup, bash sets $SHLVL to one more than the value which it
inherited from its parent, or to 1 if SHLVL wasn't set. Consequently,
it will be 1 for a top-level shell and >1 for subshells.

--
Glynn Clements <glynn.clements@virgin.net>