Coder Social home page Coder Social logo

rcl_logging's Introduction

This repository contains several packages which are all related to the ROS logging functionalities.

Packages

  • rcl_logging_interface
  • rcl_logging_noop
  • rcl_logging_spdlog

rcl_logging's People

Contributors

ahcorde avatar aprotyas avatar audrow avatar blast545 avatar brawner avatar christophebedard avatar clalancette avatar cottsay avatar dirk-thomas avatar fujitatomoya avatar hidmic avatar ivanpauno avatar jacobperron avatar marcoag avatar mikaelarguedas avatar mjcarroll avatar nburek avatar nkalupahana avatar nuclearsandwich avatar paudrow avatar rasmusan avatar shonigmann avatar sloretz avatar wjwwood avatar yadunund avatar yoneken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rcl_logging's Issues

[rcl_logging_spdlog] remove dep on spdlog (and only have it on spdlog_vendor)?

There are two kind of vendor packages in ROS 2.

  • The ones that try to use a installed version of the library in the system, such as: poco_vendor or this recent PR in libyaml_vendor
  • The packages that build the library no matter what you have in your system: yaml-cpp, spdlog, assimp, tinyxml, etc.

My question here is should we try to get rid off the second find_package or don't we mind the find the library twice ?

Here you can find an example what I mean with "find the library twice":

find_package(spdlog_vendor REQUIRED) # Provides spdlog 1.3.1 on platforms without it.
find_package(spdlog REQUIRED)

This question is extensible to poco, yaml, yaml-cpp and the other vendor packages.

@wjwwood and @dirk-thomas what do you think?

Failed to get logging directory, at /home/usr/ros2_foxy/src/ros2/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:84

I have a bit an unusual setup. I have a django daphne server which I start over supervisor like so: command=/bin/bash -c 'source "$0" && exec "$@"' /home/usr/ros2_foxy/install/setup.bash /home/usr/app/bin/daphne -t 30 --access-log - --proxy-headers web.asgi:application. I have a small client which controls my ros node using pythons ros2lifecycle.api and ros2param.api. For this I need to create a node to be able to use these apis. Now my client works if run from a normal python file:

rclpy.init()
client = Client()

but when running these same two lines inside of a django view I get following error stack trace:

