Skip to content

Build failure in pgRouting 3.7.1 on Alpine 3.21, Gcc 14.2 : cstdint not included by default ( with Workaround ) #2707

Closed
@ImreSamu

Description

Environment:

  • Operating System: Alpine 3.21 ( Docker Image : postgis/postgis:15-3.5-alpine )
  • Compiler: GCC 14.2
  • PostGIS Version: 3.5.1
  • pgRouting Version: 3.7.1

Problem:

  • When building pgRouting 3.7.1 using the default command:
cmake ..

the build fails with an error related to the missing inclusion of . The specific error is:

#8 14.94 /pgrouting-3.7.1/include/cpp_common/identifier.hpp:45:42: error: 'int64_t' does not name a type
#8 14.94    45 |      Identifier(const size_t _idx, const int64_t _id);
#8 14.94       |                                          ^~~~~~~
#8 14.94 /pgrouting-3.7.1/include/cpp_common/identifier.hpp:39:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
#8 

Maybe related to this issue : #2680

Workaround:

  • Adding the -include cstdint flag resolves the issue:
cmake -DCMAKE_CXX_FLAGS="-include cstdint" ..

Here is the Dockerfile used to reproduce the issue:

FROM postgis/postgis:15-3.5-alpine
RUN apk add --no-cache \
    boost-dev \
    cmake \
    g++ \
    make \
    perl  
ENV PGROUTING_VERSION 3.7.1
RUN wget -O pgrouting.tar.gz https://github.com/pgRouting/pgrouting/archive/v${PGROUTING_VERSION}.tar.gz
RUN echo "Extracting pgrouting" \
    && tar -xvzf pgrouting.tar.gz \
    && cd pgrouting-* \
    && mkdir build \
    && cd build \
    # default - cstdint is not included in the C++ standard library
    && cmake .. \
    # -----------
    # fixing - workaround: include cstdint
    # && cmake -DCMAKE_CXX_FLAGS="-include cstdint" .. \
    && make -j4 \
    && make install \
    && cd ../.. \
    && rm -rf pgrouting*

and build with docker build --progress=plain --network=host -t pgr-alpine .

Expected Behavior:

  • The build should succeed without requiring manual inclusion of via CMAKE_CXX_FLAGS.

Related - original - issue:

