osrm-backend: way:id() from lua causes Abort trap: 6
Getting the OSM way id from lua used to work, but now I can’t get it to work anymore with v5.2.6. Using this way function:
function way_function (way, result)
local id = way:id()
end
I get this error when extracting:
~/code/osrm-backend/sandbox$ (green_v5 *) ../build/osrm-extract mid.osm.pbf --profile ../profiles/testbot.lua
[info] Using script ../profiles/testbot.lua
[info] Input file: mid.osm.pbf
[info] Profile: testbot.lua
[info] Threads: 4
[STXXL-MSG] STXXL v1.4.1 (prerelease/Release)
[STXXL-ERRMSG] Warning: no config file found.
[STXXL-ERRMSG] Using default disk configuration.
[STXXL-MSG] Disk '/var/tmp/stxxl' is allocated, space: 1000 MiB, I/O implementation: syscall autogrow delete_on_exit queue=0 devid=0
[info] Parsing in progress..
[info] input file generated by 0.44.1
[info] timestamp: n/a
[info] Found no exceptions to turn restrictions
libc++abi.dylib: terminating with uncaught exception of type osrm::util::exception: ERROR occurred in profile script:
std::runtime_error: 'Trying to use unregistered class'
Abort trap: 6
scripting_environment.cpp does seem to link id() to an osmium method:
luabind::class_<osmium::Way>("Way")
.def("get_value_by_key", &osmium::Way::get_value_by_key)
.def("get_value_by_key", &get_value_by_key<osmium::Way>)
.def("id", &osmium::Way::id)
.def("get_nodes", get_nodes_for_way, luabind::return_stl_iterator),
Am I missing something?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (13 by maintainers)
Commits related to this issue
- Let Travis test way:id() inside the way_function For https://github.com/Project-OSRM/osrm-backend/issues/2590. — committed to Project-OSRM/osrm-backend by daniel-j-h 8 years ago
it works with lua 5.1. to sum up:
to access way:id() from lua on os x, you must use lua 5.1 and the mapbox branch of luabind. luabind installed via brew does not work. and mapbox fork of luabind will not build with lua 5.2.
remove old versions
brew uninstall lua brew uninstall lua51 brew uninstall luabind
install lua
brew install lua51
install mapbox luabind fork
git clone https://github.com/mapbox/luabind.git cd luabind mkdir build cd build cmake … -DCMAKE_BUILD_TYPE=Release make install
then rebuild osrm
cd osrm rm -r build mkdir build cd build cmake … -DCMAKE_BUILD_TYPE=Release cmake --build .