daniel-j-h / libosrmc

Pure C bindings for libosrm
MIT License
18 stars 8 forks source link

Unable to build library due to upstream libosrm API breakage #11

Open ghost opened 5 years ago

ghost commented 5 years ago

Hello,

I have just built osrm-routed from source and I want to work on the Python bindings. When I try to build, I am encountering the following:

ubuntu@ip-172-31-10-211:~/libosrmc/libosrmc$ make
g++ -O2 -Wall -Wextra -pedantic -std=c++11 -fvisibility=hidden -fPIC -fno-rtti -std=c++14 -DBOOST_TEST_DYN_LINK -DBOOST_SPIRIT_USE_PHOENIX_V3 -DBOOST_RESULT_OF_USE_DECLTYPE -DBOOST_FILESYSTEM_NO_DEPRECATED -I/usr/include/lua5.2 -I/usr/local/include -I/usr/local/include/osrm   -c -o osrmc.o osrmc.cc
osrmc.cc: In function ‘osrmc_route_response* osrmc_route(osrmc_osrm_t, osrmc_route_params_t, osrmc_error**)’:
osrmc.cc:143:60: error: no matching function for call to ‘osrm::OSRM::Route(osrm::engine::api::RouteParameters&, osrm::util::json::Object&)’
   const auto status = osrm_typed->Route(*params_typed, *out);
                                                            ^
In file included from osrmc.cc:10:0:
/usr/local/include/osrm/osrm.hpp:87:12: note: candidate: osrm::engine::Status osrm::OSRM::Route(const osrm::engine::api::RouteParameters&, osrm::engine::api::ResultT&) const
     Status Route(const RouteParameters &parameters, osrm::engine::api::ResultT &result) const;
            ^~~~~
/usr/local/include/osrm/osrm.hpp:87:12: note:   no known conversion for argument 2 from ‘osrm::util::json::Object’ to ‘osrm::engine::api::ResultT& {aka mapbox::util::variant<osrm::util::json::Object, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, flatbuffers::FlatBufferBuilder>&}’
osrmc.cc: In function ‘void osrmc_route_with(osrmc_osrm_t, osrmc_route_params_t, osrmc_waypoint_handler_t, void*, osrmc_error**)’:
osrmc.cc:161:62: error: no matching function for call to ‘osrm::OSRM::Route(osrm::engine::api::RouteParameters&, osrm::util::json::Object&)’
   const auto status = osrm_typed->Route(*params_typed, result);
                                                              ^
In file included from osrmc.cc:10:0:
/usr/local/include/osrm/osrm.hpp:87:12: note: candidate: osrm::engine::Status osrm::OSRM::Route(const osrm::engine::api::RouteParameters&, osrm::engine::api::ResultT&) const
     Status Route(const RouteParameters &parameters, osrm::engine::api::ResultT &result) const;
            ^~~~~
/usr/local/include/osrm/osrm.hpp:87:12: note:   no known conversion for argument 2 from ‘osrm::util::json::Object’ to ‘osrm::engine::api::ResultT& {aka mapbox::util::variant<osrm::util::json::Object, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, flatbuffers::FlatBufferBuilder>&}’
osrmc.cc: In function ‘osrmc_table_response* osrmc_table(osrmc_osrm_t, osrmc_table_params_t, osrmc_error**)’:
osrmc.cc:278:60: error: no matching function for call to ‘osrm::OSRM::Table(osrm::engine::api::TableParameters&, osrm::util::json::Object&)’
   const auto status = osrm_typed->Table(*params_typed, *out);
                                                            ^
In file included from osrmc.cc:10:0:
/usr/local/include/osrm/osrm.hpp:96:12: note: candidate: osrm::engine::Status osrm::OSRM::Table(const osrm::engine::api::TableParameters&, osrm::engine::api::ResultT&) const
     Status Table(const TableParameters &parameters, osrm::engine::api::ResultT &result) const;
            ^~~~~
/usr/local/include/osrm/osrm.hpp:96:12: note:   no known conversion for argument 2 from ‘osrm::util::json::Object’ to ‘osrm::engine::api::ResultT& {aka mapbox::util::variant<osrm::util::json::Object, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, flatbuffers::FlatBufferBuilder>&}’
osrmc.cc: In function ‘float osrmc_table_response_distance(osrmc_table_response_t, long unsigned int, long unsigned int, osrmc_error**)’:
osrmc.cc:340:36: warning: missing initializer for member ‘osrmc_error::message’ [-Wmissing-field-initializers]
   *error = new osrmc_error{e.what()};
                                    ^
<builtin>: recipe for target 'osrmc.o' failed

What is the best way to resolve this? Thanks!

daniel-j-h commented 5 years ago

Which OSRM version are you trying to compile against? I haven't tested this project in over a year - worst case they introduced breaking API changes.

ghost commented 5 years ago

I am testing 5.22 (the latest release). 5.4 seems to be nearly 3 years out of date at this point unfortunately, so you are probably correct.

daniel-j-h commented 5 years ago

Looks like this commit broke the libosrm API by changing its public interface

https://github.com/Project-OSRM/osrm-backend/commit/75aadb0f3f13c4989c2da5aa5b7fad39fefd01db#diff-e8cabd3a392567e2a889841a1e789cc4

cc @danpat (also did you get my mail? :D)