full build log - click me
#8 0.426 pgrouting-3.7.1/tools/transifex/remove_obsolete_entries.sh
#8 0.426 pgrouting-3.7.1/tools/transifex/update_locale.sh
#8 0.437 CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
#8 0.437   Compatibility with CMake < 3.10 will be removed from a future version of
#8 0.437   CMake.
#8 0.437 
#8 0.437   Update the VERSION argument <min> value.  Or, use the <min>...<max> syntax
#8 0.437   to tell CMake that the project requires at least <min> but has been updated
#8 0.437   to work with policies introduced by <max> or earlier.
#8 0.437 
#8 0.437 
#8 0.438 -- Setting build type to 'Release' as none was specified.
#8 0.438 -- CMAKE_BUILD_TYPE Release
#8 0.514 -- The C compiler identification is GNU 14.2.0
#8 0.607 -- The CXX compiler identification is GNU 14.2.0
#8 0.623 -- Detecting C compiler ABI info
#8 0.729 -- Detecting C compiler ABI info - done
#8 0.759 -- Check for working C compiler: /usr/bin/cc - skipped
#8 0.759 -- Detecting C compile features
#8 0.760 -- Detecting C compile features - done
#8 0.778 -- Detecting CXX compiler ABI info
#8 0.879 -- Detecting CXX compiler ABI info - done
#8 0.907 -- Check for working CXX compiler: /usr/bin/c++ - skipped
#8 0.907 -- Detecting CXX compile features
#8 0.909 -- Detecting CXX compile features - done
#8 0.921 -- Could NOT find Git (missing: GIT_EXECUTABLE) 
#8 0.926 -- DOXYGEN_MINIMUM_VERSION=1.7
#8 0.926 -- SPHINX_MINIMUM_VERSION=4.0
#8 0.926 -- POSTGRESQL_MINIMUM_VERSION=13.0.0
#8 0.926 -- BOOST_MINIMUM_VERSION=1.56.0
#8 0.926 -- POSTGIS_MINIMUM_VERSION=3.0.0
#8 0.926 CMake Warning (dev) at CMakeLists.txt:88 (find_package):
#8 0.926   Policy CMP0167 is not set: The FindBoost module is removed.  Run "cmake
#8 0.926   --help-policy CMP0167" for policy details.  Use the cmake_policy command to
#8 0.926   set the policy and suppress this warning.
#8 0.926 
#8 0.926 This warning is for project developers.  Use -Wno-dev to suppress it.
#8 0.926 
#8 0.939 -- Found Boost: /usr/lib/cmake/Boost-1.84.0/BoostConfig.cmake (found suitable version "1.84.0", minimum required is "1.56.0")
#8 0.955 -- Found Perl: /usr/bin/perl (found version "5.40.0")
#8 0.956 -- POSTGRESQL_PG_CONFIG is /usr/local/bin/pg_config
#8 0.957 -- POSTGRESQL_EXECUTABLE is /usr/local/bin/postgres
#8 0.958 -- POSTGRESQL_VERSION_STRING in FindPostgreSQL.cmake is PostgreSQL 15.10
#8 0.961 -- POSTGRESQL_INCLUDE_DIR: /usr/local/include/postgresql/server
#8 0.961 -- POSTGRESQL_LIBRARIES: /usr/local/lib
#8 0.961 -- POSTGRESQL_VERSION_STRING=PostgreSQL 15.10
#8 0.961 -- POSTGRESQL_VERSION=15.10
#8 0.961 -- PGSQL_VERSION=15010
#8 0.961 -- PGSQL_VERSION=15010
#8 0.963 -- LIBRARY_INSTALL_PATH /usr/local/lib/postgresql
#8 0.966 -- Performing Test C_COMPILER_SUPPORTS_FPIC
#8 1.055 -- Performing Test C_COMPILER_SUPPORTS_FPIC - Success
#8 1.057 -- Performing Test CXX_COMPILER_SUPPORTS_FPIC
#8 1.181 -- Performing Test CXX_COMPILER_SUPPORTS_FPIC - Success
#8 1.185 -- Performing Test C_COMPILER_SUPPORTS_ROUNDING_MATH
#8 1.295 -- Performing Test C_COMPILER_SUPPORTS_ROUNDING_MATH - Success
#8 1.297 -- Performing Test CXX_COMPILER_SUPPORTS_ROUNDING_MATH
#8 1.411 -- Performing Test CXX_COMPILER_SUPPORTS_ROUNDING_MATH - Success
#8 1.518 -- Configuring done (1.1s)
#8 1.719 -- Generating done (0.2s)
#8 1.720 -- Build files have been written to: /pgrouting-3.7.1/build
#8 1.784 [  1%] Building C object src/metrics/CMakeFiles/metrics.dir/betweennessCentrality.c.o
#8 1.784 [  1%] Building C object src/dominator/CMakeFiles/dominator.dir/lengauerTarjanDominatorTree.c.o
#8 1.786 [  2%] Building C object src/ordering/CMakeFiles/ordering.dir/cuthillMckeeOrdering.c.o
#8 1.787 [  3%] Building C object src/common/CMakeFiles/common.dir/postgres_connection.c.o
#8 1.946 [  4%] Building CXX object src/dominator/CMakeFiles/dominator.dir/lengauerTarjanDominatorTree_driver.cpp.o
#8 1.948 [  4%] Building CXX object src/ordering/CMakeFiles/ordering.dir/cuthillMckeeOrdering_driver.cpp.o
#8 1.970 [  4%] Building C object src/common/CMakeFiles/common.dir/e_report.c.o
#8 1.976 [  4%] Building CXX object src/metrics/CMakeFiles/metrics.dir/betweennessCentrality_driver.cpp.o
#8 2.123 [  4%] Building CXX object src/common/CMakeFiles/common.dir/basePath_SSEC.cpp.o
#8 11.42 [  4%] Built target dominator
#8 11.45 [  4%] Building C object src/circuits/CMakeFiles/circuits.dir/hawickCircuits.c.o
#8 11.75 [  5%] Building CXX object src/circuits/CMakeFiles/circuits.dir/hawickCircuits_driver.cpp.o
#8 11.78 [  5%] Built target ordering
#8 11.80 [  5%] Building C object src/traversal/CMakeFiles/traversal.dir/depthFirstSearch.c.o
#8 11.98 [  6%] Building CXX object src/traversal/CMakeFiles/traversal.dir/depthFirstSearch_driver.cpp.o
#8 13.12 [  6%] Built target metrics
#8 13.14 [  6%] Building C object src/coloring/CMakeFiles/coloring.dir/sequentialVertexColoring.c.o
#8 13.30 [  7%] Building CXX object src/coloring/CMakeFiles/coloring.dir/sequentialVertexColoring_driver.cpp.o
#8 13.95 [  8%] Building C object src/common/CMakeFiles/common.dir/check_parameters.c.o
#8 14.09 [  8%] Building C object src/common/CMakeFiles/common.dir/time_msg.c.o
#8 14.22 [  9%] Building CXX object src/common/CMakeFiles/common.dir/assert.cpp.o
#8 14.63 [  9%] Building CXX object src/common/CMakeFiles/common.dir/identifier.cpp.o
#8 14.94 In file included from /pgrouting-3.7.1/src/common/identifier.cpp:28:
#8 14.94 /pgrouting-3.7.1/include/cpp_common/identifier.hpp:45:42: error: 'int64_t' does not name a type
#8 14.94    45 |      Identifier(const size_t _idx, const int64_t _id);
#8 14.94       |                                          ^~~~~~~
#8 14.94 /pgrouting-3.7.1/include/cpp_common/identifier.hpp:39:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
#8 14.94    38 | #include <ostream>
#8 14.94   +++ |+#include <cstdint>
#8 14.94    39 | 
#8 14.94 /pgrouting-3.7.1/include/cpp_common/identifier.hpp:47:6: error: 'int64_t' does not name a type
#8 14.94    47 |      int64_t id() const;
#8 14.94       |      ^~~~~~~
#8 14.94 /pgrouting-3.7.1/include/cpp_common/identifier.hpp:47:6: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
#8 14.94 /pgrouting-3.7.1/include/cpp_common/identifier.hpp:49:20: error: 'int64_t' has not been declared
#8 14.94    49 |      void reset_id(int64_t);
#8 14.94       |                    ^~~~~~~
#8 14.95 /pgrouting-3.7.1/include/cpp_common/identifier.hpp:55:6: error: 'int64_t' does not name a type
#8 14.95    55 |      int64_t m_id;
#8 14.95       |      ^~~~~~~
#8 14.95 /pgrouting-3.7.1/include/cpp_common/identifier.hpp:55:6: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp:36:15: error: 'int64_t' does not name a type
#8 14.95    36 |         const int64_t _id) :
#8 14.95       |               ^~~~~~~
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp:29:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
#8 14.95    28 | #include "cpp_common/identifier.hpp"
#8 14.95   +++ |+#include <cstdint>
#8 14.95    29 | 
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp: In constructor 'pgrouting::Identifier::Identifier(size_t, int)':
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp:38:5: error: class 'pgrouting::Identifier' does not have any field named 'm_id'
#8 14.95    38 |     m_id(_id) {}
#8 14.95       |     ^~~~
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp: At global scope:
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp:45:1: error: 'int64_t' does not name a type
#8 14.95    45 | int64_t
#8 14.95       | ^~~~~~~
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp:45:1: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp:51:1: error: variable or field 'reset_id' declared void
#8 14.95    51 | Identifier::reset_id(int64_t _id) {
#8 14.95       | ^~~~~~~~~~
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp:51:22: error: 'int64_t' was not declared in this scope
#8 14.95    51 | Identifier::reset_id(int64_t _id) {
#8 14.95       |                      ^~~~~~~
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp:51:22: note: 'int64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp: In function 'std::ostream& pgrouting::operator<<(std::ostream&, const Identifier&)':
#8 14.95 /pgrouting-3.7.1/src/common/identifier.cpp:56:34: error: 'const class pgrouting::Identifier' has no member named 'id'; did you mean 'idx'?
#8 14.95    56 |     log << "id(idx) = " << ident.id() << "(" << ident.idx() << ")";
#8 14.95       |                                  ^~
#8 14.95       |                                  idx
#8 14.99 make[2]: *** [src/common/CMakeFiles/common.dir/build.make:163: src/common/CMakeFiles/common.dir/identifier.cpp.o] Error 1
#8 14.99 make[1]: *** [CMakeFiles/Makefile2:1900: src/common/CMakeFiles/common.dir/all] Error 2
#8 14.99 make[1]: *** Waiting for unfinished jobs....
#8 15.00 [  9%] Building C object src/coloring/CMakeFiles/coloring.dir/bipartite.c.o
#8 15.16 [ 10%] Building CXX object src/coloring/CMakeFiles/coloring.dir/bipartite_driver.cpp.o
#8 20.90 [ 10%] Built target circuits
#8 20.91 [ 10%] Building C object src/coloring/CMakeFiles/coloring.dir/edgeColoring.c.o
#8 21.13 [ 11%] Building CXX object src/coloring/CMakeFiles/coloring.dir/edgeColoring_driver.cpp.o
#8 22.23 [ 11%] Building CXX object src/coloring/CMakeFiles/coloring.dir/edgeColoring.cpp.o
#8 23.29 [ 11%] Built target traversal
#8 30.03 [ 11%] Built target coloring
#8 30.03 make: *** [Makefile:136: all] Error 2
#8 ERROR: process "/bin/sh -c echo \"Extracting pgrouting\"     && tar -xvzf pgrouting.tar.gz     && cd pgrouting-*     && mkdir build     && cd build     && cmake ..     && make -j4     && make install     && cd ../..     && rm -rf pgrouting*" did not complete successfully: exit code: 2
------
 > [4/4] RUN echo "Extracting pgrouting"     && tar -xvzf pgrouting.tar.gz     && cd pgrouting-*     && mkdir build     && cd build     && cmake ..     && make -j4     && make install     && cd ../..     && rm -rf pgrouting*:
14.99 make[1]: *** Waiting for unfinished jobs....
15.00 [  9%] Building C object src/coloring/CMakeFiles/coloring.dir/bipartite.c.o
15.16 [ 10%] Building CXX object src/coloring/CMakeFiles/coloring.dir/bipartite_driver.cpp.o
20.90 [ 10%] Built target circuits
20.91 [ 10%] Building C object src/coloring/CMakeFiles/coloring.dir/edgeColoring.c.o
21.13 [ 11%] Building CXX object src/coloring/CMakeFiles/coloring.dir/edgeColoring_driver.cpp.o
22.23 [ 11%] Building CXX object src/coloring/CMakeFiles/coloring.dir/edgeColoring.cpp.o
23.29 [ 11%] Built target traversal
30.03 [ 11%] Built target coloring
30.03 make: *** [Makefile:136: all] Error 2
------

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions