[GRASS-windows] Compiling grass7 on msys/mingw?

16 messages Options
Embed this post
Permalink
Colin Nielsen

[GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
I compiled my own grass 6.3 long ago using the steps provided by Marco
Pasetti using the following:
./configure  --prefix=/usr/local --with-includes=/usr/local/include
--with-libs=/usr/local/lib --disable-x11 --without-jpeg --without-x
--with-cxx --enable-shared --enable-largefile --with-opengl=windows
--with-fftw --with-freetype --with-proj-share=/usr/local/share/proj
--with-gdal=/usr/local/bin/gdal-config --with-tcltk
--with-tcltk-includes=/usr/local/tcl-tk/include
--with-tcltk-libs=/usr/local/tcl-tk/bin --with-sqlite
--with-sqlite-includes=/usr/local/sqlite/include
--with-sqlite-libs=/usr/local/sqlite/lib --with-postgres
--with-postgres-includes=/usr/local/pgsql/include
--with-postgres-libs=/usr/local/pgsql/lib

This worked well although as I remember I made a modification or two
from the original instructions. So now with the same instructions I'm
trying to compile grass7. It stops when it hits an error on XDR:
checking for xdrmem_create... no
checking for xdrmem_create in -lsun... no
checking for xdrmem_create in -lnsl... no
checking for xdrmem_create in -lrpclib... no
checking for xdrmem_create in -lxdr... no
configure: error: *** Unable to locate XDR functions.

I originally installed the "xdr-4.0-mingw2" package and also just
tried "sunrpc-4.0-bin" as I saw on a list somewhere but neither seem
to fix it. In /usr/local/include/rpc there is xdr.h but for some
reason configure isn't finding it. Any advice? Are there other reasons
I should give up on a grass7 build that I'm not aware of? Thanks.

-Colin
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Moritz Lennert

Re: [GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
On 17/12/08 19:17, Colin Nielsen wrote:

> I compiled my own grass 6.3 long ago using the steps provided by Marco
> Pasetti using the following:
> ./configure  --prefix=/usr/local --with-includes=/usr/local/include
> --with-libs=/usr/local/lib --disable-x11 --without-jpeg --without-x
> --with-cxx --enable-shared --enable-largefile --with-opengl=windows
> --with-fftw --with-freetype --with-proj-share=/usr/local/share/proj
> --with-gdal=/usr/local/bin/gdal-config --with-tcltk
> --with-tcltk-includes=/usr/local/tcl-tk/include
> --with-tcltk-libs=/usr/local/tcl-tk/bin --with-sqlite
> --with-sqlite-includes=/usr/local/sqlite/include
> --with-sqlite-libs=/usr/local/sqlite/lib --with-postgres
> --with-postgres-includes=/usr/local/pgsql/include
> --with-postgres-libs=/usr/local/pgsql/lib
>
> This worked well although as I remember I made a modification or two
> from the original instructions. So now with the same instructions I'm
> trying to compile grass7. It stops when it hits an error on XDR:
> checking for xdrmem_create... no
> checking for xdrmem_create in -lsun... no
> checking for xdrmem_create in -lnsl... no
> checking for xdrmem_create in -lrpclib... no
> checking for xdrmem_create in -lxdr... no
> configure: error: *** Unable to locate XDR functions.
>
> I originally installed the "xdr-4.0-mingw2" package and also just
> tried "sunrpc-4.0-bin" as I saw on a list somewhere but neither seem
> to fix it. In /usr/local/include/rpc there is xdr.h but for some
> reason configure isn't finding it. Any advice? Are there other reasons
> I should give up on a grass7 build that I'm not aware of? Thanks.

XDR has repeatedly been a problem under windows. Try this (from
http://www.stjohnspoint.co.uk/grass/README.extralibs)

xdrlib
------

xdr-4.0-mingw2
http://wiki.qgis.org/qgiswiki/BuildingWindowsBinaryOnLinux?action=AttachFile&do=get&target=xdr-4.0-mingw2.tar.gz
(special stripped-down version with networking code removed)

Copy in the config.guess file from the GRASS distribution.
CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" LDFLAGS=-s ./configure
--prefix=/c/grass/extra
make
make install
(Must compile this as a static library because of obscure problems with
shared)


Marco, maybe you could update
http://www.webalice.it/marco.pasetti/grass/BuildFromSource.html#Xdr to
reflect this better ? Or have you been able to do this differently ?

Moritz
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Colin Nielsen

Re: [GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
> Copy in the config.guess file from the GRASS distribution.
> CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" LDFLAGS=-s ./configure
> --prefix=/c/grass/extra
> make
> make install
> (Must compile this as a static library because of obscure problems with
> shared)

No luck on that. I got the file (same as I had already) copied the
config.guess from the grass_trunk folder into the xdr folder and ran
the config line (modified to --prefix=/usr/local/ since that's where
the other ones have been install to). make and make install seem to be
fine:
$ make ; make install
make: Nothing to be done for `all'.
Creating RPC header directory
mkdir -p /usr/local//include/rpc && \
        chmod 755 /usr/local//include/rpc
Installing XDR header files
set -x;for i in rpc/types.h rpc/xdr.h ; do \
        (install -c -m 644 $i /usr/local//include/rpc) done
+ install -c -m 644 rpc/types.h /usr/local//include/rpc
+ install -c -m 644 rpc/xdr.h /usr/local//include/rpc
Installing XDR library
install -c -m 644 libxdr.a /usr/local//lib
ranlib /usr/local//lib/libxdr.a

But then the same error came up when I tried to configure grass. Is
there any other log info I can provide to help? Thanks.

-Colin

On Wed, Dec 17, 2008 at 1:48 PM, Moritz Lennert
<[hidden email]> wrote:

> On 17/12/08 19:17, Colin Nielsen wrote:
>>
>> I compiled my own grass 6.3 long ago using the steps provided by Marco
>> Pasetti using the following:
>> ./configure  --prefix=/usr/local --with-includes=/usr/local/include
>> --with-libs=/usr/local/lib --disable-x11 --without-jpeg --without-x
>> --with-cxx --enable-shared --enable-largefile --with-opengl=windows
>> --with-fftw --with-freetype --with-proj-share=/usr/local/share/proj
>> --with-gdal=/usr/local/bin/gdal-config --with-tcltk
>> --with-tcltk-includes=/usr/local/tcl-tk/include
>> --with-tcltk-libs=/usr/local/tcl-tk/bin --with-sqlite
>> --with-sqlite-includes=/usr/local/sqlite/include
>> --with-sqlite-libs=/usr/local/sqlite/lib --with-postgres
>> --with-postgres-includes=/usr/local/pgsql/include
>> --with-postgres-libs=/usr/local/pgsql/lib
>>
>> This worked well although as I remember I made a modification or two
>> from the original instructions. So now with the same instructions I'm
>> trying to compile grass7. It stops when it hits an error on XDR:
>> checking for xdrmem_create... no
>> checking for xdrmem_create in -lsun... no
>> checking for xdrmem_create in -lnsl... no
>> checking for xdrmem_create in -lrpclib... no
>> checking for xdrmem_create in -lxdr... no
>> configure: error: *** Unable to locate XDR functions.
>>
>> I originally installed the "xdr-4.0-mingw2" package and also just
>> tried "sunrpc-4.0-bin" as I saw on a list somewhere but neither seem
>> to fix it. In /usr/local/include/rpc there is xdr.h but for some
>> reason configure isn't finding it. Any advice? Are there other reasons
>> I should give up on a grass7 build that I'm not aware of? Thanks.
>
> XDR has repeatedly been a problem under windows. Try this (from
> http://www.stjohnspoint.co.uk/grass/README.extralibs)
>
> xdrlib
> ------
>
> xdr-4.0-mingw2
> http://wiki.qgis.org/qgiswiki/BuildingWindowsBinaryOnLinux?action=AttachFile&do=get&target=xdr-4.0-mingw2.tar.gz
> (special stripped-down version with networking code removed)
>
> Copy in the config.guess file from the GRASS distribution.
> CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" LDFLAGS=-s ./configure
> --prefix=/c/grass/extra
> make
> make install
> (Must compile this as a static library because of obscure problems with
> shared)
>
>
> Marco, maybe you could update
> http://www.webalice.it/marco.pasetti/grass/BuildFromSource.html#Xdr to
> reflect this better ? Or have you been able to do this differently ?
>
> Moritz
>
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Marco Pasetti-3

Re: [GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Colin Nielsen
Hi Colin,

>I compiled my own grass 6.3 long ago using the steps provided by Marco
> Pasetti using the following:
> ./configure  --prefix=/usr/local --with-includes=/usr/local/include
> --with-libs=/usr/local/lib --disable-x11 --without-jpeg --without-x
> --with-cxx --enable-shared --enable-largefile --with-opengl=windows
> --with-fftw --with-freetype --with-proj-share=/usr/local/share/proj
> --with-gdal=/usr/local/bin/gdal-config --with-tcltk
> --with-tcltk-includes=/usr/local/tcl-tk/include
> --with-tcltk-libs=/usr/local/tcl-tk/bin --with-sqlite
> --with-sqlite-includes=/usr/local/sqlite/include
> --with-sqlite-libs=/usr/local/sqlite/lib --with-postgres
> --with-postgres-includes=/usr/local/pgsql/include
> --with-postgres-libs=/usr/local/pgsql/lib
>
> This worked well although as I remember I made a modification or two
> from the original instructions.

Are you probably following old instructions? I guess that because I see that
you disabled jpeg, while I added the jpeg support some months ago...

>So now with the same instructions I'm
> trying to compile grass7. It stops when it hits an error on XDR:
> checking for xdrmem_create... no
> checking for xdrmem_create in -lsun... no
> checking for xdrmem_create in -lnsl... no
> checking for xdrmem_create in -lrpclib... no
> checking for xdrmem_create in -lxdr... no
> configure: error: *** Unable to locate XDR functions.

The -lxdr message means that the configure is looking for the libxdr.dll
file... while XDR is currently built as static one.

> I originally installed the "xdr-4.0-mingw2" package and also just
> tried "sunrpc-4.0-bin" as I saw on a list somewhere but neither seem
> to fix it. In /usr/local/include/rpc there is xdr.h but for some
> reason configure isn't finding it. Any advice?

Yes. Follow the instructions in my building guide
(http://www.webalice.it/marco.pasetti/grass/BuildFromSource.html#Xdr) and
build XDR as static.

>Are there other reasons
> I should give up on a grass7 build that I'm not aware of?

No. But consider that in these days I'm re-designing the whole building
environment, in order to build GRASS 6.4 and 7 as a "continuous" task.
Along with that I'll release self-installers of the development builds and
I'll update the building guide.

Regards,

Marco

_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Marco Pasetti-3

Re: [GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Moritz Lennert
Hi Moritz,

> XDR has repeatedly been a problem under windows. Try this (from
> http://www.stjohnspoint.co.uk/grass/README.extralibs)
>
> xdrlib
> ------
>
> xdr-4.0-mingw2
> http://wiki.qgis.org/qgiswiki/BuildingWindowsBinaryOnLinux?action=AttachFile&do=get&target=xdr-4.0-mingw2.tar.gz
> (special stripped-down version with networking code removed)
>
> Copy in the config.guess file from the GRASS distribution.
> CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" LDFLAGS=-s
> ./configure --prefix=/c/grass/extra
> make
> make install
> (Must compile this as a static library because of obscure problems with
> shared)
>
> Marco, maybe you could update
> http://www.webalice.it/marco.pasetti/grass/BuildFromSource.html#Xdr to
> reflect this better ? Or have you been able to do this differently ?
>

The actual instruction of the guide works fine and produces a linkable
static Xdr library on 6.3.0; I'll test it on 7 soon.

The build instructions you mentioned above (from Paul, IIRC) are older than
the one in the building guide, and produces no differences in the static
library.
On the future builds I'll try to use a dymanic library instead of the static
one... maybe that could be the solution (or maybe the configure script looks
only for the dynamic libxdr but not for the static one... I don't actually
know...)

Cheers,

Marco

_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Moritz Lennert

Re: [GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Colin Nielsen
On 18/12/08 02:21, Colin Nielsen wrote:

>> Copy in the config.guess file from the GRASS distribution.
>> CFLAGS="-O2 -s" CXXFLAGS="-O2 -s" LDFLAGS=-s ./configure
>> --prefix=/c/grass/extra
>> make
>> make install
>> (Must compile this as a static library because of obscure problems with
>> shared)
>
> No luck on that. I got the file (same as I had already) copied the
> config.guess from the grass_trunk folder into the xdr folder and ran
> the config line (modified to --prefix=/usr/local/ since that's where
> the other ones have been install to). make and make install seem to be
> fine:
> $ make ; make install
> make: Nothing to be done for `all'.

make clean ?

Moritz
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Moritz Lennert

Re: [GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
In reply to this post by Marco Pasetti-3
On 18/12/08 10:43, Marco Pasetti wrote:
> The actual instruction of the guide works fine and produces a linkable
> static Xdr library on 6.3.0; I'll test it on 7 soon.

Ok. So by default (i.e. without any extra flags) it builds as static
library ?

Moritz

_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Marco Pasetti-3

Re: [GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
Moritz,


> Ok. So by default (i.e. without any extra flags) it builds as static
> library ?

Yes, correct.

Marco
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Colin Nielsen

Re: [GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
> (or maybe the configure script looks only for the dynamic libxdr but not for the static one... I don't actually know...)

So as I understand all of this, the xdr library builds as a static
library based on the instructions (ie. what I did), but the grass
configure script only searches for a dynamic library? Looking at the
config.log I think I see some reference to dynamic libraries... but
I'm not familiar enough with configure/make processes.

configure:5530: checking for xdrmem_create
configure:5556: gcc -o conftest.exe -g -O2    -I/usr/local/include
-Wl,--export-dynamic,--enable-runtime-pseudo-reloc  -L/usr/local/lib
conftest.c  1>&5
./configure: /mingw/bin/gcc: Invalid argument
configure: failed program was:
#line 5533 "configure"

If there's no easy answer to this I'll just wait for your build of
grass 7 when it comes along. Thanks.

-Colin

On Thu, Dec 18, 2008 at 7:01 AM, Marco Pasetti <[hidden email]> wrote:

> Moritz,
>
>
>> Ok. So by default (i.e. without any extra flags) it builds as static
>> library ?
>
> Yes, correct.
>
> Marco
>
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Glynn Clements

Re: [GRASS-windows] Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink

Colin Nielsen wrote:

> > (or maybe the configure script looks only for the dynamic libxdr but not for the static one... I don't actually know...)
>
> So as I understand all of this, the xdr library builds as a static
> library based on the instructions (ie. what I did), but the grass
> configure script only searches for a dynamic library?

No. The configure script just tries to link with -lxdr etc. That will
find either a static or dynamic library.

--
Glynn Clements <[hidden email]>
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Colin Nielsen

Re: Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
Finally fixed the xdr library problem by updating all dependencies and
trying again. Now configure completes fine but I get many errors on
make, several relating to a libmingw32.a WinMain@16 error.

Configured with:
./configure  --prefix=/usr/local --with-includes=/usr/local/include
--with-libs=/usr/local/lib --disable-x11 --without-x --with-cxx
--enable-shared --enable-largefile --with-opengl=windows --with-fftw
--with-freetype --with-proj-share=/usr/local/share/proj
--with-gdal=/usr/local/bin/gdal-config --with-tcltk
--with-tcltk-includes=/usr/local/tcl-tk/include
--with-tcltk-libs=/usr/local/tcl-tk/bin --with-sqlite
--with-sqlite-includes=/usr/local/sqlite/include
--with-sqlite-libs=/usr/local/sqlite/lib --with-postgres
--with-postgres-includes=/usr/local/pgsql/include
--with-postgres-libs=/usr/local/pgsql/lib --without-cairo

Errors in:
r.mapcalc
r.univar
raster3d/base
v.voronoi

Error message for above:
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0x104): undefined
reference to `WinMain@16'


Errors also in all of the /scripts/:
if [ "/usr/local/src/grass_trunk/dist.i686-pc-mingw32/scripts/db.dropcol"
!= "" ] ; then GISRC=/usr/local/src/grass_trunk/dist.i686-pc-mingw32/demolocation/.grassrc70
GISBASE=C:/MinGW/msys/local/src/grass_trunk/dist.i686-pc-mingw32
PATH="/usr/local/src/grass_trunk/dist.i686-pc-mingw32/bin:$PATH"
PYTHONPATH="/usr/local/src/grass_trunk/dist.i686-pc-mingw32/etc/python:$PYTHONPATH"
PATH="/usr/local/src/grass_trunk/dist.i686-pc-mingw32/bin:/usr/local/src/grass_trunk/dist.i686-pc-mingw32/lib:.:/usr/local/bin:/mingw/bin:/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/mingw/Python"
LC_ALL=C /usr/local/src/grass_trunk/dist.i686-pc-mingw32/scripts/db.dropcol
--html-description < /dev/null | grep -v '</body>\|</html>' >
db.dropcol.tmp.html ; fi
Traceback (most recent call last):
  File "C:/MinGW/msys/local/src/grass_trunk/dist.i686-pc-mingw32/scripts/db.dropcol",
line 50, in <module>
    import grass
ImportError: No module named grass
make: *** [db.dropcol.tmp.html] Error 1

If it's looking for the grass.py in the pythonpath, there is one there...

Thanks, I'd appreciate any help with this...
-Colin





On Thu, Dec 18, 2008 at 12:42 PM, Glynn Clements
<[hidden email]> wrote:

>
> Colin Nielsen wrote:
>
>> > (or maybe the configure script looks only for the dynamic libxdr but not for the static one... I don't actually know...)
>>
>> So as I understand all of this, the xdr library builds as a static
>> library based on the instructions (ie. what I did), but the grass
>> configure script only searches for a dynamic library?
>
> No. The configure script just tries to link with -lxdr etc. That will
> find either a static or dynamic library.
>
> --
> Glynn Clements <[hidden email]>
>
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Glynn Clements

Re: Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink

Colin Nielsen wrote:

> Errors also in all of the /scripts/:

> PYTHONPATH="/usr/local/src/grass_trunk/dist.i686-pc-mingw32/etc/python:$PYTHONPATH"

>     import grass
> ImportError: No module named grass
> make: *** [db.dropcol.tmp.html] Error 1
>
> If it's looking for the grass.py in the pythonpath, there is one there...

I suspect that Python wants PYTHONPATH to use Windows syntax, e.g.
(untested):

- PYTHONPATH="$(GISBASE)/etc/python:$$PYTHONPATH" \
+ PYTHONPATH="$(call mkpath,$(GISBASE)/etc/python,$$PYTHONPATH)" \
+
+ifneq ($(MINGW32),)
+mkpath = $(shell g.dirseps -h $(1))\;$(2)
+else
+mkpath = $(1):$(2)
+endif

MinGW transparently converts filename and path syntax for environment
variables which it knows about (e.g. PATH), but probably not for
PYTHONPATH.

--
Glynn Clements <[hidden email]>
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Colin Nielsen

Re: Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
> I suspect that Python wants PYTHONPATH to use Windows syntax, e.g.
> (untested):
>
> -       PYTHONPATH="$(GISBASE)/etc/python:$$PYTHONPATH" \
> +       PYTHONPATH="$(call mkpath,$(GISBASE)/etc/python,$$PYTHONPATH)" \
> +
> +ifneq ($(MINGW32),)
> +mkpath = $(shell g.dirseps -h $(1))\;$(2)
> +else
> +mkpath = $(1):$(2)
> +endif

I applied this to the Html.make file and tried again. I got:

$ make
if [ "/usr/local/src/grass_trunk/dist.i686-pc-mingw32/scripts/d.correlate"
!= "" ] ; then GISRC=/usr/local/src/grass_trunk/dist.i686-pc-mingw32/demolocation/.grassrc70
GISBASE=C:/MinGW/msys/local/src/grass_trunk/dist.i686-pc-mingw32
PATH="/usr/local/src/grass_trunk/dist.i686-pc-mingw32/bin:$PATH"
PYTHONPATH="/usr/local/src/grass_trunk/dist.i686-pc-mingw32/etc/python:YTHONPATH"
 ; fi
make: *** Recursive variable `PATH' references itself (eventually).  Stop.

Note the "YTHONPATH".

I then checked the variable PYTHONPATH and found that my Arc
installation over-wrote the PYTHONPATH variable to its own folder. I
changed this back to /usr/local/src/grass_trunk/lib/Python and ran it
again (with the original Html.make) and got:

$ make
if [ "/usr/local/src/grass_trunk/dist.i686-pc-mingw32/scripts/d.correlate"
!= "" ] ; then GISRC=/usr/local/src/grass_trunk/dist.i686-pc-mingw32/demolocation/.grassrc70
GISBASE=C:/MinGW/msys/local/src/grass_trunk/dist.i686-pc-mingw32
PATH="/usr/local/src/grass_trunk/dist.i686-pc-mingw32/bin:$PATH"
PYTHONPATH="/usr/local/src/grass_trunk/dist.i686-pc-mingw32/etc/python:$PYTHONPATH"
PATH="/usr/local/src/grass_trunk/dist.i686-pc-mingw32/bin:/usr/local/src/grass_trunk/dist.i686-pc-mingw32/lib:.:/usr/local/bin:/mingw/bin:/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/mingw/Python"
LC_ALL=C /usr/local/src/grass_trunk/dist.i686-pc-mingw32/scripts/d.correlate
--html-description < /dev/null | grep -v '</body>\|</html>' >
d.correlate.tmp.html ; fi
Traceback (most recent call last):
  File "C:/MinGW/msys/local/src/grass_trunk/dist.i686-pc-mingw32/scripts/d.correlate",
line 103, in <module>
    options, flags = grass.parser()
  File "C:\MinGW\msys\local\src\grass_trunk\dist.i686-pc-mingw32\etc\python\grass.py",
line 208, in parser
    os.execvp("g.parser", [name] + argv)
  File "C:\MinGW\Python\lib\os.py", line 353, in execvp
    _execvpe(file, args)
  File "C:\MinGW\Python\lib\os.py", line 389, in _execvpe
    func(fullname, *argrest)
OSError: [Errno 2] No such file or directory
make: *** [d.correlate.tmp.html] Error 1
rm d.correlate.tmp.html

Before I continue with this, is this some peculiarity with my
installation or a more general problem with grass7 on mingw/msys?

Thanks for the help,
-Colin
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Glynn Clements

Re: Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink

Colin Nielsen wrote:

> > I suspect that Python wants PYTHONPATH to use Windows syntax, e.g.
> > (untested):
> >
> > -       PYTHONPATH="$(GISBASE)/etc/python:$$PYTHONPATH" \
> > +       PYTHONPATH="$(call mkpath,$(GISBASE)/etc/python,$$PYTHONPATH)" \
> > +
> > +ifneq ($(MINGW32),)
> > +mkpath = $(shell g.dirseps -h $(1))\;$(2)
> > +else
> > +mkpath = $(1):$(2)
> > +endif
>
> I applied this to the Html.make file and tried again. I got:
[snip]

If you apply the above as-is, you will get this error. The htmldesc=
definition needs to be a contiguous block, and the ifneq...endif block
needs to follow it.

I have attached a complete, modified Html.make file to avoid
confusion. This has at least been tested on Linux.

> I then checked the variable PYTHONPATH and found that my Arc
> installation over-wrote the PYTHONPATH variable to its own folder. I
> changed this back to /usr/local/src/grass_trunk/lib/Python and ran it
> again (with the original Html.make) and got:

>     os.execvp("g.parser", [name] + argv)
>   File "C:\MinGW\Python\lib\os.py", line 353, in execvp
>     _execvpe(file, args)
>   File "C:\MinGW\Python\lib\os.py", line 389, in _execvpe
>     func(fullname, *argrest)
> OSError: [Errno 2] No such file or directory

Ugh. I suspect os.execvp() needs "g.parser.exe" rather than
"g.parser". On Windows, only the higher-level interfaces (e.g.
ShellExecute() or "cmd /c ...") allow the .exe (or .bat etc) extension
to be omitted.

On Windows, we might want to use subprocess.Popen(shell=True) followed
by sys.exit() instead of os.execvp().

> Before I continue with this, is this some peculiarity with my
> installation or a more general problem with grass7 on mingw/msys?

The latter.

7.0 is quite fluid, and it doesn't seem to be getting much testing on
Windows (6.x doesn't get much testing either, but then 6.x isn't being
substantially rewritten).

--
Glynn Clements <[hidden email]>



# generic html rules for all commands

ifdef CROSS_COMPILING

html:

else

htmldesc = \
        GISRC=$(RUN_GISRC) \
        GISBASE=$(RUN_GISBASE) \
        PATH="$(BIN):$$PATH" \
        PYTHONPATH="$(call mkpath,$(GISBASE)/etc/python,$$PYTHONPATH)" \
        $(LD_LIBRARY_PATH_VAR)="$(BIN):$(ARCH_LIBDIR):$($(LD_LIBRARY_PATH_VAR))" \
        LC_ALL=C \
        $(1) --html-description < /dev/null | grep -v '</body>\|</html>' > $(2)

ifneq ($(MINGW32),)
mkpath = $(shell g.dirseps -h $(1))\;$(2)
else
mkpath = $(1):$(2)
endif

$(HTMLDIR)/%.html: %.html %.tmp.html $(HTMLSRC)
        -test -d $(HTMLDIR) || $(MKDIR) $(HTMLDIR)
        $(MODULE_TOPDIR)/tools/mkhtml.sh $* > $@
        -for file in  *.png *.jpg ; do \
                head -n 1 $$file | grep '^\#!' > /dev/null ; \
                if [ $$? -ne 0 ] ; then \
                   $(INSTALL_DATA) $$file $(HTMLDIR) ; \
                fi \
                done 2> /dev/null ; true

$(MANDIR)/%.$(MANSECT): $(HTMLDIR)/%.html
        $(HTML2MAN) $< $@

%.tmp.html: $(HTMLSRC)
        if [ "$(HTMLSRC)" != "" ] ; then $(call htmldesc,$<,$@) ; fi

html: $(HTMLDIR)/$(PGM).html $(MANDIR)/$(PGM).$(MANSECT)

endif

.PHONY: html

_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Colin Nielsen

Re: Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink
Glynn,

> I have attached a complete, modified Html.make file to avoid
> confusion. This has at least been tested on Linux.

> Ugh. I suspect os.execvp() needs "g.parser.exe" rather than
> "g.parser". On Windows, only the higher-level interfaces (e.g.
> ShellExecute() or "cmd /c ...") allow the .exe (or .bat etc) extension
> to be omitted.

Thanks for the help. You were right on both counts. I added the new
Html.make and edited the grass.py line 208 to:
     os.execvp("g.parser.exe", [name] + argv)

That works too, the scripts compile perfectly now. Although I realize
that some work around will be needed to make it OS generic.

Any idea why I get the other error for r.mapcalc, r.univar,
raster3d/base and v.voronoi?

gcc -L/usr/local/src/grass_trunk/dist.i686-pc-mingw32/lib
-Wl,--export-dynamic,--enable-runtime-pseudo-reloc  -L/usr/local/lib
-L/usr/local/pgsql/lib  -o
/usr/local/src/grass_trunk/dist.i686-pc-mingw32/bin/r.mapcalc.exe
../../lib/gis/OBJ.i686-pc-mingw32/fmode.o -lgrass_gis -lgrass_datetime
-lxdr -liberty -lws2_32    -lz     -lgrass_btree        -lxdr -liberty
-lws2_32    -lz
/mingw/lib/libmingw32.a(main.o):main.c:(.text+0x104): undefined
reference to `WinMain@16'
collect2: ld returned 1 exit status
make: *** [/usr/local/src/grass_trunk/dist.i686-pc-mingw32/bin/r.mapcalc.exe]
Error 1

> 7.0 is quite fluid, and it doesn't seem to be getting much testing on
> Windows (6.x doesn't get much testing either, but then 6.x isn't being
> substantially rewritten).
>

I am happy to test / keep posting errors for grass70 and grass64 as I
use grass in Windows Vista regularly. Let me know if there is anything
specific I should be testing/ looking for.

-Colin
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows
Glynn Clements

Re: Compiling grass7 on msys/mingw?

Reply Threaded More More options
Print post
Permalink

Colin Nielsen wrote:

> Any idea why I get the other error for r.mapcalc, r.univar,
> raster3d/base and v.voronoi?

Not exactly, but I'm fairly sure that it's related to the fact that
those four directories are the only ones which use Multi.make (used
when building more than one module from a single directory).

> gcc -L/usr/local/src/grass_trunk/dist.i686-pc-mingw32/lib
> -Wl,--export-dynamic,--enable-runtime-pseudo-reloc  -L/usr/local/lib
> -L/usr/local/pgsql/lib  -o
> /usr/local/src/grass_trunk/dist.i686-pc-mingw32/bin/r.mapcalc.exe
> ../../lib/gis/OBJ.i686-pc-mingw32/fmode.o -lgrass_gis -lgrass_datetime
> -lxdr -liberty -lws2_32    -lz     -lgrass_btree        -lxdr -liberty
> -lws2_32    -lz
> /mingw/lib/libmingw32.a(main.o):main.c:(.text+0x104): undefined
> reference to `WinMain@16'
> collect2: ld returned 1 exit status
> make: *** [/usr/local/src/grass_trunk/dist.i686-pc-mingw32/bin/r.mapcalc.exe]
> Error 1

Well, there are no object files except for fmode.o (which is added to
all executables to cause open() to use binary mode rather than text
mode).

The linking rule for a module in Module.make is:

        $(BIN)/$(PGM)$(EXE): $(ARCH_OBJS) $(DEPENDENCIES)
                $(call linker)

Multi.make splits this into two parts:

        $(BIN)/%$(EXE): $(DEPENDENCIES)
                $(call linker)
and:
        $(BIN)/$(1)$(EXE): $$(patsubst %.o,$(OBJDIR)/%.o,$$($$(subst .,_,$(1)_OBJS)))

The first is a pattern rule, and the second is part of an $(eval ...)
template which is instantiated for each module.

The prerequisites are supposed to be merged, but either this isn't
happening, or something is causing the template to come up empty.

I'm not sure if it's a flaw in the MSys version of make, or there's a
flaw in the rule related to $(EXE) (which will be empty on platforms
other than Windows).

Can you try the following:

        make -d -p -C raster/r.mapcalc &> out.log
        gzip out.log

and send me the resulting out.log.gz file?

--
Glynn Clements <[hidden email]>
_______________________________________________
grass-windows mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/grass-windows