[GRASS-dev] GRASS 6.5 GEOS build fails

hi,

any clue how to compile 6.5 with GEOS support? Vlib fails:

[neteler@localhost Vlib]$ make
gcc -shared -o /home/neteler/grass65/dist.x86_64-unknown-linux-gnu/lib/libgrass_vect.6.5.svn.so
-L/home/neteler/grass65/dist.x86_64-unknown-linux-gnu/lib
-Wl,--no-undefined -Wl,--export-dynamic -L/usr/lib64
-Wl,-rpath-link,/home/neteler/grass65/dist.x86_64-unknown-linux-gnu/lib
   OBJ.x86_64-unknown-linux-gnu/area.o
OBJ.x86_64-unknown-linux-gnu/array.o
OBJ.x86_64-unknown-linux-gnu/box.o
OBJ.x86_64-unknown-linux-gnu/break_lines.o
OBJ.x86_64-unknown-linux-gnu/break_polygons.o
OBJ.x86_64-unknown-linux-gnu/bridges.o
OBJ.x86_64-unknown-linux-gnu/buffer2.o
OBJ.x86_64-unknown-linux-gnu/buffer.o
OBJ.x86_64-unknown-linux-gnu/build.o
OBJ.x86_64-unknown-linux-gnu/build_nat.o
OBJ.x86_64-unknown-linux-gnu/build_ogr.o
OBJ.x86_64-unknown-linux-gnu/cats.o
OBJ.x86_64-unknown-linux-gnu/cindex.o
OBJ.x86_64-unknown-linux-gnu/clean_nodes.o
OBJ.x86_64-unknown-linux-gnu/close.o
OBJ.x86_64-unknown-linux-gnu/close_nat.o
OBJ.x86_64-unknown-linux-gnu/close_ogr.o
OBJ.x86_64-unknown-linux-gnu/constraint.o
OBJ.x86_64-unknown-linux-gnu/dangles.o
OBJ.x86_64-unknown-linux-gnu/dbcolumns.o
OBJ.x86_64-unknown-linux-gnu/dgraph.o
OBJ.x86_64-unknown-linux-gnu/e_intersect.o
OBJ.x86_64-unknown-linux-gnu/error.o
OBJ.x86_64-unknown-linux-gnu/field.o
OBJ.x86_64-unknown-linux-gnu/find.o
OBJ.x86_64-unknown-linux-gnu/geos.o
OBJ.x86_64-unknown-linux-gnu/graph.o
OBJ.x86_64-unknown-linux-gnu/header.o
OBJ.x86_64-unknown-linux-gnu/hist.o
OBJ.x86_64-unknown-linux-gnu/init_head.o
OBJ.x86_64-unknown-linux-gnu/intersect.o
OBJ.x86_64-unknown-linux-gnu/legal_vname.o
OBJ.x86_64-unknown-linux-gnu/level.o
OBJ.x86_64-unknown-linux-gnu/level_two.o
OBJ.x86_64-unknown-linux-gnu/line.o
OBJ.x86_64-unknown-linux-gnu/list.o OBJ.x86_64-unknown-linux-gnu/map.o
OBJ.x86_64-unknown-linux-gnu/net.o OBJ.x86_64-unknown-linux-gnu/open.o
OBJ.x86_64-unknown-linux-gnu/open_nat.o
OBJ.x86_64-unknown-linux-gnu/open_ogr.o
OBJ.x86_64-unknown-linux-gnu/overlap.o
OBJ.x86_64-unknown-linux-gnu/overlay.o
OBJ.x86_64-unknown-linux-gnu/poly.o
OBJ.x86_64-unknown-linux-gnu/read.o
OBJ.x86_64-unknown-linux-gnu/read_nat.o
OBJ.x86_64-unknown-linux-gnu/read_ogr.o
OBJ.x86_64-unknown-linux-gnu/remove_areas.o
OBJ.x86_64-unknown-linux-gnu/remove_duplicates.o
OBJ.x86_64-unknown-linux-gnu/rewind.o
OBJ.x86_64-unknown-linux-gnu/rewind_nat.o
OBJ.x86_64-unknown-linux-gnu/rewind_ogr.o
OBJ.x86_64-unknown-linux-gnu/select.o
OBJ.x86_64-unknown-linux-gnu/sindex.o
OBJ.x86_64-unknown-linux-gnu/snap.o OBJ.x86_64-unknown-linux-gnu/tin.o
OBJ.x86_64-unknown-linux-gnu/type.o
OBJ.x86_64-unknown-linux-gnu/window.o
OBJ.x86_64-unknown-linux-gnu/write.o
OBJ.x86_64-unknown-linux-gnu/write_nat.o -lgrass_gis -lgrass_datetime
-lz -lgrass_dig2 -lgrass_gis -lgrass_datetime -lz
-lgrass_rtree -lgrass_dgl -lgrass_rtree -lgrass_linkm
-lgrass_dbmiclient -lgrass_dbmibase -lgrass_gis -lgrass_datetime -lz
   -lgrass_gis -lgrass_datetime -lz -lgrass_dbmibase -lgrass_gis
