I have this code in c++ (extracted from the documentation):
#include <dlt/dlt.h>
DLT_DECLARE_CONTEXT(ctx); /* declare context */
int main()
{
DLT_REGISTER_APP("TAPP", "Test Application for Logging");
DLT_REGISTER_CONTEXT(ctx, "TES1", "Test Context for Logging");
/* … */
DLT_LOG(ctx, DLT_LOG_ERROR, DLT_CSTRING("This is an error"));
DLT_LOG(ctx, DLT_LOG_INFO, DLT_CSTRING("This is an very important info: Hello"));
/* … */
DLT_UNREGISTER_CONTEXT(ctx);
DLT_UNREGISTER_APP();
return 0;
}
And this cmake file:
cmake_minimum_required(VERSION 3.10)
project(DLTExample)
# Encuentra la biblioteca DLT
find_package(automotive-dlt REQUIRED)
# Agrega los archivos fuente de tu programa
add_executable(DLTExample dltExample.cpp)
# Enlaza con la biblioteca DLT
target_link_libraries(DLTExample PRIVATE Genivi::dlt)
When I run the code I have this output:
[ 615.286034]~DLT~ 7558~INFO ~FIFO /tmp/dlt cannot be opened. Retrying later...
[ 625.304701]~DLT~ 7558~WARNING ~Lost log messages in user buffer when exiting: 6
I also tried to run the executable of my code with sudo but the output is the same.
I downloaded dlt-daemon from https://github.com/COVESA/dlt-daemon/tree/master and follow the instructions to install it (included sudo make install and sudo ldconfig).
When I type on the terminal dlt-daemon I have:
[ 1743.468119]~DLT~ 9406~NOTICE ~Starting DLT Daemon; DLT Package Version: 2.18.10 STABLE, Package Revision: v2.18.10_14_g7a55368, build on Nov 15 2023 13:02:13 -SYSTEMD -SYSTEMD_WATCHDOG -TEST -SHM
[ 1743.468196]~DLT~ 9406~ERROR ~FIFO user dir /tmp/dltpipes cannot be chmoded (Operation not permitted)!
[ 1743.468209]~DLT~ 9406~CRITICAL ~Initialization of phase 1 failed!
So I tried with sudo:
[ 1786.350247]~DLT~ 9472~NOTICE ~Starting DLT Daemon; DLT Package Version: 2.18.10 STABLE, Package Revision: v2.18.10_14_g7a55368, build on Nov 15 2023 13:02:13
-SYSTEMD -SYSTEMD_WATCHDOG -TEST -SHM
[ 1786.350390]~DLT~ 9472~INFO ~FIFO size: 65536
[ 1786.350415]~DLT~ 9472~WARNING ~Unable to set send timeout Socket operation on non-socket.
[ 1786.350418]~DLT~ 9472~INFO ~Activate connection type: 5
[ 1786.350439]~DLT~ 9472~INFO ~dlt_daemon_socket_open: Socket created
[ 1786.350451]~DLT~ 9472~WARNING ~dlt_daemon_socket_open: bind() error 98: Address already in use
[ 1786.350453]~DLT~ 9472~ERROR ~Could not initialize main socket.
[ 1786.350455]~DLT~ 9472~CRITICAL ~Initialization of local connections failed!
As you can see there is still errors.
I also had this repo before I installed the dlt-daemon: https://github.com/COVESA/dlt-viewer/tree/master (I followed the install instructions)
I don't know what to do :( First I tried to change the permissions of the /tmp/dlt (I created the folder) but nothing happened so i removed it.
I just want to create a dlt file that works on dlt viewer so i can search and filter the logs there.
Any ideas?
Thanks in advance
The problem was that I was not starting the dlt-receiver. So, you have to start the deamon, the receiver and the program that sends the dlt logs.