Package: osm2pgsql
Version: 0.70.5+r25090-2
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu oneiric ubuntu-patch

the package osm2pgsql fails to build when using the linker flag --as-needed
The zlib and bzip m4 macros wrongly use LDFLAGS to link with libraries.
This leads to wrong ordering on the command line.
With ld --as-needed the libraries must be placed after the objects
needing them.
The LIBS variable must be used to archive the correct ordering.

See the log in the ubuntu bug:
https://bugs.launchpad.net/ubuntu/+source/osm2pgsql/+bug/803191

Attached patch fixes this issue.
Description: fix build with ld --as-needed
 The zlib and bzip m4 macros wrongly use LDFLAGS to link with libraries.
 This leads to wrong ordering on the command line.
 With ld --as-needed the libraries must be placed after the objects
 needing them.
 The LIBS variable must be used to archive the correct ordering.
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/osm2pgsql/+bug/803191
Author: Julian Taylor <jtaylor.deb...@googlemail.com>
--- osm2pgsql-0.70.5+r25090.orig/m4/ax_lib_zlib.m4
+++ osm2pgsql-0.70.5+r25090/m4/ax_lib_zlib.m4
@@ -117,8 +117,8 @@ AC_DEFUN([AX_LIB_ZLIB],
         saved_CPPFLAGS="$CPPFLAGS"
         CPPFLAGS="$CPPFLAGS -I$zlib_include_dir"
 
-        saved_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS $zlib_lib_flags"
+        saved_LIBS="$LIBS"
+        LIBS="$LIBS $zlib_lib_flags"
 
         dnl
         dnl Check zlib headers
@@ -178,7 +178,7 @@ AC_DEFUN([AX_LIB_ZLIB],
         fi
 
         CPPFLAGS="$saved_CPPFLAGS"
-        LDFLAGS="$saved_LDFLAGS"
+        LIBS="$saved_LIBS"
     fi
 
     AC_MSG_CHECKING([for zlib compression library])
--- osm2pgsql-0.70.5+r25090.orig/m4/ax_lib_bzip2.m4
+++ osm2pgsql-0.70.5+r25090/m4/ax_lib_bzip2.m4
@@ -117,8 +117,8 @@ AC_DEFUN([AX_LIB_BZIP2],
         saved_CPPFLAGS="$CPPFLAGS"
         CPPFLAGS="$CPPFLAGS -I$bzlib_include_dir"
 
-        saved_LDFLAGS="$LDFLAGS"
-        LDFLAGS="$LDFLAGS $bzlib_lib_flags"
+        saved_LIBS="$LIBS"
+        LIBS="$LIBS $bzlib_lib_flags"
 
         dnl
         dnl Check bzip2 headers
@@ -178,7 +178,7 @@ AC_DEFUN([AX_LIB_BZIP2],
         fi
 
         CPPFLAGS="$saved_CPPFLAGS"
-        LDFLAGS="$saved_LDFLAGS"
+        LIBS="$saved_LIBS"
     fi
 
     AC_MSG_CHECKING([for bzip2 compression library])

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to