-lgrass_datetime -lz -L/usr/local/lib -lgdal -lm -L/usr/lib64
-lgeos && \
        (cd /home/neteler/grass65/dist.x86_64-unknown-linux-gnu/lib;
ln -f -s libgrass_vect.6.5.svn.so
/home/neteler/grass65/dist.x86_64-unknown-linux-gnu/lib/libgrass_vect.so)
/usr/bin/ld: Dwarf Error: Offset (1083) greater than or equal to
.debug_str size (314).
OBJ.x86_64-unknown-linux-gnu/geos.o: In function
`Vect_read_area_geos':
/home/neteler/grass65/lib/vector/Vlib/geos.c:90: undefined reference
to `GEOSGeom_createLinearRing'
/home/neteler/grass65/lib/vector/Vlib/geos.c:104: undefined reference
to `GEOSGeom_createLinearRing'
/home/neteler/grass65/lib/vector/Vlib/geos.c:110: undefined reference
to `GEOSGeom_createPolygon'
OBJ.x86_64-unknown-linux-gnu/geos.o: In function `Vect_line_to_geos':
/home/neteler/grass65/lib/vector/Vlib/geos.c:155: undefined reference
to `GEOSCoordSeq_create'
/home/neteler/grass65/lib/vector/Vlib/geos.c:158: undefined reference
to `GEOSCoordSeq_setX'
/home/neteler/grass65/lib/vector/Vlib/geos.c:159: undefined reference
to `GEOSCoordSeq_setY'
/home/neteler/grass65/lib/vector/Vlib/geos.c:161: undefined reference
to `GEOSCoordSeq_setZ'
/home/neteler/grass65/lib/vector/Vlib/geos.c:165: undefined reference
to `GEOSGeom_createPoint'
/home/neteler/grass65/lib/vector/Vlib/geos.c:167: undefined reference
to `GEOSGeom_createLineString'
/home/neteler/grass65/lib/vector/Vlib/geos.c:169: undefined reference
to `GEOSGeom_createLineString'
/home/neteler/grass65/lib/vector/Vlib/geos.c:170: undefined reference
to `GEOSisRing'
/home/neteler/grass65/lib/vector/Vlib/geos.c:172: undefined reference
to `GEOSGeom_createLinearRing'
OBJ.x86_64-unknown-linux-gnu/geos.o: In function
`Vect__read_line_geos':
/home/neteler/grass65/lib/vector/Vlib/geos.c:208: undefined reference
to `GEOSGeom_createPoint'
/home/neteler/grass65/lib/vector/Vlib/geos.c:212: undefined reference
to `GEOSGeom_createLineString'
/home/neteler/grass65/lib/vector/Vlib/geos.c:215: undefined reference
to `GEOSGeom_createLineString'
/home/neteler/grass65/lib/vector/Vlib/geos.c:216: undefined reference
to `GEOSisRing'
/home/neteler/grass65/lib/vector/Vlib/geos.c:218: undefined reference
to `GEOSGeom_createLinearRing'
OBJ.x86_64-unknown-linux-gnu/geos.o: In function `V1_read_line_geos':
/home/neteler/grass65/lib/vector/Vlib/geos.c:302: undefined reference
to `GEOSCoordSeq_create'
/home/neteler/grass65/lib/vector/Vlib/geos.c:314: undefined reference
to `GEOSCoordSeq_create'
/home/neteler/grass65/lib/vector/Vlib/geos.c:348: undefined reference
to `GEOSCoordSeq_create'
/home/neteler/grass65/lib/vector/Vlib/geos.c:370: undefined reference
to `GEOSCoordSeq_setX'
/home/neteler/grass65/lib/vector/Vlib/geos.c:371: undefined reference
to `GEOSCoordSeq_setY'
/home/neteler/grass65/lib/vector/Vlib/geos.c:373: undefined reference
to `GEOSCoordSeq_setZ'
OBJ.x86_64-unknown-linux-gnu/geos.o: In function
`read_polygon_points':
/home/neteler/grass65/lib/vector/Vlib/geos.c:474: undefined reference
to `GEOSCoordSeq_getSize'
/home/neteler/grass65/lib/vector/Vlib/geos.c:480: undefined reference
to `GEOSCoordSeq_create'
/home/neteler/grass65/lib/vector/Vlib/geos.c:483: undefined reference
to `GEOSCoordSeq_getSize'
/home/neteler/grass65/lib/vector/Vlib/geos.c:486: undefined reference
to `GEOSCoordSeq_getX'
/home/neteler/grass65/lib/vector/Vlib/geos.c:487: undefined reference
to `GEOSCoordSeq_setX'
/home/neteler/grass65/lib/vector/Vlib/geos.c:489: undefined reference
to `GEOSCoordSeq_getY'
/home/neteler/grass65/lib/vector/Vlib/geos.c:490: undefined reference
to `GEOSCoordSeq_setY'
/home/neteler/grass65/lib/vector/Vlib/geos.c:493: undefined reference
to `GEOSCoordSeq_getY'
/home/neteler/grass65/lib/vector/Vlib/geos.c:494: undefined reference
to `GEOSCoordSeq_setZ'
/home/neteler/grass65/lib/vector/Vlib/geos.c:500: undefined reference
to `GEOSCoordSeq_getX'
/home/neteler/grass65/lib/vector/Vlib/geos.c:501: undefined reference
to `GEOSCoordSeq_setX'
/home/neteler/grass65/lib/vector/Vlib/geos.c:503: undefined reference
to `GEOSCoordSeq_getY'
/home/neteler/grass65/lib/vector/Vlib/geos.c:504: undefined reference
to `GEOSCoordSeq_setY'
/home/neteler/grass65/lib/vector/Vlib/geos.c:507: undefined reference
to `GEOSCoordSeq_getY'
/home/neteler/grass65/lib/vector/Vlib/geos.c:508: undefined reference
to `GEOSCoordSeq_setZ'
collect2: ld returned 1 exit status
make: *** [/home/neteler/grass65/dist.x86_64-unknown-linux-gnu/lib/libgrass_vect.6.5.svn.so]
Error 1

I am using
lib64geos3-3.0.3-1mdv2009.1
lib64geos_c1-3.0.3-1mdv2009.1
lib64geos-devel-3.0.3-1mdv2009.1

?
Markus

On 25/07/09 16:30, Markus Neteler wrote:

hi,

any clue how to compile 6.5 with GEOS support? Vlib fails:

What did you feed configure ? It should be something like this:

--with-geos=/usr/bin/geos-config

This works for me with libgeos-3.0.0.

Moritz

Moritz Lennert wrote:

> any clue how to compile 6.5 with GEOS support? Vlib fails:

What did you feed configure ? It should be something like this:

--with-geos=/usr/bin/geos-config

This works for me with libgeos-3.0.0.

Ah. With geos-2.2.3, the configure checks pass, but the build fails.

The GEOS configure checks should actually do some checking. Apart from
the version issue, there's no LOC_CHECK_LIBS or similar, so the checks
will pass even if the library is entirely absent.

LOC_CHECK_LIBS checks for a specific symbol, so it should be
straightforward to check for a symbol which is only present in 3.x.

--
Glynn Clements <glynn@gclements.plus.com>

On Tue, Jul 28, 2009 at 5:18 PM, Glynn Clements<glynn@gclements.plus.com> wrote:

Moritz Lennert wrote:

> any clue how to compile 6.5 with GEOS support? Vlib fails:

What did you feed configure ? It should be something like this:

--with-geos=/usr/bin/geos-config

This works for me with libgeos-3.0.0.

Ah. With geos-2.2.3, the configure checks pass, but the build fails.

The GEOS configure checks should actually do some checking. Apart from
the version issue, there's no LOC_CHECK_LIBS or similar, so the checks
will pass even if the library is entirely absent.

LOC_CHECK_LIBS checks for a specific symbol, so it should be
straightforward to check for a symbol which is only present in 3.x.

Something like this?
[neteler@localhost grass70]$ svn diff configure.in
Index: configure.in

--- configure.in (revision 38604)
+++ configure.in (working copy)
@@ -761,7 +761,7 @@
   fi

   LOC_CHECK_INCLUDES(geos_c.h,GEOS,$GEOS_CFLAGS)
-
+ LOC_CHECK_LIBS(geos,GEOSGeom_createLinearRing,GEOS,$GEOS_CFLAGS,$GEOS_LIBS,)
   AC_DEFINE(HAVE_GEOS)
fi

It generates:
cat config.log
....
configure:7637: checking whether to use GEOS
configure:7654: checking for geos-config
configure:7702: checking for geos_c.h
configure:7710: gcc -E -I/usr/include conftest.c >/dev/null 2>conftest.out
configure:7745: checking for GEOSGeom_createLinearRing in -lgeos
configure:7762: gcc -o conftest -g -Wall
-Werror-implicit-function-declaration -fno-common -mtune=nocona -m64
-minline-all-stringops -I/usr/include -Wl,--no-undefined
-Wl,--export-dynamic -L/usr/lib64 conftest.c -lgeos 1>&5
/home/neteler/tmp/cckqk93a.o: In function `main':
/home/neteler/grass70/configure:7758: undefined reference to
`GEOSGeom_createLinearRing'
collect2: ld returned 1 exit status
...

(still no solution to the original problem:
perhaps my much liked "-Werror-implicit-function-declaration" is the problem?)

Markus

Markus Neteler wrote:

> LOC_CHECK_LIBS checks for a specific symbol, so it should be
> straightforward to check for a symbol which is only present in 3.x.

Something like this?
[neteler@localhost grass70]$ svn diff configure.in

+ LOC_CHECK_LIBS(geos,GEOSGeom_createLinearRing,GEOS,$GEOS_CFLAGS,$GEOS_LIBS,)

Probably:

  LOC_CHECK_LIBS(geos,GEOSGeom_createLinearRing,GEOS,$GEOS_LIBS,GEOS_LIBS)

(still no solution to the original problem:
perhaps my much liked "-Werror-implicit-function-declaration" is the problem?)

Your original problem appears to be that you don't have a compatible
version of GEOS installed. It's compiling okay, so it looks like the
headers are compatible but the library isn't. Maybe a problem with
32-bit and 64-bit libraries?

--
Glynn Clements <glynn@gclements.plus.com>

On Mon, Aug 3, 2009 at 8:19 PM, Glynn Clements<glynn@gclements.plus.com> wrote:

Markus Neteler wrote:

> LOC_CHECK_LIBS checks for a specific symbol, so it should be
> straightforward to check for a symbol which is only present in 3.x.

Something like this?
[neteler@localhost grass70]$ svn diff configure.in

+ LOC_CHECK_LIBS(geos,GEOSGeom_createLinearRing,GEOS,$GEOS_CFLAGS,$GEOS_LIBS,)

Probably:

   LOC\_CHECK\_LIBS\(geos,GEOSGeom\_createLinearRing,GEOS,$GEOS\_LIBS,GEOS\_LIBS\)

Ok but same effect.

(still no solution to the original problem:
perhaps my much liked "-Werror-implicit-function-declaration" is the problem?)

Your original problem appears to be that you don't have a compatible
version of GEOS installed. It's compiling okay, so it looks like the
headers are compatible but the library isn't. Maybe a problem with
32-bit and 64-bit libraries?

[neteler@localhost grass70]$ /usr/bin/geos-config --libs
-L/usr/lib64 -lgeos

[neteler@localhost grass70]$ ldd /usr/lib64/libgeos.so
        linux-vdso.so.1 => (0x00007fff2e1fe000)
        libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007ff225a52000)
        libm.so.6 => /lib64/libm.so.6 (0x00007ff2257ce000)
        libc.so.6 => /lib64/libc.so.6 (0x00007ff22546b000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007ff225255000)
        /lib64/ld-linux-x86-64.so.2 (0x00007ff2260ca000)

[neteler@localhost grass70]$ file /usr/lib64/libgeos.so
/usr/lib64/libgeos.so: symbolic link to `libgeos-3.0.3.so'

