Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build errors related to std::transform on OpenSuSE Tumbleweed #307

Open
jack23247 opened this issue Sep 19, 2024 · 0 comments
Open

Build errors related to std::transform on OpenSuSE Tumbleweed #307

jack23247 opened this issue Sep 19, 2024 · 0 comments
Labels

Comments

@jack23247
Copy link

jack23247 commented Sep 19, 2024

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 uses std::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

@jack23247 jack23247 added the bug label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant