pgRouting / pgrouting

Repository contains pgRouting library. Development branch is "develop", stable branch is "master"
https://pgrouting.org
GNU General Public License v2.0
1.12k stars 364 forks source link

Build failed on develop branch in M1 Mac Pro + Homebrew environment #2616

Closed sanak closed 2 months ago

sanak commented 4 months ago

Problem From the following PR's comment. https://github.com/pgRouting/pgrouting/pull/2607#issuecomment-1921719270

``` : [ 60%] Built target bellman_ford [ 61%] Building CXX object src/cpp_common/CMakeFiles/cpp_common.dir/Dmatrix.cpp.o [ 61%] Building CXX object src/cpp_common/CMakeFiles/cpp_common.dir/compPaths.cpp.o [ 62%] Building CXX object src/cpp_common/CMakeFiles/cpp_common.dir/rule.cpp.o [ 62%] Building CXX object src/cpp_common/CMakeFiles/cpp_common.dir/bpoint.cpp.o [ 63%] Building CXX object src/cpp_common/CMakeFiles/cpp_common.dir/pgr_messages.cpp.o [ 63%] Building CXX object src/cpp_common/CMakeFiles/cpp_common.dir/combinations.cpp.o In file included from /Users/sanak/Projects/pgRouting/git/pgrouting/src/cpp_common/combinations.cpp:27: In file included from /Users/sanak/Projects/pgRouting/git/pgrouting/include/cpp_common/combinations.hpp:46: In file included from /Users/sanak/Projects/pgRouting/git/pgrouting/include/cpp_common/basePath_SSEC.hpp:44: In file included from /opt/homebrew/include/boost/graph/adjacency_list.hpp:20: In file included from /opt/homebrew/include/boost/unordered_set.hpp:17: In file included from /opt/homebrew/include/boost/unordered/unordered_set.hpp:17: In file included from /opt/homebrew/include/boost/unordered/detail/serialize_fca_container.hpp:12: In file included from /opt/homebrew/include/boost/unordered/detail/serialize_container.hpp:13: In file included from /opt/homebrew/include/boost/throw_exception.hpp:21: In file included from /opt/homebrew/include/boost/exception/exception.hpp:9: /opt/homebrew/include/boost/assert/source_location.hpp:95:9: error: no member named 'snprintf' in namespace 'std'; did you mean simply 'snprintf'? BOOST_ASSERT_SNPRINTF( buffer, ":%lu", ln ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/homebrew/include/boost/assert/source_location.hpp:79:53: note: expanded from macro 'BOOST_ASSERT_SNPRINTF' # define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::snprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), format, arg) ^~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:337:6: note: 'snprintf' declared here int snprintf(char * __restrict __str, size_t __size, const char * __restrict __format, ...) __printflike(3, 4); ^ In file included from /Users/sanak/Projects/pgRouting/git/pgrouting/src/cpp_common/combinations.cpp:27: In file included from /Users/sanak/Projects/pgRouting/git/pgrouting/include/cpp_common/combinations.hpp:46: In file included from /Users/sanak/Projects/pgRouting/git/pgrouting/include/cpp_common/basePath_SSEC.hpp:44: In file included from /opt/homebrew/include/boost/graph/adjacency_list.hpp:20: In file included from /opt/homebrew/include/boost/unordered_set.hpp:17: In file included from /opt/homebrew/include/boost/unordered/unordered_set.hpp:17: In file included from /opt/homebrew/include/boost/unordered/detail/serialize_fca_container.hpp:12: In file included from /opt/homebrew/include/boost/unordered/detail/serialize_container.hpp:13: In file included from /opt/homebrew/include/boost/throw_exception.hpp:21: In file included from /opt/homebrew/include/boost/exception/exception.hpp:9: /opt/homebrew/include/boost/assert/source_location.hpp:102:13: error: no member named 'snprintf' in namespace 'std'; did you mean simply 'snprintf'? BOOST_ASSERT_SNPRINTF( buffer, ":%lu", co ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/homebrew/include/boost/assert/source_location.hpp:79:53: note: expanded from macro 'BOOST_ASSERT_SNPRINTF' # define BOOST_ASSERT_SNPRINTF(buffer, format, arg) std::snprintf(buffer, sizeof(buffer)/sizeof(buffer[0]), format, arg) ^~~~~ /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/stdio.h:337:6: note: 'snprintf' declared here int snprintf(char * __restrict __str, size_t __size, const char * __restrict __format, ...) __printflike(3, 4); ^ 2 errors generated. make[2]: *** [src/cpp_common/CMakeFiles/cpp_common.dir/combinations.cpp.o] Error 1 make[1]: *** [src/cpp_common/CMakeFiles/cpp_common.dir/all] Error 2 make: *** [all] Error 2 ```

