Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build shared libraries on macOS #6954

Open
mattwigway opened this issue Jun 17, 2024 · 0 comments · May be fixed by #6955
Open

Can't build shared libraries on macOS #6954

mattwigway opened this issue Jun 17, 2024 · 0 comments · May be fixed by #6955

Comments

@mattwigway
Copy link
Contributor

mattwigway commented Jun 17, 2024

Issue

The OSRM build errors when attempting to build with -DBUILD_SHARED_LIBS=on on macOS. Specifically, there are undefined symbols when linking libosrm_guidance. We get this error:

Undefined symbol error
[ 82%] Linking CXX shared library libosrm_guidance.dylib
Undefined symbols for architecture arm64:
  "tbb::detail::r1::initialize(tbb::detail::d1::task_group_context&)", referenced from:
      osrm::guidance::annotateTurns(osrm::util::DynamicGraph const&, osrm::extractor::detail::EdgeBasedNodeDataContainerImpl<(osrm::storage::Ownership)0> const&, std::__1::vector> const&, osrm::extractor::CompressedEdgeContainer const&, std::__1::unordered_set, std::__1::equal_to, std::__1::allocator> const&, osrm::extractor::NodeRestrictionMap const&, osrm::extractor::WayRestrictionMap const&, osrm::extractor::detail::NameTableImpl<(osrm::storage::Ownership)0> const&, osrm::extractor::SuffixTable const&, std::__1::tuple>, std::__1::vector>> const&, osrm::util::ConcurrentIDMap>, unsigned short, std::__1::hash>>>&, osrm::util::ConcurrentIDMap>&, osrm::guidance::detail::TurnDataContainerImpl<(osrm::storage::Ownership)2>&, std::__1::vector>&, osrm::util::ConcurrentIDMap>&, osrm::util::ConcurrentIDMap>&, unsigned int&) in guidance_processing.cpp.o
...many more, github says I can't have a comment that long...

I believe the issue is that there is no target_link_libraries for osrm_guidance so it doesn't know where to find the symbols. This works fine on Linux, as on Linux the linker just (dangerously) assumes that any undefined symbols at link-time will be available at runtime. The macOS linker does not. I have a patch to fix this, will submit a PR shortly.

Steps to reproduce

  • Clone master
mkdir build
cd build
cmake .. -DBUILD_SHARED_LIBS=ON
cmake --build .

Specifications

Please provide details of your development environment.

  • macOS 14.5
  • Apple M1
  • AppleClang 15.0.0
mattwigway added a commit to mattwigway/osrm-backend that referenced this issue Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant