Bug#638929: spatialite: FTBFS with ld that defaults to --as-needed: bad linkage order

Colin Watson cjwatson at ubuntu.com
Tue Aug 23 01:09:30 UTC 2011


Package: spatialite
Version: 2.4.0~rc2-5
Severity: important
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch oneiric

getstream fails to build with a linker that defaults to --as-needed, as
shown in this Ubuntu bug report:

  https://bugs.launchpad.net/ubuntu/+source/spatialite/+bug/831229

This is because its link line order is wrong, putting libraries before
the objects that use them rather than after.  See:

  http://wiki.debian.org/ToolChain/DSOLinking#Only_link_with_needed_libraries

The following patch fixes this.

  * Put -lsqlite after references to libspatialite on link lines.

diff -u spatialite-2.4.0~rc2/debian/patches/series spatialite-2.4.0~rc2/debian/patches/series
--- spatialite-2.4.0~rc2/debian/patches/series
+++ spatialite-2.4.0~rc2/debian/patches/series
@@ -1,0 +2 @@
+link-order.diff
only in patch2:
unchanged:
--- spatialite-2.4.0~rc2.orig/debian/patches/link-order.diff
+++ spatialite-2.4.0~rc2/debian/patches/link-order.diff
@@ -0,0 +1,48 @@
+Description: libspatialite uses libsqlite; fix link order
+Author: Colin Watson <cjwatson at ubuntu.com>
+Bug-Ubuntu: https://bugs.launchpad.net/bugs/831229
+Forwarded: no
+Last-Update: 2011-08-23
+
+Index: b/spatialite-tools/Makefile.am
+===================================================================
+--- a/spatialite-tools/Makefile.am
++++ b/spatialite-tools/Makefile.am
+@@ -45,13 +45,13 @@
+ 	@PROJ_LIB@ \
+ 	-lm -liconv -lstdc++ -lpthread -ldl
+ else
+-spatialite_LDADD = -lsqlite3 @SPATIALITE_LIB@ \
++spatialite_LDADD = @SPATIALITE_LIB@ -lsqlite3 \
+ 	@GEOS_LIB_C@ \
+ 	@GEOS_LIB@ \
+ 	@PROJ_LIB@ \
+ 	-lm -lstdc++ -lpthread -ldl \
+ 	@READLINE_LIBS@
+-LDADD = -lsqlite3 @SPATIALITE_LIB@ \
++LDADD = @SPATIALITE_LIB@ -lsqlite3 \
+ 	@GEOS_LIB_C@ \
+ 	@GEOS_LIB@ \
+ 	@PROJ_LIB@ \
+Index: b/spatialite-tools/Makefile.in
+===================================================================
+--- a/spatialite-tools/Makefile.in
++++ b/spatialite-tools/Makefile.in
+@@ -244,7 +244,7 @@
+ shp_doctor_SOURCES = shp_doctor.c
+ exif_loader_SOURCES = exif_loader.c
+ spatialite_osm_SOURCES = spatialite_osm.c
+- at MACOSX_FALSE@@MINGW_FALSE at spatialite_LDADD = -lsqlite3 @SPATIALITE_LIB@ \
++ at MACOSX_FALSE@@MINGW_FALSE at spatialite_LDADD = @SPATIALITE_LIB@ -lsqlite3 \
+ @MACOSX_FALSE@@MINGW_FALSE@	@GEOS_LIB_C@ \
+ @MACOSX_FALSE@@MINGW_FALSE@	@GEOS_LIB@ \
+ @MACOSX_FALSE@@MINGW_FALSE@	@PROJ_LIB@ \
+@@ -265,7 +265,7 @@
+ @MINGW_TRUE@	/usr/local/lib/libiconv.a \
+ @MINGW_TRUE@	-lm -lstdc++
+ 
+- at MACOSX_FALSE@@MINGW_FALSE at LDADD = -lsqlite3 @SPATIALITE_LIB@ \
++ at MACOSX_FALSE@@MINGW_FALSE at LDADD = @SPATIALITE_LIB@ -lsqlite3 \
+ @MACOSX_FALSE@@MINGW_FALSE@	@GEOS_LIB_C@ \
+ @MACOSX_FALSE@@MINGW_FALSE@	@GEOS_LIB@ \
+ @MACOSX_FALSE@@MINGW_FALSE@	@PROJ_LIB@ \

Thanks,

-- 
Colin Watson                                       [cjwatson at ubuntu.com]





More information about the Pkg-grass-devel mailing list