0

I'm trying to build latest PostGIS (2.2dev) with SFCGAL. SFCGAL is installed in /usr/local/lib, and includes are in /usr/local/include/SFCGAL I've run configure as:

./configure --with-sfcgal=/usr/local/bin

and it finds SFCGAL (even if it doesn't output the version, which should be 1.0.4):

-------------- Compiler Info ------------- 
C compiler:           gcc -g -O2
C++ compiler:         g++ -g -O2
SQL preprocessor:     /usr/bin/cpp -traditional-cpp -P
-------------- Compiler Info ------------- 
C compiler:           gcc -g -O2
C++ compiler:         g++ -g -O2
SQL preprocessor:     /usr/bin/cpp -traditional-cpp -P
-------------- Dependencies -------------- 
GEOS config:          /usr/bin/geos-config
GEOS version:         3.3.8
GDAL config:          /usr/bin/gdal-config
GDAL version:         1.10.0
SFCGAL config:        /usr/local/bin
SFCGAL version:       
PostgreSQL config:    /usr/bin/pg_config
PostgreSQL version:   PostgreSQL 9.1.13
PROJ4 version:        48
Libxml2 config:       /usr/bin/xml2-config
Libxml2 version:      2.8.0
JSON-C support:       yes
PostGIS debug level:  0
Perl:                 /usr/bin/perl
--------------- Extensions --------------- 
PostGIS Raster:       enabled
PostGIS Topology:     enabled
SFCGAL support:       enabled

Everything seems ok, but it fails during the linking of utilities (e.g. raster loader or, in case raster is disabled, the next one is shp2pgsql):

/bin/bash ../libtool --mode=link \
gcc -I ../liblwgeom -g -O2  -fPIC -DPIC  -Wall -Wmissing-prototypes    shpopen.o   dbfopen.o getopt.o shpcommon.o safileio.o shp2pgsql-core.o shp2pgsql-cli.o   ../liblwgeom/liblwgeom.la -o shp2pgsql  -lc 
libtool: link: gcc -I ../liblwgeom -g -O2 -fPIC -DPIC -Wall -Wmissing-prototypes  shpopen.o dbfopen.o getopt.o shpcommon.o safileio.o shp2pgsql-core.o shp2pgsql-cli.o -o  .libs/shp2pgsql  ../liblwgeom/.libs/liblwgeom.so -lc -Wl,-rpath - Wl,/home/giova/bin/postgis/lib
../liblwgeom/.libs/liblwgeom.so: undefined reference to `sfcgal_solid_num_shells'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `sfcgal_point_y'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `sfcgal_point_x'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `sfcgal_geometry_collection_geometry_n'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `sfcgal_linestring_point_n'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `sfcgal_polyhedral_surface_polygon_n'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `sfcgal_triangle_set_vertex_from_xyz'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `sfcgal_solid_shell_n'
../liblwgeom/.libs/liblwgeom.so: undefined reference to `sfcgal_solid_create_from_exterior_shell'
(and other similar undefined references)

What's going wrong with liblwgeom linking? Why liblwgeom has all the SFCGAL references undefined? The SFCGAL building seems ok, and if I run readelf on libSFCGAL.so everything seems ok.

I past the readelf output run on liblwgeom.so, which shows the undefined symbols Thanks for your precious help.

Giovanni

    00066048  00000107 R_386_JUMP_SLOT        00000000   sfcgal_solid_num_shells
    000660d0  00000a07 R_386_JUMP_SLOT        00000000   sfcgal_linestring_add_point
    00066174  00001407 R_386_JUMP_SLOT        00000000   sfcgal_linestring_num_points
    000661a4  00001707 R_386_JUMP_SLOT        00000000   sfcgal_point_y
    000661c8  00001907 R_386_JUMP_SLOT        00000000   sfcgal_geometry_collection_num_geometries
    00066260  00002207 R_386_JUMP_SLOT        00000000   sfcgal_triangle_vertex
    00066380  00002f07 R_386_JUMP_SLOT        00000000   sfcgal_triangle_set_vertex_from_xy
    00066390  00003007 R_386_JUMP_SLOT        00000000   sfcgal_polygon_interior_ring_n
    000663d0  00003407 R_386_JUMP_SLOT        00000000   sfcgal_solid_create_from_exterior_shell
    00066484  00003e07 R_386_JUMP_SLOT        00000000   sfcgal_triangle_set_vertex_from_xyz
    00066490  00004007 R_386_JUMP_SLOT        00000000   sfcgal_version
    000664b8  00004407 R_386_JUMP_SLOT        00000000   sfcgal_polygon_exterior_ring
    000664ec  00004707 R_386_JUMP_SLOT        00000000   sfcgal_point_create_from_xy
    000664f4  00004807 R_386_JUMP_SLOT        00000000   sfcgal_geometry_collection_add_geometry
    00066540  00004e07 R_386_JUMP_SLOT        00000000   sfcgal_linestring_create
    000665d8  00005807 R_386_JUMP_SLOT        00000000   sfcgal_linestring_point_n
    0006663c  00005d07 R_386_JUMP_SLOT        00000000   sfcgal_geometry_is_3d
    00066660  00006007 R_386_JUMP_SLOT        00000000   sfcgal_geometry_is_empty
    000666a0  00006407 R_386_JUMP_SLOT        00000000   sfcgal_multi_linestring_create
    000666b8  00006707 R_386_JUMP_SLOT        00000000   sfcgal_point_x
    000666d0  00006907 R_386_JUMP_SLOT        00000000   sfcgal_point_z
    000666ec  00006a07 R_386_JUMP_SLOT        00000000   sfcgal_geometry_collection_geometry_n
    00066738  00007007 R_386_JUMP_SLOT        00000000   sfcgal_polyhedral_surface_polygon_n
    0006673c  00007107 R_386_JUMP_SLOT        00000000   sfcgal_multi_point_create
    00066744  00007207 R_386_JUMP_SLOT        00000000   sfcgal_polygon_create
    0006678c  00007807 R_386_JUMP_SLOT        00000000   sfcgal_multi_polygon_create
    00066790  00007907 R_386_JUMP_SLOT        00000000   sfcgal_geometry_type_id
    000667cc  00007d07 R_386_JUMP_SLOT        00000000   sfcgal_polyhedral_surface_add_polygon
    000667d4  00007e07 R_386_JUMP_SLOT        00000000   sfcgal_polygon_num_interior_rings
    000667fc  00007f07 R_386_JUMP_SLOT        00000000   sfcgal_geometry_collection_create
    00066800  00008007 R_386_JUMP_SLOT        00000000   sfcgal_polygon_add_interior_ring
    0006680c  00008307 R_386_JUMP_SLOT        00000000   sfcgal_polygon_create_from_exterior_ring
    000668b8  00008e07 R_386_JUMP_SLOT        00000000   sfcgal_point_create_from_xyz
    000668d0  00008f07 R_386_JUMP_SLOT        00000000   sfcgal_polyhedral_surface_create
    0006694c  00009607 R_386_JUMP_SLOT        00000000   sfcgal_triangle_create
    0006697c  00009907 R_386_JUMP_SLOT        00000000   sfcgal_triangulated_surface_create
    0006699c  00009b07 R_386_JUMP_SLOT        00000000   sfcgal_triangulated_surface_num_triangles
    000669d4  00009c07 R_386_JUMP_SLOT        00000000   sfcgal_triangulated_surface_triangle_n
    000669e0  00009d07 R_386_JUMP_SLOT        00000000   sfcgal_geometry_delete
    000669ec  00009e07 R_386_JUMP_SLOT        00000000   sfcgal_polyhedral_surface_num_polygons
    00066a4c  0000a507 R_386_JUMP_SLOT        00000000   sfcgal_triangulated_surface_add_triangle
    00066a64  0000a707 R_386_JUMP_SLOT        00000000   sfcgal_point_create
    00066a6c  0000a807 R_386_JUMP_SLOT        00000000   sfcgal_solid_shell_n
         1: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_solid_num_shells
        10: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_linestring_add_point
        20: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_linestring_num_points
        23: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_y
        25: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_collection_num_geometries
        34: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangle_vertex
        47: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangle_set_vertex_from_xy
        48: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_interior_ring_n
        52: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_solid_create_from_exterior_shell
        62: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangle_set_vertex_from_xyz
        64: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_version
        68: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_exterior_ring
        71: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_create_from_xy
        72: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_collection_add_geometry
        78: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_linestring_create
        88: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_linestring_point_n
        93: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_is_3d
        96: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_is_empty
       100: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_multi_linestring_create
       103: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_x
       105: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_z
       106: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_collection_geometry_n
       112: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polyhedral_surface_polygon_n
       113: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_multi_point_create
       114: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_create
       120: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_multi_polygon_create
       121: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_type_id
       125: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polyhedral_surface_add_polygon
       126: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_num_interior_rings
       127: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_collection_create
       128: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_add_interior_ring
       131: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_create_from_exterior_ring
       142: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_create_from_xyz
       143: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polyhedral_surface_create
       150: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangle_create
       153: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangulated_surface_create
       155: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangulated_surface_num_triangles
       156: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangulated_surface_triangle_n
       157: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_delete
       158: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polyhedral_surface_num_polygons
       165: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangulated_surface_add_triangle
       167: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_create
       168: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_solid_shell_n
       543: 0004be90    25 FUNC    GLOBAL DEFAULT   11 lwgeom_sfcgal_version
       758: 0004c840   198 FUNC    GLOBAL DEFAULT   11 lwgeom_sfcgal_noop
       923: 00000000     0 FILE    LOCAL  DEFAULT  ABS lwgeom_sfcgal.c
       989: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_solid_num_shells
      1030: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_linestring_add_point
      1079: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_linestring_num_points
      1095: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_y
      1105: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_collection_num_geometries
      1162: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangle_vertex
      1255: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangle_set_vertex_from_xy
      1263: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_interior_ring_n
      1286: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_solid_create_from_exterior_shell
      1312: 0004c840   198 FUNC    GLOBAL DEFAULT   11 lwgeom_sfcgal_noop
      1343: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangle_set_vertex_from_xyz
      1348: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_version
      1362: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_exterior_ring
      1383: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_create_from_xy
      1386: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_collection_add_geometry
      1412: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_linestring_create
      1464: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_linestring_point_n
      1492: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_is_3d
      1497: 0004be90    25 FUNC    GLOBAL DEFAULT   11 lwgeom_sfcgal_version
      1503: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_is_empty
      1522: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_multi_linestring_create
      1533: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_x
      1542: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_z
      1549: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_collection_geometry_n
      1575: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polyhedral_surface_polygon_n
      1577: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_multi_point_create
      1580: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_create
      1600: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_multi_polygon_create
      1601: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_type_id
      1618: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polyhedral_surface_add_polygon
      1621: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_num_interior_rings
      1635: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_collection_create
      1636: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_add_interior_ring
      1639: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polygon_create_from_exterior_ring
      1696: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_create_from_xyz
      1703: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polyhedral_surface_create
      1743: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangle_create
      1759: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangulated_surface_create
      1770: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangulated_surface_num_triangles
      1788: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangulated_surface_triangle_n
      1791: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_geometry_delete
      1794: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_polyhedral_surface_num_polygons
      1825: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_triangulated_surface_add_triangle
      1831: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_point_create
      1833: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND sfcgal_solid_shell_n
giohappy
  • 1,262
  • 1
  • 7
  • 16

2 Answers2

2

The option parameter should be the sfcgal-config:

./configure --with-sfcgal=/usr/local/bin/sfcgal-config

It should be an error if 'SFCGAL version' can not be found, but apparently it isn't.

0

I managed to sucessfully build PostGIS 2.2.2 with SFCGAL for the software versions listed below. The script I used can be found here. I used ./configure --with-sfcgal=/usr/local/bin/sfcgal-config to configure the PostGIS build.

Unbuntu Trusty Tar 14.04 LTS
PostGIS 2.2.2
GEOS 3.5.0
PostgreSQL 9.5
SFCGAL 1.3.0
CGAL 4.7.2 
bwibo
  • 131
  • 2