>>> [rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:

  'rcutils_expand_user failed, at /home/usr/ros2_foxy/src/ros2/rcl_logging/rcl_logging_interface/src/logging_dir.c:81'

with this new error message:

  'Failed to get logging directory, at /home/usr/ros2_foxy/src/ros2/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:84'

rcutils_reset_error() should be called after error handling to avoid this.
<<<

Traceback (most recent call last):
  File "/home/usr/PycharmProjects/myapp-app/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/usr/PycharmProjects/myapp-app/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/usr/PycharmProjects/myapp-app/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/usr/PycharmProjects/myapp-app/myapp-ui/myapp_ui/myapp_web/myapp/views.py", line 51, in start_something
    start_something()
  File "/home/usr/PycharmProjects/myapp-app/myapp-ui/myapp_ui/myapp_web/myapp/views.py", line 227, in stop_something
    rclpy.init()
  File "/home/usr/ros2_foxy/install/rclpy/lib/python3.8/site-packages/rclpy/__init__.py", line 76, in init
    return context.init(args, domain_id=domain_id)
  File "/home/usr/ros2_foxy/install/rclpy/lib/python3.8/site-packages/rclpy/context.py", line 76, in init
    rclpy_implementation.rclpy_logging_configure(capsule)
_rclpy.RCLError: Failed to initialize logging: Failed to get logging directory, at /home/usr/ros2_foxy/src/ros2/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:84

Now it must have something to do with the environment, since it works in a normal python script. But how can I get this to work in my context? I think it's the last step to be able to control the lifecycle and config of nodes using a web interface which would be quite handy.

rviz2 crashes during launch because of rcl_logging_spdlog undefined symbol

I am using ROS2 Humble on Ubuntu 22.04.

When I try to start rviz2, it crashes during launch with the following error:

rviz2
[INFO] [1702033731.572901130] [rviz2]: Stereo is NOT SUPPORTED
rviz2: symbol lookup error: /opt/ros/humble/lib/librcl_logging_spdlog.so: undefined symbol: _ZN6spdlog7details7log_msgC1ENS_10source_locEN3fmt2v817basic_string_viewIcEENS_5level10level_enumES6_

Any idea, where this is coming from?
I also tried to uninstall and reinstall ROS completely, but that did not help.

Configure logging directory

Currently, all logs are saved to the directory ~/.ros/log, which is hardcoded in the following places:

"%s/.ros/log/%s_%i_%" PRId64 ".log", homedir, executable_name,

print_ret = rcutils_snprintf(name_buffer, sizeof(name_buffer), "%s/.ros/log", homedir);

https://github.com/ros2/launch/blob/e51484685387d4186358ad128d3a4232a5d06522/launch/launch/logging/__init__.py#L96

In ROS 1, we can change the directory logs are saved to by setting the ROS_HOME and/or ROS_LOG_DIR environment variables.
It would be nice to have a way to configure the directory in ROS 2.

I think an environment variable is a convenient way for users to configure the logging directory, although I propose using a single environment variable instead of combining two (like in ROS 1).

Is this a resource leak?

How does log4cxx::PatternLayout got release?

log4cxx::LayoutPtr layout(new log4cxx::PatternLayout(LOG4CXX_STR("%m%n")));
// To be compatible with ROS 1, we want to construct a default filename of
// the form ~/.ros/log/<exe>_<pid>_<milliseconds-since-epoch>.log
// First get the home directory.
const char *homedir = rcutils_get_home_dir();
if (homedir == NULL) {
// We couldn't get the home directory; it is not really going to be
// possible to do logging properly, so get out of here without setting
// up logging.
return RC_LOGGING_RET_ERROR;
}

Include directory not exported

I've had some problems compiling the crystal branch of ROS2 from source with log4cxx for Ubuntu 16.04. When compiling with RCL_LOGGING_IMPLEMENTATION set to rcl_logging_log4cxx, I get the following warning for many packages:

Package 'rcl_logging_log4cxx' exports the include directory
'/home/rsa/ws/ros2/underlay_desktop/install/rcl_logging_log4cxx/share/rcl_logging_log4cxx/cmake/../../../include'
which doesn't exist

The build finally fails on:

CMake Error in CMakeLists.txt:
Imported target "rviz_common::rviz_common" includes non-existent path
"/home/rsa/ws/ros2/underlay_desktop/install/rcl_logging_log4cxx/include"
in its INTERFACE_INCLUDE_DIRECTORIES.

I've fixed it by adding to CMakeLists of rcl_logging_log4cxx:

install(DIRECTORY include/${PROJECT_NAME}
  DESTINATION include/${PROJECT_NAME}
)

After this, everything compiles and works. Is this the "correct" solution? If yes, I can create a pull request.

proposal for how to unify logging and make it configurable with a file

To start, after speaking with @clalancette, here's a bullet list of the current state of affairs:

There a few problems with this:

  • rcutils printing to the console means that:
    • we have to configure it separately from the logging backend (including disabling it or changing its default log level)
    • we don't take advantage of implicit features of the logging backend (like the console printing performance of spdlog)
  • filter console messages in rcutils instead of in each output handler means:
    • you cannot have different log levels set for each output handler (or sink), e.g. you cannot have debug go to file and info to console
    • also, you limit what goes over /rosout based on what you output to the console, limiting the remote debugger's ability to see more details than what is printed to the screen (I haven't confirmed this, but it seems to be the case based on the code)

