Skip to content

osm2pgrouting does not compile with libpqxx v 7.1.1, 7.2.0. Compiles okay with 6.4.7 #284

@jmarca

Description

@jmarca

Describe the bug
Building osm2pgrouting in my docker image. Build fails with libpqxx 7.1.1, 7.2.0, and master. Build succeeds with libpqxx set to 6.4.7

To Reproduce

(I can upload my entire Dockerfile if you want...)

FROM postgres:alpine
....
#ARG LIBPQXX_VERSION=7.2.0
ARG LIBPQXX_VERSION=7.1.1
RUN wget -O libpqxx.tar.gz "https://github.com/jtv/libpqxx/archive/$LIBPQXX_VERSION.tar.gz" \
        && tar xvf libpqxx.tar.gz \
        && cd libpqxx-$LIBPQXX_VERSION  \
        && ./configure prefix=/usr --disable-documentation \
        && make -j9 \
        && make install \
        && cd .. && rm -rf libpqxx*
RUN  git clone --depth 1 "https://github.com/pgRouting/osm2pgrouting" \
        && cd osm2pgrouting  \
        && mkdir build \
        && cd build \
        && cmake -DCMAKE_INSTALL_PREFIX=/usr .. \
        && make \
        && make install \
        && cd ../.. && rm -rf osm2pgrouting*

If I change the version of libpqxx to 6.4.7, the build passes

The compile error starts off as:

[ 34%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/database/pois_config.cpp.o
In file included from /usr/include/pqxx/array.hxx:18,
                 from /usr/include/pqxx/array:4,
                 from /usr/include/pqxx/pqxx:2,
                 from /osm2pgrouting/include/database/Export2DB.h:25,
                 from /osm2pgrouting/src/database/Export2DB.cpp:22:
/usr/include/pqxx/internal/encodings.hxx:24:42: error: 'pqxx::internal::encoding_group pqxx::internal::enc_group' redeclared as different kind of entity
   24 | encoding_group enc_group(std::string_view);
      |                                          ^
/usr/include/pqxx/internal/encodings.hxx:23:16: note: previous declaration 'pqxx::internal::encoding_group pqxx::internal::enc_group(int)'
   23 | encoding_group enc_group(int /* libpq encoding ID */);
      |                ^~~~~~~~~
/usr/include/pqxx/internal/encodings.hxx:24:31: error: 'string_view' is not a member of 'std'
   24 | encoding_group enc_group(std::string_view);
      |                               ^~~~~~~~~~~
/usr/include/pqxx/internal/encodings.hxx:24:31: note: 'std::string_view' is only available from C++17 onwards
/usr/include/pqxx/internal/encodings.hxx:39:28: error: 'std::string_view' has not been declared
   39 |   encoding_group enc, std::string_view haystack, char needle,
      |                            ^~~~~~~~~~~
/usr/include/pqxx/internal/encodings.hxx:44:28: error: 'std::string_view' has not been declared
   44 |   encoding_group enc, std::string_view haystack, std::string_view needle,
... lots more lines ...

The releases page for libpqxx (https://github.com/jtv/libpqxx/releases) notes some changes to string processing, which might align with the error above. But I'm not going to pretend to know enough C++ to hazard a guess as to what is going on.

Expected behavior
Compile successfully with v 7+ version of libpqxx

Sample Data
See above

Specifications (please complete the following information):
Use the commands:

SELECT version();
SELECT postgis_full_version();
SELECT pgr_version();

NA

In my Dockerfile, I am compiling

ARG POSTGIS_VERSION=3.0.2
ARG PGROUTING_VERSION=3.1.0
ARG GEOS_VERSION=3.8.1

I am building osm2pgrouting master, but I have also tried and failed with version OSM2PGROUTING_VERSION=2.3.6

Additional context
NA

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions