[Tile-serving] [osm2pgsql] fails to detect latest protobuf-c (#129)

zenonp notifications at github.com
Sat Nov 29 23:23:46 UTC 2014


Fix, tested, works:

```diff
--- osm2pgsql-0.82.0/m4/ax_lib_protobuf_c.m4.orig	2013-04-15 07:06:03.000000000 +0000
+++ osm2pgsql-0.82.0/m4/ax_lib_protobuf_c.m4	2014-11-29 17:13:57.973388967 +0000
@@ -207,8 +207,10 @@
       CFLAGS="$CFLAGS $PROTOBUF_C_CFLAGS"
       AX_COMPARE_VERSION([$protobuf_c_wanted_version], [ge], [0.14],
          [AC_CHECK_MEMBER([ProtobufCFieldDescriptor.packed],,
-                          [protobuf_c_version_ok="no"],
-                          [[#include <google/protobuf-c/protobuf-c.h>]
+         [AC_CHECK_MEMBER([ProtobufCFieldDescriptor.flags],,
+                         [protobuf_c_version_ok="no"],
+                         [[#include <protobuf-c/protobuf-c.h>]])],
+         [[#include <google/protobuf-c/protobuf-c.h>]
          ])
       ])
       CFLAGS=$saved_CFLAGS
--- osm2pgsql-0.82.0/parse-pbf.c.orig	2013-04-15 07:06:03.000000000 +0000
+++ osm2pgsql-0.82.0/parse-pbf.c	2014-11-29 17:16:12.082671212 +0000
@@ -256,7 +256,7 @@
     return 0;
   }
   
-  header_block__free_unpacked (hmsg, &protobuf_c_system_allocator);
+  header_block__free_unpacked (hmsg, NULL);
 
   return 1;
 }
@@ -541,7 +541,7 @@
     if (!processOsmDataRelations(osmdata, group, string_table)) return 0;
   }
 
-  primitive_block__free_unpacked (pmsg, &protobuf_c_system_allocator);
+  primitive_block__free_unpacked (pmsg, NULL);
 
   return 1;
 }
@@ -606,8 +606,8 @@
       }
     }
 
-    blob__free_unpacked (blob_msg, &protobuf_c_system_allocator);
-    block_header__free_unpacked (header_msg, &protobuf_c_system_allocator);
+    blob__free_unpacked (blob_msg, NULL);
+    block_header__free_unpacked (header_msg, NULL);
   } while (!feof(input));
 
   if (!feof(input)) {
```

And if you grab the [Fedora 20 src.rpm](http://ftp.nluug.nl/pub/os/Linux/distr/fedora/linux/releases/20/Everything/source/SRPMS/o/osm2pgsql-0.82.0-3.fc20.src.rpm), you can apply this to it and it will build on el7:

```diff
--- osm2pgsql.spec.orig	2014-11-28 21:10:44.000000000 +0000
+++ osm2pgsql.spec	2014-11-29 17:23:11.000000000 +0000
@@ -1,11 +1,12 @@
 Name:           osm2pgsql
 Version:        0.82.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Imports map data from OpenStreetMap to a PostgreSQL database
 
 License:        GPLv2+
 URL:            http://wiki.openstreetmap.org/wiki/Osm2pgsql
 Source0:        https://github.com/openstreetmap/osm2pgsql/archive/v%{version}.tar.gz
+Patch0:		osm2pgsql-protobuf.patch
 
 BuildRequires:  autoconf
 BuildRequires:  automake
@@ -27,6 +28,10 @@
 %prep
 %setup -q
 
+%if 0%{?fedora} > 20 || 0%{?rhel} > 6
+%patch0 -p1
+%endif
+
 %build
 ./autogen.sh
 %configure --disable-static --with-protobuf-c
@@ -44,6 +49,11 @@
 %{_datadir}/%{name}/
 
 %changelog
+* Sat Nov 29 2014 Zenon Panoussis <oracle at provocation.net>  - 0.82.0-4
+- Patch to restore pbf support on el7, see 
+  https://github.com/openstreetmap/osm2pgsql/commit/8c7c6dbb319e97715b174edd081303174c96b03b
+  https://github.com/openstreetmap/osm2pgsql/issues/129#issuecomment-46355553
+
 * Tue Nov 05 2013 Fabian Affolter <mail at fabian-affolter.ch> - 0.82.0-3
 - Rebuilt for geos
```

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/129#issuecomment-64969176
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20141129/e1c7f779/attachment.html>


More information about the Tile-serving mailing list