osrm-backend
osrm-backend copied to clipboard
Link libosrm_guidance correctly and work around circular dependencies
Fixes #6954
Issue
Building shared libraries on macOS fails, because there is no target_link_libraries call for osrm_guidance to tell it what external and internal libraries to link against. This works on Linux because the linker assumes undefined symbols will be defined at runtime, but macOS checks that the symbols are defined at link time. This PR adds the target_link_libraries call.
This creates another problem in that there is a circular dependency between osrm_guidance and osrm_extract. osrm_guidance calls a lot of functions from osrm_extract, and osrm_extract only calls two from osrm_guidance. So I fix this by specifying linker options to tell the linker to resolve those two functions at runtime. I've only tested this with clang on macOS, but I think it should work on other platforms as well. It looks like the CI currently doesn't try to build shared libraries on any platform, perhaps we should change that?
Tasklist
- [x] CHANGELOG.md entry (How to write a changelog entry)
- N/A update relevant Wiki pages
- N/A add tests (see testing documentation)
- [ ] review
- [ ] adjust for comments
- [ ] cherry pick to release branch
Requirements / Relations
None