Skip to content

[Build Issue] Building OSRM with cmake on MacOS fails - Preprocessor Guard Suggested #6589

@AlTimofeyev

Description

@AlTimofeyev

Issue

I was trying to build OSRM project for GSoC following the Wiki Instructions on MacOS Version 13.2.1. The build fails with error every time I try to build:

error: variable 'block_counter' set but not used [-Werror,-Wunused-but-set-variable]
        unsigned block_counter = 0;

Possible Solution

From doing a quick search, I think commenting out or removing the unused variable from the following location, osrm-backend/include/util/range_table.hpp:82:18, might fix this issue? Following the call-back history:

  • osrm-backend/src/extractor/edge_based_graph_factory.cpp:4
  • osrm-backend/include/extractor/files.hpp:8
  • osrm-backend/include/extractor/serialization.hpp:6
  • osrm-backend/include/extractor/intersection_bearings_container.hpp:8
  • osrm-backend/include/util/range_table.hpp:82:18

Better possible solution proposed in comment directly below this post.

Steps to reproduce

  • Download OSRM project using git clone

  • Following Wiki instructions:

    cd osrm-backend
    
    mkdir -p build
    cd build
    cmake .. -DCMAKE_BUILD_TYPE=Release
    cmake --build .
    cmake --build . --target install
  • On the cmake .. -DCMAKE_BUILD_TYPE=Release step, the following Tests/Flags fail or are deprecated/unsuported:

    ♥ ➜ cmake .. -DCMAKE_BUILD_TYPE=Release
    CMake Deprecation Warning at CMakeLists.txt:53 (cmake_policy):
       The OLD behavior for policy CMP0048 will be removed from a future version
       of CMake.
       
       The cmake-policies(7) manual explains that the OLD behaviors of all
       policies are deprecated and that a policy should be set to OLD only under
       specific short-term circumstances.  Projects should be ported to the NEW
       behavior and not rely on setting a policy to OLD.
    
    -- The C compiler identification is AppleClang 14.0.3.14030022
    -- The CXX compiler identification is AppleClang 14.0.3.14030022
    -- 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
    
    [... Skipping Successful Portions to Save Space ...]
    
    -- Performing Test SUPPORTS_CXXFLAG_duplicated_cond
    -- Performing Test SUPPORTS_CXXFLAG_duplicated_cond - Failed
    -- Performing Test SUPPORTS_CFLAG_duplicated_cond
    -- Performing Test SUPPORTS_CFLAG_duplicated_cond - Failed
    -- Flag -Wduplicated-cond is unsupported
    -- Flag -Wduplicated-cond is unsupported
    
    [... Skipping Successful Portions to Save Space ...]
    
    -- Performing Test SUPPORTS_CXXFLAG_bool_compare
    -- Performing Test SUPPORTS_CXXFLAG_bool_compare - Failed
    -- Performing Test SUPPORTS_CFLAG_bool_compare
    -- Performing Test SUPPORTS_CFLAG_bool_compare - Failed
    -- Flag -Wbool-compare is unsupported
    -- Flag -Wbool-compare is unsupported
    
    [... Skipping Successful Portions to Save Space ...]
    
    -- Performing Test SUPPORTS_CXXFLAG_logical_op
    -- Performing Test SUPPORTS_CXXFLAG_logical_op - Failed
    -- Performing Test SUPPORTS_CFLAG_logical_op
    -- Performing Test SUPPORTS_CFLAG_logical_op - Failed
    -- Flag -Wlogical-op is unsupported
    -- Flag -Wlogical-op is unsupported
    -- Performing Test SUPPORTS_CXXFLAG_maybe_uninitialized
    -- Performing Test SUPPORTS_CXXFLAG_maybe_uninitialized - Failed
    -- Performing Test SUPPORTS_CFLAG_maybe_uninitialized
    -- Performing Test SUPPORTS_CFLAG_maybe_uninitialized - Failed
    -- Flag -Wmaybe-uninitialized is unsupported
    -- Flag -Wmaybe-uninitialized is unsupported
    
    [... Skipping Successful Portions to Save Space ...]
    
    -- Performing Test SUPPORTS_CXXFLAG_no_return_local_addr
    -- Performing Test SUPPORTS_CXXFLAG_no_return_local_addr - Failed
    -- Performing Test SUPPORTS_CFLAG_no_return_local_addr
    -- Performing Test SUPPORTS_CFLAG_no_return_local_addr - Failed
    -- Flag -Wno-return-local-addr is unsupported
    -- Flag -Wno-return-local-addr is unsupported
    
    [... Skipping Successful Portions to Save Space ...]
    
    -- Performing Test SUPPORTS_CXXFLAG_trampolines
    -- Performing Test SUPPORTS_CXXFLAG_trampolines - Failed
    -- Performing Test SUPPORTS_CFLAG_trampolines
    -- Performing Test SUPPORTS_CFLAG_trampolines - Failed
    -- Flag -Wtrampolines is unsupported
    -- Flag -Wtrampolines is unsupported
    
    [... Skipping Successful Portions to Save Space ...]
    
    CMake Deprecation Warning at third_party/flatbuffers/CMakeLists.txt:1 (cmake_minimum_required):
       Compatibility with CMake < 2.8.12 will be removed from a future version of
       CMake.
       
       Update the VERSION argument <min> value or use a ...<max> suffix to tell
       CMake that the project does not need compatibility with older versions.
    
    -- Looking for strtof_l
    -- Looking for strtof_l - not found
    -- Looking for strtoull_l
    -- Looking for strtoull_l - not found

    All other tests in this phase completed Successfully.

  • On the cmake --build . step, the results looks like this:

    ♥ ➜ cmake --build .
    [  0%] Building CXX object CMakeFiles/UTIL.dir/src/util/assert.cpp.o
    [  0%] Building CXX object CMakeFiles/UTIL.dir/src/util/conditional_restrictions.cpp.o
    [  0%] Building CXX object CMakeFiles/UTIL.dir/src/util/coordinate.cpp.o
    [  0%] Building CXX object CMakeFiles/UTIL.dir/src/util/coordinate_calculation.cpp.o
    [  4%] Building CXX object CMakeFiles/UTIL.dir/src/util/exception.cpp.o
    [  4%] Building CXX object CMakeFiles/UTIL.dir/src/util/fingerprint.cpp.o
    [  4%] Building CXX object CMakeFiles/UTIL.dir/src/util/geojson_debug_policies.cpp.o
    [  4%] Building CXX object CMakeFiles/UTIL.dir/src/util/guidance/bearing_class.cpp.o
    [  4%] Building CXX object CMakeFiles/UTIL.dir/src/util/guidance/entry_class.cpp.o
    [  4%] Building CXX object CMakeFiles/UTIL.dir/src/util/guidance/turn_lanes.cpp.o
    [  4%] Building CXX object CMakeFiles/UTIL.dir/src/util/log.cpp.o
    [  8%] Building CXX object CMakeFiles/UTIL.dir/src/util/opening_hours.cpp.o
    [  8%] Building CXX object CMakeFiles/UTIL.dir/src/util/timed_histogram.cpp.o
    [  8%] Building CXX object CMakeFiles/UTIL.dir/src/util/timezones.cpp.o
    [  8%] Built target UTIL
    [ 13%] Building CXX object CMakeFiles/EXTRACTOR.dir/src/extractor/compressed_edge_container.cpp.o
    [ 13%] Building CXX object CMakeFiles/EXTRACTOR.dir/src/extractor/edge_based_graph_factory.cpp.o
    In file included from /Users/altimofeyev/Documents/Programming/GitHub/osrm-backend/src/extractor/edge_based_graph_factory.cpp:4:
    In file included from /Users/altimofeyev/Documents/Programming/GitHub/osrm-backend/include/extractor/files.hpp:8:
    In file included from /Users/altimofeyev/Documents/Programming/GitHub/osrm-backend/include/extractor/serialization.hpp:6:
    In file included from /Users/altimofeyev/Documents/Programming/GitHub/osrm-backend/include/extractor/intersection_bearings_container.hpp:8:
    /Users/altimofeyev/Documents/Programming/GitHub/osrm-backend/include/util/range_table.hpp:82:18: error: variable 'block_counter' set but not used [-Werror,-Wunused-but-set-variable]
         unsigned block_counter = 0;
                  ^
    1 error generated.
    make[2]: *** [CMakeFiles/EXTRACTOR.dir/src/extractor/edge_based_graph_factory.cpp.o] Error 1
    make[1]: *** [CMakeFiles/EXTRACTOR.dir/all] Error 2
    make: *** [all] Error 2

Specifications

Development Environment.

  • MacOS 13.2.1
  • Homebrew installed these packages following wiki instructions:
    brew install boost git cmake libzip libxml2 lua tbb ccache GDAL
  • gcc-12/g++-12 already installed for c++ compiler.

Similar Issue

I found a couple similar issues related to building OSRM on MacOS:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions