[GRASS5] Re: GRASS 5.3 with shared libs

Hello Markus

On Tue, 6 Jan 2004, Markus Neteler wrote:

Hello Paul,

I found and fixed the problem with 'documents':
The problem was the identical directory name in the main dir,
I renamed the target in mk/Makefile.in, now it works
perfectly.

Markus

On Tue, Jan 06, 2004 at 12:06:40PM +0100, Markus Neteler wrote:
> > >
> > > Note that I was launching 'make' in the main source directory which
> > > worked perfectly. Or should it be
> >
> > I don't understand how you got that to work as when I try that it builds
> > using the old gmake5 system.
>
> Strange - not for me.
>
> I ran:
>
> [first elimination of all .o files, LIB* OBJ* ]
>
> rm Makefile
> rm -rf dist.i686-pc-linux-gnu bin.i686-pc-linux-gnu/
>
> CFLAGS="-O3 -Wall" ./configure --with-proj --without-freetype \
> --with-postgres-includes=/usr/include/pgsql \
> --with-cxx \
> --enable-gmake=no
>
> [creates all makefiles etc. One error:

I made a fresh checkout of the CVS on a RedHat 7.3 system and tried that
exact configure line from the top-level source directory and got this
error:

[...]
checking for source directory... /home/paulk/src/grass
checking for build directory... /home/paulk/src/grass
checking for Build Mechanism to be used... Alternate
configure: error: *** Build directory should not be the same as source
directory for the alternate build mechanism. Create a separate build
directory and run again, e.g. mkdir grass-build; cd grass-build;
../configure (see mk/README)

which is what I intended to happen as while it might be possible to run
the alternate build system from the top-level source directory it got very
messy with all the source directories filled up with .o files that weren't
easily removed. Also the 'old' Makefile got overwritten so you couldn't do
make bindist or make srcdist (I didn't bother copying these targets into
mk/Makefile.in yet).

The way I checked for the directory configure was being run from was like:

if test "$BUILD_MECH" = Alternate ; then
  if test "$SRCDIR" = "$DSTDIR" ; then
    AC_MSG_ERROR([*** Build directory should not be the same as source \
directory for the alternate build mechanism. Create a separate build \
directory and run again, e.g. mkdir grass-build; cd grass-build; ../configure \
(see mk/README)]);
  else
    SC_ENABLE_SHARED
  fi
fi

in configure.in.
Perhaps there is something wrong with the second line above (not
portable)?

In general I thought with the alternate build system it must be run from a
separate build directory. That was also why I copied the error.log file
back to the top level source directory as the POST_INSTALL.sh script
looked for it there. Again, the contents of POST_INSTALL.sh could be
duplicated in mk/Makefile.in but I didn't want to change more things than
I had to to make it work.
Perhaps it would be nice if the alternate build system could create its
own build directory automatically if it detects it is being run from the
top-level of the source. I thought about this but decided that was being
too clever.

It is worth tidying it up though but I was under the impression that with
the alternate build system we really should use a separate build
directory (and that is how I tested it).
Moritz: did you do it this way?

Paul

Hello Paul

On Wed, Jan 07, 2004 at 03:49:15PM +0000, Paul Kelly wrote:

Hello Markus

On Tue, 6 Jan 2004, Markus Neteler wrote:

> Hello Paul,
>
> I found and fixed the problem with 'documents':
> The problem was the identical directory name in the main dir,
> I renamed the target in mk/Makefile.in, now it works
> perfectly.
>
> Markus
>
> On Tue, Jan 06, 2004 at 12:06:40PM +0100, Markus Neteler wrote:
> > > >
> > > > Note that I was launching 'make' in the main source directory which
> > > > worked perfectly. Or should it be
> > >
> > > I don't understand how you got that to work as when I try that it builds
> > > using the old gmake5 system.
> >
> > Strange - not for me.
> >
> > I ran:
> >
> > [first elimination of all .o files, LIB* OBJ* ]
> >
> > rm Makefile
> > rm -rf dist.i686-pc-linux-gnu bin.i686-pc-linux-gnu/
> >
> > CFLAGS="-O3 -Wall" ./configure --with-proj --without-freetype \
> > --with-postgres-includes=/usr/include/pgsql \
> > --with-cxx \
> > --enable-gmake=no
> >
> > [creates all makefiles etc. One error:

I made a fresh checkout of the CVS on a RedHat 7.3 system and tried that
exact configure line from the top-level source directory and got this
error:

[...]
checking for source directory... /home/paulk/src/grass
checking for build directory... /home/paulk/src/grass
checking for Build Mechanism to be used... Alternate
configure: error: *** Build directory should not be the same as source
directory for the alternate build mechanism. Create a separate build
directory and run again, e.g. mkdir grass-build; cd grass-build;
../configure (see mk/README)

Have never seen this message :slight_smile:

which is what I intended to happen as while it might be possible to run
the alternate build system from the top-level source directory it got very
messy with all the source directories filled up with .o files that weren't
easily removed.

Well, I easily remove them with a 'find' command on all '*.o' files.

Also the 'old' Makefile got overwritten so you couldn't do
make bindist or make srcdist (I didn't bother copying these targets into
mk/Makefile.in yet).

In fact I didn't try make bindist or make srcdist as I use GRASS
directly from the ./dist.$ARCH directory. At time I am away from
that Mandrake box.

But those targets could be added, right?

The way I checked for the directory configure was being run from was like:

if test "$BUILD_MECH" = Alternate ; then
  if test "$SRCDIR" = "$DSTDIR" ; then
    AC_MSG_ERROR([*** Build directory should not be the same as source \
directory for the alternate build mechanism. Create a separate build \
directory and run again, e.g. mkdir grass-build; cd grass-build; ../configure \
(see mk/README)]);
  else
    SC_ENABLE_SHARED
  fi
fi

in configure.in.
Perhaps there is something wrong with the second line above (not
portable)?

Mhh, no idea right now.

In general I thought with the alternate build system it must be run from a
separate build directory.

As I don't know how to do that, I happily launched it from the
main directory (which should be IMHO allowed).

That was also why I copied the error.log file
back to the top level source directory as the POST_INSTALL.sh script
looked for it there. Again, the contents of POST_INSTALL.sh could be
duplicated in mk/Makefile.in but I didn't want to change more things than
I had to to make it work.
Perhaps it would be nice if the alternate build system could create its
own build directory automatically if it detects it is being run from the
top-level of the source. I thought about this but decided that was being
too clever.

It is worth tidying it up though but I was under the impression that with
the alternate build system we really should use a separate build
directory (and that is how I tested it).

I still don't see the advantage to be forced to use a separate build
directory - please explain again.

Moritz: did you do it this way?

Paul

Markus

On Wed, 7 Jan 2004, Markus Neteler wrote:

> I made a fresh checkout of the CVS on a RedHat 7.3 system and tried that
> exact configure line from the top-level source directory and got this
> error:
>
> [...]
> checking for source directory... /home/paulk/src/grass
> checking for build directory... /home/paulk/src/grass
> checking for Build Mechanism to be used... Alternate
> configure: error: *** Build directory should not be the same as source
> directory for the alternate build mechanism. Create a separate build
> directory and run again, e.g. mkdir grass-build; cd grass-build;
> ../configure (see mk/README)

Have never seen this message :slight_smile:

Yes that's very strange!

> which is what I intended to happen as while it might be possible to run
> the alternate build system from the top-level source directory it got very
> messy with all the source directories filled up with .o files that weren't
> easily removed.

Well, I easily remove them with a 'find' command on all '*.o' files.

Yes that could be added to a makefile somewhere easily enough

> Also the 'old' Makefile got overwritten so you couldn't do
> make bindist or make srcdist (I didn't bother copying these targets into
> mk/Makefile.in yet).

In fact I didn't try make bindist or make srcdist as I use GRASS
directly from the ./dist.$ARCH directory. At time I am away from
that Mandrake box.

But those targets could be added, right?

Yes certainly wouldn't be much more work at all.

> It is worth tidying it up though but I was under the impression that with
> the alternate build system we really should use a separate build
> directory (and that is how I tested it).

I still don't see the advantage to be forced to use a separate build
directory - please explain again.

It was really just that I felt that was the way Glynn had designed it and
there would be fewer complications and things likely to go wrong if it is
done that way. I just wanted to minimise the amount of work I had to do to
get it working. But it looks now like it mightn't require many if any
(now) changes to run it from the normal place.

To do:
provide some way of deleting the *.o files.
Move the checks in POST_INSTALL.sh somewhere else (probably into
mk/Makefile?)
Add srcdist and bindist to mk/Makefile

Paul

Paul Kelly said:

It is worth tidying it up though but I was under the impression that with
the alternate build system we really should use a separate build
directory (and that is how I tested it).
Moritz: did you do it this way?

Yes, I create a grass_build directory and built in there. It worked
perfectly and instead of running a make clean fo some sorts, I just erased
the entire directory once I had installed GRASS.

Moritz

Paul Kelly wrote:

The way I checked for the directory configure was being run from was like:

if test "$BUILD_MECH" = Alternate ; then
  if test "$SRCDIR" = "$DSTDIR" ; then
    AC_MSG_ERROR([*** Build directory should not be the same as source \
directory for the alternate build mechanism. Create a separate build \
directory and run again, e.g. mkdir grass-build; cd grass-build; ../configure \
(see mk/README)]);
  else
    SC_ENABLE_SHARED
  fi
fi

in configure.in.
Perhaps there is something wrong with the second line above (not
portable)?

I suppose that it's possible that $SRCDIR and $DSTDIR could refer to
the same directory without being identical, although this seems
unlikely.

Both SRCDIR and DSTDIR are set from the output from $pwd, which is set
using AC_PATH_PROG, and so should contain the full path to the "pwd"
executable. I can't see how the "pwd" program could return different
strings for the same directory.

OTOH, if AC_PATH_PROG failed (which seems pretty unlikely), $pwd would
default to just "pwd", which may refer to a shell built-in, which can
return different strings for the same directory (e.g. if there are any
symlinks involved).

An alternative approach would be to check for the existence of a known
file. E.g. if $DSTDIR/configure exists, you're probably trying to
build in the source directory.

In general I thought with the alternate build system it must be run from a
separate build directory.

AFAIK, it will work if run from within the source directory. However,
it doesn't have a working "clean" target; it doesn't need one: you can
just run "rm -rf" on the build directory. But you certainly don't want
to do that if $SRCDIR == $DSTDIR.

That was also why I copied the error.log file
back to the top level source directory as the POST_INSTALL.sh script
looked for it there. Again, the contents of POST_INSTALL.sh could be
duplicated in mk/Makefile.in but I didn't want to change more things than
I had to to make it work.

Alternatively, pass $DSTDIR to POST_INSTALL.sh and have it look for
$DSTDIR/error.log.

I removed the copying of error.log because the alternate build
mechanism isn't supposed to require write access to the source
directory (e.g. to allow building from a source tree which resides on
a read-only NFS export).

Perhaps it would be nice if the alternate build system could create its
own build directory automatically if it detects it is being run from the
top-level of the source. I thought about this but decided that was being
too clever.

That's my feeling too. That would require configure to choose a build
directory. The directory would definitely have to be writable, and
ideally would have to be on a filesystem with sufficient free space,
and it probably shouldn't choose the directory which you used last
time in case you still wanted to keep that build around (another
reason for the alternate build system was to support keeping multiple
builds around for the same architecture).

It is worth tidying it up though but I was under the impression that with
the alternate build system we really should use a separate build
directory (and that is how I tested it).

That was the idea.

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