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

rcl_logging_spdlog breaks the build under libc++ #34

Open
rotu opened this issue May 5, 2020 · 3 comments
Open

rcl_logging_spdlog breaks the build under libc++ #34

rotu opened this issue May 5, 2020 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@rotu
Copy link

rotu commented May 5, 2020

Similar to #14, compilation fails in the linking phase when building with the Clang option -stdlib=libc++.

Ubuntu Focal / Clang 11

Starting >>> rcl
--- stderr: rcl                                       
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
ld.lld: error: ld.lld: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
ld.lld: error: ld.lld: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)
error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)ld.lld
: ld.llderror: : /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)error: 
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lldld.lld: : error: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)

ld.lldld.lld: : error: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)

ld.lldld.lld: : error: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)

ld.lld: ld.llderror: : /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)error: 
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)ld.lld
: ld.llderror: : /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)error: 
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)ld.lld
: ld.lld: error: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()ld.lld
: ld.llderror: : /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)error: 
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
clangld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&): 
error: linker command failed with exit code 1 (use -v to see invocation)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
make[2]: *** [test/CMakeFiles/client_fixture__rmw_fastrtps_dynamic_cpp.dir/build.make:150: test/client_fixture__rmw_fastrtps_dynamic_cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:362: test/CMakeFiles/client_fixture__rmw_fastrtps_dynamic_cpp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [test/CMakeFiles/test_security.dir/build.make:114: test/test_security] Error 1
make[1]: *** [CMakeFiles/Makefile2:306: test/CMakeFiles/test_security.dir/all] Error 2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [test/CMakeFiles/test_validate_topic_name.dir/build.make:111: test/test_validate_topic_name] Error 1
make[1]: *** [CMakeFiles/Makefile2:335: test/CMakeFiles/test_validate_topic_name.dir/all] Error 2
make[2]: *** [test/CMakeFiles/service_fixture__rmw_fastrtps_dynamic_cpp.dir/build.make:150: test/service_fixture__rmw_fastrtps_dynamic_cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:389: test/CMakeFiles/service_fixture__rmw_fastrtps_dynamic_cpp.dir/all] Error 2
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [test/CMakeFiles/test_timer__rmw_fastrtps_dynamic_cpp.dir/build.make:114: test/test_timer__rmw_fastrtps_dynamic_cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:447: test/CMakeFiles/test_timer__rmw_fastrtps_dynamic_cpp.dir/all] Error 2
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [test/CMakeFiles/test_namespace__rmw_fastrtps_dynamic_cpp.dir/build.make:152: test/test_namespace__rmw_fastrtps_dynamic_cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:418: test/CMakeFiles/test_namespace__rmw_fastrtps_dynamic_cpp.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed   <<< rcl	[ Exited with code 2 ]
@rotu
Copy link
Author

rotu commented May 5, 2020

The build does succeed if I rebuild spdlog_vendor with:
colcon build --packages-select spdlog_vendor --cmake-args -DFORCE_BUILD_VENDOR_PKG=1

so maybe this issue should be moved to the spdlog_vendor repo.

@rotu
Copy link
Author

rotu commented May 5, 2020

I'm also a little concerned that the linker error happens when linking the project rcl instead of the project rcl_logging

@hidmic hidmic added enhancement New feature or request help wanted Extra attention is needed labels May 7, 2020
@hidmic
Copy link
Contributor

hidmic commented May 11, 2020

Same as with #14, contributions to address this issue are more than welcomed e.g. updating spdlog_vendor cmake code to force source builds in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants