Bug #29772 Error compiling with option --without-geometry
Submitted: 12 Jul 2007 20:19 Modified: 24 Oct 2007 19:02
Reporter: Vallimar Morieve Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.45/5.1 OS:Linux
Assigned to: CPU Architecture:Any

[12 Jul 2007 20:19] Vallimar Morieve
Description:
When compiling --without-geometry, this error occurs:

item.cc: In member function 'Field* Item::tmp_table_field_from_field_type(TABLE*)':
item.cc:4319: error: expected type-specifier before 'Field_geom'
item.cc:4319: error: cannot convert 'int*' to 'Field*' in return
item.cc:4319: error: expected ';' before 'Field_geom'
item.cc:4323: error: 'Item_geometry_func' was not declared in this scope
item.cc:4320: error: expected primary-expression before ')' token
item.cc:4323: error: expected primary-expression before ')' token
item.cc:4323: error: expected `)' before 'this'
item.cc: In constructor 'Item_type_holder::Item_type_holder(THD*, Item*)':
item.cc:6431: error: 'Item_geometry_func' was not declared in this scope
item.cc:6431: error: expected primary-expression before ')' token
item.cc:6431: error: expected primary-expression before ')' token
make[4]: *** [item.o] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

How to repeat:
Compile with option:  --without-geometry

Suggested fix:
The geometry functions only exist if HAVE_SPATIAL is defined.  Dunno how proper a fix this is, but it lets you compile:

--- mysql-5.0.45/sql/item.cc.geom       2007-07-12 15:54:41.000000000 -0400
+++ mysql-5.0.45/sql/item.cc    2007-07-12 15:52:32.000000000 -0400
@@ -4315,12 +4315,14 @@ Field *Item::tmp_table_field_from_field_
       return new Field_blob(max_length, maybe_null, name, table,
                           collation.collation);
     break;                                     // Blob handled outside of case
+#ifdef HAVE_SPATIAL
   case MYSQL_TYPE_GEOMETRY:
     return new Field_geom(max_length, maybe_null, name, table,
                           (Field::geometry_type)
                           ((type() == Item::TYPE_HOLDER) ?
                            ((Item_type_holder *)this)->get_geometry_type() :
                            ((Item_geometry_func *)this)->get_geometry_type()));
+#endif
   }
 }
 
@@ -6425,10 +6427,12 @@ Item_type_holder::Item_type_holder(THD *
   if (Field::result_merge_type(fld_type) == INT_RESULT)
     decimals= 0;
   prev_decimal_int_part= item->decimal_int_part();
+#ifdef HAVE_SPATIAL
   if (item->field_type() == MYSQL_TYPE_GEOMETRY)
     geometry_type= (item->type() == Item::FIELD_ITEM) ?
       ((Item_field *)item)->get_geometry_type() :
       (Field::geometry_type)((Item_geometry_func *)item)->get_geometry_type();
+#endif
 }
 
 
--- mysql-5.0.45/libmysqld/item.cc.geom 2007-07-12 15:55:03.000000000 -0400
+++ mysql-5.0.45/libmysqld/item.cc      2007-07-12 15:53:16.000000000 -0400
@@ -4315,12 +4315,14 @@ Field *Item::tmp_table_field_from_field_
       return new Field_blob(max_length, maybe_null, name, table,
                           collation.collation);
     break;                                     // Blob handled outside of case
+#ifdef HAVE_SPATIAL
   case MYSQL_TYPE_GEOMETRY:
     return new Field_geom(max_length, maybe_null, name, table,
                           (Field::geometry_type)
                           ((type() == Item::TYPE_HOLDER) ?
                            ((Item_type_holder *)this)->get_geometry_type() :
                            ((Item_geometry_func *)this)->get_geometry_type()));
+#endif
   }
 }
 
@@ -6425,10 +6427,12 @@ Item_type_holder::Item_type_holder(THD *
   if (Field::result_merge_type(fld_type) == INT_RESULT)
     decimals= 0;
   prev_decimal_int_part= item->decimal_int_part();
+#ifdef HAVE_SPATIAL
   if (item->field_type() == MYSQL_TYPE_GEOMETRY)
     geometry_type= (item->type() == Item::FIELD_ITEM) ?
       ((Item_field *)item)->get_geometry_type() :
       (Field::geometry_type)((Item_geometry_func *)item)->get_geometry_type();
+#endif
 }
[12 Jul 2007 21:33] MySQL Verification Team
Thank you for the bug report.

item.cc: In member function âField* Item::tmp_table_field_from_field_type(TABLE*)â:
item.cc:4320: error: expected type-specifier before âField_geomâ
item.cc:4320: error: cannot convert âint*â to âField*â in return
item.cc:4320: error: expected â;â before âField_geomâ
item.cc:4324: error: âItem_geometry_funcâ was not declared in this scope
item.cc:4321: error: expected primary-expression before â)â token
item.cc:4324: error: expected primary-expression before â)â token
item.cc:4324: error: expected `)' before âthisâ
item.cc: In constructor âItem_type_holder::Item_type_holder(THD*, Item*)â:
item.cc:6444: error: âItem_geometry_funcâ was not declared in this scope
item.cc:6444: error: expected primary-expression before â)â token
item.cc:6444: error: expected primary-expression before â)â token
make[4]: *** [item.o] Error 1
make[4]: Leaving directory `/home/miguel/dbs/mysql-5.0/sql'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/miguel/dbs/mysql-5.0/sql'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/miguel/dbs/mysql-5.0/sql'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/miguel/dbs/mysql-5.0'
make: *** [all] Error 2
[miguel@light mysql-5.0]$
[12 Jul 2007 21:40] MySQL Verification Team
Updating version:

make[2]: Leaving directory `/home/miguel/dbs/mysql-5.1/sql'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/miguel/dbs/mysql-5.1'
make: *** [all] Error 2
[miguel@light mysql-5.1]$
[28 Sep 2007 21:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34667

ChangeSet@1.2524, 2007-09-28 17:10:14-04:00, dkatz@damien-katzs-computer.local +1 -0
  Bug #29772  Error compiling with option --without-geometry
  
  Added #ifdef HAVE_SPATIAL around geometry related code.
[15 Oct 2007 18:32] Damien Katz
pushed to 5.0-runtime, 5.1-runtime and 5.2-runtime
[19 Oct 2007 18:53] Bugs System
Pushed into 5.1.23-beta
[19 Oct 2007 18:54] Bugs System
Pushed into 5.0.52
[24 Oct 2007 19:02] Paul DuBois
Noted in 5.0.52, 5.1.23 changelogs.

Specifying the --without-geometry option for configure caused server
compilation to fail.
[3 Mar 2008 19:56] Sveta Smirnova
Bug #35004 was marked as duplicate of this one.