Additionally, the default logging backend that uses spdlog does not have any way to configure it using a file or the command line. There is a command line option to disable it entirely (see: #88 (comment))


The current state makes it impossible to configure the system in a few ways, the most important of which is a use case that came up from one of our clients where they would like to:

  • have a single config file they pass to all nodes (via launch or env var or command line)
  • control the default log level of the file and console separately, e.g. debug to file and info to console
  • control the log level of specific named loggers based on the sink, e.g. logger 'my_node' puts debug to file and info to console

There are other use cases which might be considered, but this one I think is going to be pretty common and is not possible in the current situation.


For these reasons, I propose we make these changes:

  • use spdlog (and generally the logging back ends) for console printing (rather than the implementation in rcutils)
  • delegate the filtering of console messages by log level to each output handler so they can have different levels
  • define a ROS specific console logging config file format that can be parsed and used to configure rcl_logging_spdlog (since spdlog does not have its own config file format)
  • (optional) elevate the concept of "sinks" to the ROS level, so users can configure different log levels per sink for each named logger (at least in the config file if not also from the command line)
    • e.g. something like --log-level my_node:=file:debug,console:info instead of --log-level my_node:=debug

2.3.1 breaks build of downstream packages by exporting dependencies

We use fmtlib (fmt::fmt cmake target) in our software, by downloading and building it with the rest of our software (cmake FetchContent and friends...).

We encountered a build failure using the newest humble release, which i traced back to a rouge fmt::fmt target appearing in our build (preventing us from building the latest fmtlib version ourself), transitively through rclcpp, rcl, rcl_logging and spdlog.

I'm not sure which component should or should not propagate that dependency upwards, but i think !90 is the particular change causing our problem here. I also found !60, which seems to do the exact opposite and seems convincing as well 😄

Feel free to close this as not an issue with rcl_logging, but i wanted to open an issue here as this might be a regression for more users than just us...

rcl_logging_spdlog breaks the build under libc++

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 ]

Remove duplicated API definition from all `rcl_logging_*` backends

It's currently the case that all of the rcl_logging_* backends (rcl_logging_spdlog, rcl_logging_log4cxx, and rcl_logging_spdlog) duplicate the API from https://github.com/ros2/rcl/blob/d655147310e3e63aff1555ad40fca1bb9cb7783e/rcl/include/rcl/logging_external_interface.h . Further, they also duplicate some of the internal type names from rcl. The reason they currently do this is so we don't have a circular dependency; since rcl depends on a "default" logging implementation, the logging implementations cannot also depend on rcl. We should think about the right way to break this dependency cycle and change all of this to use that.

Issues building packages on humble

Using humble on 22.04, I'm having trouble building ros2_dotnet.
I'm getting the error below, which seems to be related to rcl_logging.
I have packages such as libspdlog1 libspdlog-dev installed.

Apologies if this has nothing to do with rcl_logging, or if this is an issue on my end. Any pointers would be appreciated.

Starting >>> rcldotnet
--- stderr: rcldotnet                         
CMake Error at /opt/ros/humble/share/rcl_logging_spdlog/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package):
  By not providing "Findspdlog.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "spdlog", but
  CMake did not find one.

  Could not find a package configuration file provided by "spdlog" with any
  of the following names:

    spdlogConfig.cmake
    spdlog-config.cmake

  Add the installation prefix of "spdlog" to CMAKE_PREFIX_PATH or set
  "spdlog_DIR" to a directory containing one of the above files.  If "spdlog"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  /opt/ros/humble/share/rcl_logging_spdlog/cmake/rcl_logging_spdlogConfig.cmake:41 (include)
  /opt/ros/humble/share/rcl/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
  /opt/ros/humble/share/rcl/cmake/rclConfig.cmake:41 (include)
  CMakeLists.txt:8 (find_package)


---
Failed   <<< rcldotnet [0.26s, exited with code 1]

Dependency Availability on ROS2 Platforms

So when trying to get this to build for ros2/rcl#327, I realized that the log4cxx dependency isn't readily satisfiable on all of the platforms that we expect to support, causing build failures (ros2/rcl#327 (comment)).

For Ubuntu Linux, this should be relatively easy to add, because it is available through apt, but in order to get this out for ros2, we'll need to get those dependencies available on MacOS and Windows as well (especially for making something as core as rcl or rcutils depend on it).

For Windows, the best approach would be to have a choco package available (which there is currently not), or alternative provide a vendor package, as we have choosen to do for various other dependencies.

Configure logging to not write to file system

Currently the default logger rcl_logging_spdlog always tries to write to the file system, and errors if it can't. This prevents it from being used on systems with read-only file systems. It should be configurable to allow outputting to the console only.

Related discussion #86 (comment)
Summary: New environment variable RCL_LOGGING_OUTPUT_SINK that defaults to console,file if unset.

Missing ament_export_dependencies for spdlog for static ros2 builds

I tried to compile a static ROS2 stack with the folling options:

colcon build --packages-ignore rclcpp_components --symlink-install --cmake-args -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_SECURITY=OFF -DENABLE_SSL=NO -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DFORCE_BUILD_VENDOR_PKG=ON -DSPDLOG_BUILD_SHARED=OFF

Multipel packages can not be build because rcl_logging_spdlog is not exporting spdlog as a dependency.
I belive PR 60 has broken static builds.

Adding
ament_target_dependencies(${PROJECT_NAME} rcl_logging_interface rcpputils rcutils spdlog )

for static builds should solve the problems.

Progress toward Quality Level 1

This issue tracks the progression of packages in rcl_logging that have been deemed necessary for Quality Level 1 and a 1.0 version level. It follows the outline described in REP 2004.

The packages slated for Quality Level 1 for ROS 2 Foxy are:

  • rcl_logging_spdlog

Excluded for Quality Level 1 at this time:

  • rcl_logging_log4cxx
  • rcl_logging_noop

Progress rcl_logging_spdlog:

  • Version Policy
  • Version >= 1.0.0
  • Change Control Process
  • API and ABI stability within a ROS distribution
  • Vulnerability Disclosure Policy

Documentation

  • Per-feature documentation.
  • Per-item documentation in public API.
    • Docstrings, not hosted
  • Declared set of licenses
  • Copyright statement in each source file
    • Checked with ament_copyright
  • Quality Declaration document

Testing:

  • System tests, which cover "features"
  • Tests covering public API
  • Code Coverage > 95%:
      • Must have code coverage tracking for the package -> here
      • Must have and enforce a code coverage policy for new changes Policy
  • Performance tests: not currently available.
  • Linters and Static Analysis:

Dependencies:

  • Runtime "ROS" dependencies are level 1
    • rcutils (QL 2)
    • spdlog_vendor (QL 2)
  • non-ROS dependencies are equivalent level 1
    • None

Platform Support

  • Supports all tier 1 platforms as described in REP-2000

Security

  • Vulnerability Disclosure Policy

spdlog dependency shouldn't need to be exported

ament_export_dependencies(ament_cmake rcl_logging_interface rcutils spdlog_vendor spdlog)

If I understand correctly there's no reason to ament_export_dependencies(spdlog spdlog_vendor). This call makes downstream packages find_package() them, but downstream code shouldn't need to know about them at all in order to use this logging implementation. The <exec_depend>spdlog* is enough to make the spdlog libraries available at runtime.

@hidmic thoughts?

Support compiling rcl_logging_log4cxx with libc++

If you attempt to build ROS2 with clang and libc++ you will run into build issues when linking the rcl package because it is unable to find the Log4cxx API's used by rcl_logging_log4cxx. This is likely due to the fact that the version of log4cxx that is used comes from an apt repository and is likely compiled using libstdc++. Since the log4cxx API's use std lib classes it is not able to resolve linking the classes from one std lib to the other.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.