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

[Build Issue] Linker error while trying to build osrm on Mac M1 #6566

Closed
bb-santoshbanerjee opened this issue Mar 5, 2023 · 6 comments
Closed
Labels

Comments

@bb-santoshbanerjee
Copy link

I'm running into the following Linker issue, but not sure about the correct way to go about fixing it.
Any pointers to get this resolved?

[1/1] Linking CXX executable osrm-extract
FAILED: osrm-extract
: && ccache /Library/Developer/CommandLineTools/usr/bin/c++ -Wall -Wextra -Wpedantic -Werror -Wstrict-overflow=2 -Wsuggest-override -Wsuggest-destructor-override -Wunused -Wunreachable-code -Wdelete-incomplete -Wdisabled-optimization -Winit-self -Wlogical-not-parentheses -Wmisleading-indentation -Wodr -Wpointer-arith -Wredundant-decls -Wreorder -Wshift-negative-value -Wsizeof-array-argument -Wswitch-bool -Wtautological-compare -Wno-c++17-extensions -Wno-implicit-int-conversion -Wno-implicit-float-conversion -Wno-unused-member-function -Wno-old-style-cast -Wno-non-virtual-dtor -Wno-float-conversion -Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-padded -Wno-missing-noreturn -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics -ftemplate-depth=1024 -g -fno-inline -fno-omit-frame-pointer -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/osrm-extract.dir/src/tools/extract.cpp.o -o osrm-extract  -Wl,-rpath,@loader_path -Wl,-rpath,/opt/homebrew/lib  libosrm_extract.a  /opt/homebrew/lib/libboost_program_options-mt.dylib  libosrm_guidance.a  /opt/homebrew/lib/libboost_regex-mt.dylib  /opt/homebrew/lib/libboost_date_time-mt.dylib  /opt/homebrew/lib/libboost_chrono-mt.dylib  /opt/homebrew/lib/libboost_filesystem-mt.dylib  /opt/homebrew/lib/libboost_atomic-mt.dylib  /opt/homebrew/lib/libboost_iostreams-mt.dylib  /opt/homebrew/lib/libboost_thread-mt.dylib  /opt/homebrew/lib/libboost_system-mt.dylib  /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libbz2.tbd  /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libexpat.tbd  /opt/homebrew/lib/liblua5.4.dylib  /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libz.tbd  /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libbz2.tbd  /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libexpat.tbd  /opt/homebrew/lib/liblua5.4.dylib  /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk/usr/lib/libz.tbd  /opt/homebrew/lib/libtbb.12.8.dylib && :

duplicate symbol 'boost::phoenix::placeholders::uarg9' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg8' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg7' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg6' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg5' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg4' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg3' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg2' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg1' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg10' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(conditional_restrictions.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg9' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg8' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg7' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg6' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg5' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg4' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg3' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg2' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg1' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
duplicate symbol 'boost::phoenix::placeholders::uarg10' in:
    libosrm_extract.a(scripting_environment_lua.cpp.o)
    libosrm_extract.a(opening_hours.cpp.o)
ld: 20 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
@SiarheiFedartsou
Copy link
Member

I guess you use Boost 1.81? You can downgrade as a workaround (or use Conan via -DENABLE_CONAN=ON)

@bb-santoshbanerjee
Copy link
Author

bb-santoshbanerjee commented Mar 9, 2023

I guess you use Boost 1.81? You can downgrade as a workaround (or use Conan via -DENABLE_CONAN=ON)

Thanks for the suggestions, however I seemed to run into a bunch of other issues on Mac. So I just created an Ubuntu 22.04 VM on UTM (on my mac), and tried the build. That further led into the following errors. Not sure why this is happening on Linux. Any ideas?
Screenshot 2023-03-09 at 9 00 22 AM

@AlTimofeyev
Copy link
Contributor

@bb-santoshbanerjee If you're still having this linker error on MacOS, and you're using Homebrew to manage your packages, install boost version 1.76 and it will complete the build process successfully. I ran into the same issue today and this worked for me!

brew install [email protected]

If you have the newer version of boost installed, you might need to relink the Homebrew symlinks to the older version of boost:

brew unlink boost
brew link [email protected]

and then try to re-run the build step again.

@bb-santoshbanerjee
Copy link
Author

Thanks for the reply @AlTimofeyev !
Your suggestion did work. I was able to build it successfully on my Mac.
As a workaround I had installed an Ubuntu VM on UTM and got the OSRM to build there.

@AlTimofeyev
Copy link
Contributor

Nice! Glad I could help out!
I was going to try your approach too, with a VM, if I couldn't get it to build successfully.

@mangerlahn
Copy link

#6709 resolved issues with Boost 1.8x, so this should be fine now?

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

No branches or pull requests

5 participants