To Reproduce

git checkout develop
git pull
mkdir build
cd build
cmake ../
make

Expectation Build should be passed.

Workaround patch is here.

--- a/src/cpp_common/combinations.cpp
+++ b/src/cpp_common/combinations.cpp
@@ -24,12 +24,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

  ********************************************************************PGR-GNU*/

-#include "cpp_common/combinations.hpp"
-
 #include <map>
 #include <set>
 #include <deque>
 #include <vector>
+#include "cpp_common/combinations.hpp"
 #include "cpp_common/pgdata_getters.hpp"
 #include "cpp_common/basePath_SSEC.hpp"

Platform/versions

CMake log ``` -- Setting build type to 'Release' as none was specified. -- CMAKE_BUILD_TYPE Release -- The C compiler identification is AppleClang 15.0.0.15000100 -- The CXX compiler identification is AppleClang 15.0.0.15000100 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Git: /opt/homebrew/bin/git (found version "2.43.0") -- DOXYGEN_MINIMUM_VERSION=1.7 -- SPHINX_MINIMUM_VERSION=4.0 -- POSTGRESQL_MINIMUM_VERSION=9.2.0 -- BOOST_MINIMUM_VERSION=1.56.0 -- POSTGIS_MINIMUM_VERSION=2.0.0 -- Found Boost: /opt/homebrew/lib/cmake/Boost-1.84.0/BoostConfig.cmake (found suitable version "1.84.0", minimum required is "1.56.0") -- Found Perl: /opt/homebrew/bin/perl (found version "5.38.2") -- POSTGRESQL_PG_CONFIG is /opt/homebrew/bin/pg_config -- POSTGRESQL_EXECUTABLE is /opt/homebrew/Cellar/postgresql@14/14.10_1/bin/postgres -- POSTGRESQL_VERSION_STRING in FindPostgreSQL.cmake is PostgreSQL 14.10 (Homebrew) -- POSTGRESQL_INCLUDE_DIR: /opt/homebrew/include/postgresql@14/server -- POSTGRESQL_LIBRARIES: /opt/homebrew/lib/postgresql@14 -- POSTGRESQL_VERSION_STRING=PostgreSQL 14.10 (Homebrew) -- POSTGRESQL_VERSION=14.10 -- PGSQL_VERSION=1410 -- LIBRARY_INSTALL_PATH /opt/homebrew/lib/postgresql@14 -- Performing Test C_COMPILER_SUPPORTS_FPIC -- Performing Test C_COMPILER_SUPPORTS_FPIC - Success -- Performing Test CXX_COMPILER_SUPPORTS_FPIC -- Performing Test CXX_COMPILER_SUPPORTS_FPIC - Success -- Configuring done (3.1s) -- Generating done (0.2s) -- Build files have been written to: /Users/sanak/Projects/pgRouting/git/pgrouting/build ```
sanak commented 4 months ago

I could reproduce the error on CI by replacing macOS CI as follows. commit diff: https://github.com/sanak/pgrouting/commit/f09e67842d24f4776807fc7f5501553cb3feec1d

--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -41,7 +41,7 @@ permissions:
 jobs:
   build:
     name: macos
-    runs-on: macos-latest
+    runs-on: macos-14

     steps:
       - name: Checkout repository

From the actions log, macos-latest seems to use older version in GitHub Actions.

And the official document also mentioned about that. https://docs.github.com/ja/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories


@pgRouting/admins Related with this issue, I am thinking to update macos CI with OS 12,13,14 matrix, but is that okay ? I also want to recover Install pgTAP and Test jobs in macos CI.

sanak commented 2 months ago

This has been fixed and merged via #2626, so I close this issue.