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

edmonds notifications at github.com
Sat Apr 5 21:28:10 UTC 2014


Hi!

I compile-tested `osm2pgsql` with https://github.com/protobuf-c/protobuf-c/tree/v1.0.0-rc1. It failed to detect `protobuf-c` >= 0.14:

```
checking for protobuf-c 0.14... 
checking for protobuf_c headers in /usr/include... found
checking for protobuf_c library... found
checking for protobuf-c version >= 0.14... 
checking for ProtobufCFieldDescriptor.packed... no
protobuf-c >= 0.14: no
checking for protobuf-c usability... no
```

In `m4/ax_libprotobuf_c.m4` is the following check:

```
      dnl protobuf-c does not provide any version information in its header
      dnl files or from within the library itself, so we have to check
      dnl for availability of features here for now ...

      dnl protobuf-c 0.14 introduced member 'packed' in ProtobufCFieldDescriptor
      saved_CFLAGS=$CFLAGS
      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>]
         ])
      ])
      CFLAGS=$saved_CFLAGS
```

This will fail with the latest development version of `protobuf-c` because the `.packed` member of the `ProtobufCFieldDescriptor` struct has been replaced with a flags word.

However, `protobuf-c` now has macro constants `PROTOBUF_C_VERSION` and `PROTOBUF_C_VERSION_NUMBER` in the public header file, and `protobuf_c_version()` and `protobuf_c_version_number()` functions in the library, for determing the `protobuf-c` version. (See https://github.com/protobuf-c/protobuf-c/blob/v1.0.0-rc1/protobuf-c/protobuf-c.h#L73.) I would recommend trying these interfaces first to determine the `protobuf-c` version, and then falling back to the old `.packed` check to detect compatible older versions.

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


More information about the Tile-serving mailing list