[GRASS5] GRASS binaries for Mac OS X
Markus Neteler
neteler at itc.it
Tue Sep 23 07:53:23 EDT 2003
On Tue, Sep 23, 2003 at 12:39:10AM +0100, Glynn Clements wrote:
>
> Markus Neteler wrote:
>
> > I am still strying to compile GRASS 5.7 on Mac OSX.
> > At time I face the general problem that, when compiling
> > libraries, symbols from other GRASS libs are required.
> > This doesn't happen on Linux.
>
> Have you managed to get it working using static libraries? I recommend
> trying that first, and only trying with dynamic libraries once you
> have static libraries working.
I will try that. However, except the reported problems I can
use 95% of GRASS 5.7 with shared libs under Mac OSX. Only
important missing modules/drivers are XDRIVER and g.rename et al.
> > But in libgis I got stuck with
> >
> > cd lib/gis
> > make
> > [...]
> > OBJ.powerpc-apple-darwin6.6/writ_zeros.o OBJ.powerpc-apple-darwin6.6/yes.o
> > OBJ.powerpc-apple-darwin6.6/zero.o OBJ.powerpc-apple-darwin6.6/zero_cell.o
> > OBJ.powerpc-apple-darwin6.6/zone.o OBJ.powerpc-apple-darwin6.6/G_dump.o
> > -lgrass_datetime -lz -o
> > /grass57exp/dist.powerpc-apple-darwin6.6/lib/libgrass_gis.dylib
> > ld: Undefined symbols:
> > _environ
> > /usr/bin/libtool: internal link edit command failed
> > make: *** [/grass57exp/dist.powerpc-apple-darwin6.6/lib/libgrass_gis.dylib]
> > Error 1
> >
> > The file 'putenv.c' from GRASS 5.3 should probably have
> > #include <unistd.h>
> > added as under Linux is defined:
> > grep environ /usr/include/unistd.h
> > extern char **environ;
> >
> > Unfortunately on Mac OSX there is nothing like that in
> > /usr/include/unistd.h
> > /usr/include/sys/unistd.h
> > nor in another place.
> >
> > How to solve that?
>
> Just use putenv() instead of manually iterating through "environ".
>
> The comment at the top of putenv.c says:
>
> * NOTE: this is a routine that UNIX should have provided, but didn't
> * as such we are not yet sure of it's portability.
>
> putenv() is specified by POSIX, so it should be available on all
> Unix-like systems (unlike setenv(), which is a BSD-ism).
>
> OTOH, the environ variable is also specified by POSIX. If OSX doesn't
> provide it (or an equivalent), then it simply wouldn't be possible to
> enumerate the list of environment variables (which would make
> implementing the "env" command rather difficult).
>
> I suppose that configure could be made to check for putenv();
> G_putenv() would then use putenv if it is available, and its own
> implementation (using environ) if it isn't (although the absence of
> putenv() seems pretty unlikely to me).
May I kindly ask you to submit the relevant changes?
It might be too dangerous if I try :-)
Thanks in advance
Markus
More information about the grass-dev
mailing list