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

[OSRM] Add new binary, second try... #8893

Draft
wants to merge 46 commits into
base: master
Choose a base branch
from

Conversation

jeremiahpslewis
Copy link
Contributor

No description provided.

@jeremiahpslewis
Copy link
Contributor Author

Error on x86-64-linux-gnu-cxx11:

[ Info: Checking shared library lib/libosrm.so
--
ERROR: could not load library "/cache/build/yggy-amdci7-8/julialang/yggdrasil/O/OSRM/build/x86_64-linux-gnu-cxx11/ZsPx5jB0/x86_64-linux-gnu-libgfortran5-cxx11/destdir/lib/libosrm.so"
  | /cache/julia-buildkite-plugin/julia_installs/bin/linux/x64/1.7/julia-1.7-latest-linux-x86_64/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.31' not found (required by /cache/build/yggy-amdci7-8/julialang/yggdrasil/O/OSRM/build/x86_64-linux-gnu-cxx11/ZsPx5jB0/x86_64-linux-gnu-libgfortran5-cxx11/destdir/lib/libosrm.so)
  | ┌ Warning: lib/libosrm.so cannot be dlopen()'ed

@jeremiahpslewis
Copy link
Contributor Author

Error on *-apple-* builds:

ld64.lld: error: undefined symbol: osrm::extractor::CompressedEdgeContainer::GetBucketReference(unsigned int) const

@imciner2
Copy link
Member

Error on x86-64-linux-gnu-cxx11

That is because it is using GCC 13, so it gets linked against a newer glibcxx version because that is what ships with it. You need to lower the GCC version requested to get around this.

@jeremiahpslewis
Copy link
Contributor Author

Error on x86-64-linux-gnu-cxx11

That is because it is using GCC 13, so it gets linked against a newer glibcxx version because that is what ships with it. You need to lower the GCC version requested to get around this.

If I lower GCC below v12, other target builds break. Is there another strategy for dealing with this issue (I don't exactly understand what the problem is...all of the dependencies were built with earlier GCC versions).

@jeremiahpslewis
Copy link
Contributor Author

jeremiahpslewis commented Jun 15, 2024

Hey @mattwigway!

  1. you have write access to this branch and should feel free to modify it as necessary.
  2. I added your gcc modification to my CMakeList.txt patch
  3. Using clang for all builds seems strictly better
  4. The remaining errors which I encounter don't seem related to boost versions. They are as follows:

-apple-

[20:49:20] ld64.lld: error: undefined symbol: osrm::extractor::CompressedEdgeContainer::GetBucketReference(unsigned int) const

-mingw-

warning "__STRICT_ANSI__ seems to have been undefined; this is not supported"�[39m
  • This is a problem, as the mingw symbols which we need to build are only available when __STRICT_ANSI__ is undefined. Until Ygg ships a more recent version of mingw, (maybe with the upcoming BinaryBuilder redo) it's probably best to just drop windows.

x86_64-linux-gnu-cxx11

<head></head>
[ Info: Checking shared library lib/libosrm_extract.so
--
  | ERROR: could not load library "/cache/build/yggy-amdci7-14/julialang/yggdrasil/O/OSRM/build/x86_64-linux-gnu-cxx11/Sjda2mna/x86_64-linux-gnu-libgfortran5-cxx11/destdir/lib/libosrm_extract.so"
  | /cache/julia-buildkite-plugin/julia_installs/bin/linux/x64/1.7/julia-1.7-latest-linux-x86_64/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /cache/build/yggy-amdci7-14/julialang/yggdrasil/O/OSRM/build/x86_64-linux-gnu-cxx11/Sjda2mna/x86_64-linux-gnu-libgfortran5-cxx11/destdir/lib/libosrm_extract.so)
  | ┌ Warning: lib/libosrm_extract.so cannot be dlopen()'ed

- dlopen issues, which I wonder if we can solve by setting the appropriate binaries to dont_dlopen=true

Worth seeing whether we can get this thing to build with gcc10

@giordano
Copy link
Member

dlopen issues, which I wonder if we can solve by setting the appropriate binaries to dont_dlopen=true

Ignoring an issue doesn't solve it. You simply can't build a library with a recent compiler and load it with an older runtime. There's no way around it: just don't do it.

@jeremiahpslewis
Copy link
Contributor Author

dlopen issues, which I wonder if we can solve by setting the appropriate binaries to dont_dlopen=true

Ignoring an issue doesn't solve it. You simply can't build a library with a recent compiler and load it with an older runtime. There's no way around it: just don't do it.

Why do I get an older runtime when I set the build gcc to v12?

@giordano
Copy link
Member

Why do I get an older runtime when I set the build gcc to v12?

The runtime is used....at run time, not during the build. It's the gcc runtime shipped with Julia v1.7, which was released months before GCC 12 was a thing. This is the whole point of the compatibility section in the CONTRIBUTING.md file.

@mattwigway
Copy link
Contributor

So based on the contributing.md document, it seems like Clang doesn't have the same problem with runtime version incompatibilities that gcc does, so maybe that's a solution? Otherwise I'm okay making this only supported on more recent Julia, as it's a fairly specialized package.

@giordano
Copy link
Member

it seems like Clang doesn't have the same problem with runtime version incompatibilities that gcc does, so maybe that's a solution?

Wrong, clang on Linux uses gcc runtime.

@mattwigway
Copy link
Contributor

FWIW, here are the missing symbols in the Mac build, demangled (with llvm-cxxfilt):

tbb::detail::r1::initialize(tbb::detail::d1::task_group_context&)
tbb::detail::r1::allocate_memory(unsigned long)
tbb::detail::r1::set_end_of_input(tbb::detail::d1::base_filter&)
tbb::detail::r1::deallocate_memory(void*)
tbb::detail::r1::parallel_pipeline(tbb::detail::d1::task_group_context&, unsigned long, tbb::detail::d1::filter_node const&)
tbb::detail::r1::destroy(tbb::detail::d1::task_group_context&)
osrm::extractor::SuffixTable::isSuffix(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) const
osrm::extractor::RestrictionGraph::GetRestrictions(unsigned long long) const
osrm::extractor::WayRestrictionMap::IsRestricted(unsigned long long, unsigned int) const
osrm::extractor::WayRestrictionMap::IsViaWayEdge(unsigned int, unsigned int) const
osrm::extractor::WayRestrictionMap::GetRestrictions(unsigned long long, unsigned int) const
osrm::extractor::WayRestrictionMap::DuplicatedNodeIDs(unsigned int, unsigned int) const
osrm::extractor::CompressedEdgeContainer::HasEntryForID(unsigned int) const
osrm::extractor::CompressedEdgeContainer::GetBucketReference(unsigned int) const

I'm not sure why these are missing, all the osrm:: ones I've checked are defined in both .cpp and .h files. I don't have time tonight, but I'm going to try the build locally and look at the built artifacts to see if anything looks suspicious.

@mattwigway
Copy link
Contributor

So, the Mac build failures do appear to be linker problems. All of the osrm::* missing symbols are in fact defined in compiled .o files. The tbb ones are not, but I wouldn't expect them to be—they should be in .so files (I haven't specifically looked for them there). I'm going to see if I can figure out why the linker isn't finding the symbols.

@mattwigway
Copy link
Contributor

So, what these symbols have in common is that they're all symbols that come from other dynamic libraries, rather than from .o files being linked into the current dynamic library. So I think this is an rpath issue.

@mattwigway
Copy link
Contributor

mattwigway commented Jun 18, 2024

Builds are now succeeding on macOS and Linux. We had to set dont_dlopen because OSRM can only be built with GCC 12+, and that's not compatible with the Julia 1.7 used in CI. I confirmed that the built artifacts work on Julia 1.8, and julia_compat is set to 1.8. Perhaps in a future BinaryBuilder the dlopen() test could happen with the julia version specified in compat—I'm happy to take a look at that if desired.

There are a few more steps before merge:

  • We're using a significantly different build configuration than stock OSRM (single monolithic dylib, instead of five or six circularly-dependent dylibs), I'm waiting for upstream feedback on whether this will get mainlined (Link libosrm_guidance correctly and work around circular dependencies Project-OSRM/osrm-backend#6955)
  • To use OSRM.jl from Julia requires a C++ shim. I'm building packages locally and am going to confirm that the C++ shim works with the built packages.
  • I assume we probably want to squash all the commits to avoid polluting the main branch (maybe create a copy of this branch first for archival reasons)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants