Package: pyspatialite
Version: 3.0.1-8
Severity: serious
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu wily ubuntu-patch

pyspatialite is currently misbuilt on 64-bit architectures in Debian testing
and unstable, because of a distro patch that causes /usr/include/spatialite
to be added to the header search path.  libspatialite-dev ships both a
/usr/include/spatialite.h and a /usr/include/spatialite/spatialite.h, and
the first one is the correct one.  Without the correct function types, this
results in the compiler truncating pointers along its way; e.g., from 
<https://buildd.debian.org/status/fetch.php?pkg=pyspatialite&arch=arm64&ver=3.0.1-8&stamp=1436875015>:

aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall 
-Wstrict-prototypes -fno-strict-aliasing -g -O2 -fstack-protector-strong 
-Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC 
-DMODULE_NAME="spatialite.dbapi2" -DVERSION="3.0.1" -DSQLITE_ENABLE_FTS3=1 
-DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DOMIT_FREEXL=1 
-DSPATIALITE_HAS_INIT_EX=1 -I/usr/include -I/usr/include/spatialite 
-I/usr/include/python2.7 -c src/connection.c -o 
build/temp.linux-aarch64-2.7/src/connection.o
src/connection.c: In function 'pysqlite_connection_init':
src/connection.c:110:9: warning: implicit declaration of function 
'spatialite_alloc_connection' [-Wimplicit-function-declaration]
         self->slconn = spatialite_alloc_connection();
         ^
src/connection.c:110:22: warning: assignment makes pointer from integer without 
a cast
         self->slconn = spatialite_alloc_connection();
                      ^

This doesn't get caught by the Debian buildds, but in Ubuntu this is treated
as a fatal error as this is a known misbuild that won't work at all on some
64-bit architectures and will fail randomly at runtime on others.

The one-liner fix has been applied to Ubuntu with the following changelog:

  * debian/patches/00-fix_build.patch: don't add /usr/include/spatialite to
    the search path.  This is a wrong fix which causes 
    /usr/include/spatialite/spatialite.h to be found instead of
    /usr/include/spatialite.h, resulting in a misbuild on 64-bit archs.

Thanks for considering the patch.
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
diff -Nru pyspatialite-3.0.1/debian/patches/00-fix_build.patch pyspatialite-3.0.1/debian/patches/00-fix_build.patch
--- pyspatialite-3.0.1/debian/patches/00-fix_build.patch	2015-06-27 15:57:24.000000000 -0700
+++ pyspatialite-3.0.1/debian/patches/00-fix_build.patch	2015-07-29 20:57:42.000000000 -0700
@@ -7,9 +7,11 @@
  setup.py |   21 ++++++++++++---------
  1 file changed, 12 insertions(+), 9 deletions(-)
 
---- a/setup.py
-+++ b/setup.py
-@@ -44,7 +44,7 @@ sources = ["src/module.c", "src/connecti
+Index: pyspatialite-3.0.1/setup.py
+===================================================================
+--- pyspatialite-3.0.1.orig/setup.py
++++ pyspatialite-3.0.1/setup.py
+@@ -44,7 +44,7 @@
  
  include_dirs = []
  library_dirs = []
@@ -18,7 +20,7 @@
  runtime_library_dirs = []
  extra_objects = []
  define_macros = []
-@@ -113,24 +113,27 @@ def get_amalgamation():
+@@ -113,24 +113,26 @@
  class MyBuildExt(build_ext):
  
      def build_extension(self, ext):
@@ -50,7 +52,6 @@
 +        #ext.sources.append(os.path.join(AMALGAMATION_ROOT, "sqlite3.c"))
 +        #ext.sources.append(os.path.join(AMALGAMATION_ROOT, "spatialite.c"))
 +        #ext.include_dirs.append(AMALGAMATION_ROOT)
-+        ext.include_dirs.append("/usr/include/spatialite")
          build_ext.build_extension(self, ext)
          
  

Reply via email to