Telenav / osrm-backend

Open Source Routing Machine - C++ backend
http://map.project-osrm.org
BSD 2-Clause "Simplified" License
18 stars 7 forks source link

Build error on mac OS due to Apple Clang 12 #385

Closed wangyoucao577 closed 3 years ago

wangyoucao577 commented 3 years ago

Logs

-- The C compiler identification is AppleClang 12.0.0.12000032
-- The CXX compiler identification is AppleClang 12.0.0.12000032

# ... 

[ 82%] Building CXX object CMakeFiles/ENGINE.dir/src/engine/search_engine_data.cpp.o
/Users/runner/work/osrm-backend/osrm-backend/src/guidance/segregated_intersection_classification.cpp:229:26: error: loop variable 'e' is always a copy because the range of type 'const osrm::util::range<unsigned int>' does not return a reference [-Werror,-Wrange-loop-analysis]
        for (auto const &e : edges1)
                         ^
/Users/runner/work/osrm-backend/osrm-backend/src/guidance/segregated_intersection_classification.cpp:262:29: note: in instantiation of function template specialization 'osrm::guidance::findSegregatedNodes(const extractor::NodeBasedGraphFactory &, const extractor::NameTable &)::(anonymous class)::operator()<osrm::util::range<unsigned int> >' requested here
                            collect_edge_info_fn(edges1, node2),
                            ^
/Users/runner/work/osrm-backend/osrm-backend/src/guidance/segregated_intersection_classification.cpp:284:31: note: in instantiation of function template specialization 'osrm::guidance::findSegregatedNodes(const extractor::NodeBasedGraphFactory &, const extractor::NameTable &)::(anonymous class)::operator()<osrm::util::NodeBasedEdgeData, osrm::util::range<unsigned int>, osrm::util::range<unsigned int> >' requested here
            if (isSegregatedFn(
                              ^
/Users/runner/work/osrm-backend/osrm-backend/src/guidance/segregated_intersection_classification.cpp:229:14: note: use non-reference type 'unsigned int'
        for (auto const &e : edges1)
             ^~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/GUIDANCE.dir/src/guidance/segregated_intersection_classification.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/GUIDANCE.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 82%] Built target CONTRACTOR
/Users/runner/work/osrm-backend/osrm-backend/src/util/timezones.cpp:157:21: error: loop variable 'v' of type 'const std::__1::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::spherical_equatorial<boost::geometry::degree> > >, unsigned long>' creates a copy from type 'const std::__1::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::spherical_equatorial<boost::geometry::degree> > >, unsigned long>' [-Werror,-Wrange-loop-analysis]
    for (const auto v : result)
                    ^
/Users/runner/work/osrm-backend/osrm-backend/src/util/timezones.cpp:157:10: note: use reference type 'const std::__1::pair<boost::geometry::model::box<boost::geometry::model::point<double, 2, boost::geometry::cs::spherical_equatorial<boost::geometry::degree> > >, unsigned long> &' to prevent copying
    for (const auto v : result)
         ^~~~~~~~~~~~~~
                    &
[ 82%] Built target STORAGE
[ 82%] Built target CUSTOMIZER
[ 82%] Built target PARTITIONER
1 error generated.
make[2]: *** [CMakeFiles/UTIL.dir/src/util/timezones.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 82%] Built target ENGINE
[ 82%] Built target UPDATER
make[1]: *** [CMakeFiles/UTIL.dir/all] Error 2
[ 82%] Built target EXTRACTOR
[ 82%] Built target SERVER
make: *** [all] Error 2
Error: Process completed with exit code 2.
11s

See more details in https://github.com/Telenav/osrm-backend/runs/1345307096?check_suite_focus=true

wangyoucao577 commented 3 years ago

It's same with issue https://github.com/Project-OSRM/osrm-backend/issues/5864 that occurred when upgrade to latest Apple Clang 12. We met this issue is because Github macos latest runner has upgraded the clang version.