MEONMedical / Log4Qt

Log4Qt - Logging for the Qt cross-platform application framework
Apache License 2.0
589 stars 235 forks source link

Log4Qt Integration Fails in Cross-Compiled Qt Project for BeagleBone Black (BBB) #80

Open Seqat opened 3 months ago

Seqat commented 3 months ago

I am new to the Qt ecosystem and I'm encountering an issue with integrating Log4Qt into my Qt project for the BeagleBone Black platform. I have set up a cross-compile environment and included Log4Qt using the log4qt.pri file in my .pro file. Despite following the documentation and adjusting various settings, the integration is not working as expected. Specifically, I am experiencing errors like this:

/include/log4qt/layout.h:24: error: log4qtdefs.h: No such file or directory
In file included from /include/log4qt/appender.h:24:0,
                 from /include/log4qt/helpers/appenderattachable.h:25,
                 from /include/log4qt/logger.h:28,
                 from ../../loggermodule.h:6,
                 from moc_loggermodule.cpp:10:
/include/log4qt/layout.h:24:10: fatal error: log4qtdefs.h: No such file or directory
 #include "log4qtdefs.h"
          ^~~~~~~~~~~~~~

My setup Platform: BeagleBone Black Qt Version: 5.15.2 (Open Source Edition) Cross-Compilation: Ubuntu 20.04 Toolchain Location: /opt/qt5bbb Sysroot Location: /opt/qt5bbb/sysroot-glibc-linaro-2.25-2019.12-arm-linux-gnueabihf Compiler Location: /opt/qt5bbb/gcc-linaro-7.5.0-2019.12-x86_64_arm-linux-gnueabihf Qt Location: /opt/qt5bbb/qt-everywhere-src-5.15.2 Log4Qt Location: /opt/qt5bbb/external-libs/Log4Qt

I have attempted the following troubleshooting steps:

Despite these efforts, the issue persists, and I can't successfully build or run the project with Log4Qt. Any guidance or suggestions would be greatly appreciated.

andibacher commented 3 months ago

I think the problem ist that this header file "log4qtdefs.h" is not deployed on install. at least not for the qmake project.

andibacher commented 3 months ago

This commit should fix this. https://github.com/MEONMedical/Log4Qt/commit/350d3b2cb92d4e919c2bcdd124929949543ae65c

Seqat commented 3 months ago

Thank you for the reply. I tried your suggestion, and I took some errors by not finding module logger.h. After some tries, I can build my project by adding the absolute path of my sysroot in my project's .pro file:

INCLUDEPATH += /opt/qt5bbb/sysroot-glibc-linaro-2.25-2019.12-arm-linux-gnueabihf/include 

LIBS += -L/opt/qt5bbb/sysroot-glibc-linaro-2.25-2019.12-arm-linux-gnueabihf/usr/lib -llog4qt