Description
Problem
The build fails on OpenSuSE Tumbleweed; this is unexpected as we've previously built osm2pgr successfully on Ubuntu and Fedora.
To Reproduce
Install prerequisites; PQXX v7.x is not included in the main repos, so you have to install it via One-click Install.
# OneClickInstallCLI https://software.opensuse.org/ymp/server:database:postgresql/openSUSE_Tumbleweed/libpqxx.ymp
# zypper in cmake gcc gcc-c++ libpqxx-devel libexpat-devel boost-devel libboost_program_options-devel postgresql-devel
Unrelated, but the build does not work with PQXX 6.x since the
CMakeLists.txt
falls back to C++11 if a version earlier than 7.0.0 is used and osm2pgr usesstd::optional
which is a C++17 feature.This does not happen on Debian! Everything builds fine with 6.x
If you attempt to build osm2pgr, it will fail:
$ make -j$(nproc)
[ 3%] Building CXX object CMakeFiles/osm2pgrouting.dir/src/osm_elements/osm_tag.cpp.o
/<...>/osm2pgrouting/src/osm_elements/osm_tag.cpp: In constructor ‘osm2pgr::Tag::Tag(const char**)’:
/<...>/osm2pgrouting/src/osm_elements/osm_tag.cpp:35:18: error: ‘transform’ is not a member of ‘std’
35 | std::transform(value.begin(), value.end(), value.begin(), [](char ch) {
| ^~~~~~~~~
make[2]: *** [CMakeFiles/osm2pgrouting.dir/build.make:328: CMakeFiles/osm2pgrouting.dir/src/osm_elements/osm_tag.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/osm2pgrouting.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
The problem can be resolved by adding #include <algorithm>
to src/osm_elements/osm_tag.cpp
.
Expectation
The build should not fail.
Platform/versions
OpenSuSE Tumbleweed (as of September 2024)
PQXX 7.7