[neteler@localhost grass70]$ file /usr/lib64/libgeos-3.0.3.so
/usr/lib64/libgeos-3.0.3.so: ELF 64-bit LSB shared object, x86-64,
version 1 (SYSV), dynamically linked, stripped

The RPM looks ok but I'll recompile it from the source tarball.

Markus

On Mon, Aug 3, 2009 at 8:19 PM, Glynn Clements<glynn@gclements.plus.com> wrote:

Markus Neteler wrote:

> LOC_CHECK_LIBS checks for a specific symbol, so it should be
> straightforward to check for a symbol which is only present in 3.x.

Something like this?
[neteler@localhost grass70]$ svn diff configure.in

+ LOC_CHECK_LIBS(geos,GEOSGeom_createLinearRing,GEOS,$GEOS_CFLAGS,$GEOS_LIBS,)

Probably:

   LOC\_CHECK\_LIBS\(geos,GEOSGeom\_createLinearRing,GEOS,$GEOS\_LIBS,GEOS\_LIBS\)

I have submitted that.

Locally it fails for me, according to config.log the following line is missing:
#include <geos_c.h>

If I extract the test manually, it find the function GEOSGeom_createLinearRing()
but complains about:

gcc -o conftest -g -Wall -Werror-implicit-function-declaration
-fno-common -mtune=nocona -m64 -minline-all-stringops
-L/usr/local/lib -lgeos -Wl,--no-undefined -Wl,--export-dynamic
-L/usr/lib64 conftest.c -lgeos
conftest.c:7: error: conflicting types for ‘GEOSGeom_createLinearRing’
/usr/local/include/geos_c.h:237: error: previous declaration of
‘GEOSGeom_createLinearRing’ was here

In /usr/local/include/geos_c.h it is
extern GEOSGeometry GEOS_DLL *GEOSGeom_createLinearRing(GEOSCoordSequence* s);

but in conftest.c it is:
char GEOSGeom_createLinearRing();

No idea how to fix the test in configure.in.

Markus

Markus Neteler wrote:

>> > LOC_CHECK_LIBS checks for a specific symbol, so it should be
>> > straightforward to check for a symbol which is only present in 3.x.
>>
>> Something like this?
>> [neteler@localhost grass70]$ svn diff configure.in
>
>> + LOC_CHECK_LIBS(geos,GEOSGeom_createLinearRing,GEOS,$GEOS_CFLAGS,$GEOS_LIBS,)
>
> Probably:
>
> LOC_CHECK_LIBS(geos,GEOSGeom_createLinearRing,GEOS,$GEOS_LIBS,GEOS_LIBS)

I have submitted that.

Locally it fails for me, according to config.log the following line is missing:
#include <geos_c.h>

That line isn't supposed to be there.

If I extract the test manually, it find the function GEOSGeom_createLinearRing()
but complains about:

gcc -o conftest -g -Wall -Werror-implicit-function-declaration
-fno-common -mtune=nocona -m64 -minline-all-stringops
-L/usr/local/lib -lgeos -Wl,--no-undefined -Wl,--export-dynamic
-L/usr/lib64 conftest.c -lgeos
conftest.c:7: error: conflicting types for �GEOSGeom_createLinearRing�
/usr/local/include/geos_c.h:237: error: previous declaration of
�GEOSGeom_createLinearRing� was here

In /usr/local/include/geos_c.h it is
extern GEOSGeometry GEOS_DLL *GEOSGeom_createLinearRing(GEOSCoordSequence* s);

but in conftest.c it is:
char GEOSGeom_createLinearRing();

No idea how to fix the test in configure.in.

Library checks merely check that the function is exported by the
library. The declaration doesn't need to have the correct type, as the
linker doesn't perform any type checking.

Note that the library checks only work with exported functions. They
won't work with macros or inline functions, as those don't exist in
the library.

--
Glynn Clements <glynn@gclements.plus.com>

Hi,

2009/8/8 Markus Neteler <neteler@osgeo.org>:

[...]

but in conftest.c it is:
char GEOSGeom_createLinearRing();

No idea how to fix the test in configure.in.

hopefully fixed in r38867.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Martin Landa wrote:

> but in conftest.c it is:
> char GEOSGeom_createLinearRing();
>
> No idea how to fix the test in configure.in.

hopefully fixed in r38867.

No. Broken in r38867; fixed (i.e. reverted) in r38872.

GRASS needs GEOS 3.x; the check is supposed to fail on older versions.

--
Glynn Clements <glynn@gclements.plus.com>

Hi,

2009/8/26 Glynn Clements <glynn@gclements.plus.com>:

No. Broken in r38867; fixed (i.e. reverted) in r38872.

Sorry, on my computer is broken now...

GRASS needs GEOS 3.x; the check is supposed to fail on older versions.

geos-config --version
3.1.0

checking for geos-config... /usr/local/bin/geos-config
checking for geos_c.h... yes
checking for GEOSGeom_createLinearRing in -lgeos... no
configure: error: *** Unable to locate GEOS library.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

2009/8/26 Martin Landa <landa.martin@gmail.com>:

checking for geos-config... /usr/local/bin/geos-config
checking for geos_c.h... yes
checking for GEOSGeom_createLinearRing in -lgeos... no
configure: error: *** Unable to locate GEOS library.

as I mentioned earlier it should check geos_c (i.e. GEOS C API) not geos.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa