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

dtk6core-6.0.28 doesn't compile against dtk6log-0.0.2 when BUILD_WITH_SYSTEMD OFF #223

Open
daf0x opened this issue Jan 19, 2025 · 1 comment

Comments

@daf0x
Copy link

daf0x commented Jan 19, 2025

SUMMARY | 问题概要

When compiling dtk6core-6.0.28 I encountered the following error:

/var/tmp/portage/gui-libs/dtk6core-6.0.28/work/dtk6core-6.0.28/src/log/LogManager.cpp:12:10: fatal error: JournalAppender.h: No such file or directory
   12 | #include <JournalAppender.h>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

This appears to be because I built dtk6log-0.0.2 with the BUILD_WITH_SYSTEMD option set to OFF.

I tried to find out if dtk6core, or Deepin in general, has a hard dependency on systemd, but I could not find a conclusive answer. However, given that dtk6log has an option to build without systemd support, and I have seen similar code in other Deeping projects, I feel that probably building and using Deeping should be possible without systemd. As such, it seems to me that this is a bug in dtk6core, and there should be a similar BUILD_WITH_SYSTEMD option in this project. Alternatively, if systemd is a hard dependency, then the option in dtk6log does not seem to make much sense.

If you could, please clarify the stance of Deepin on supporting Linux distributions without systemd?

DTK and OS VERSIONS | DTK&系统版本信息

dtk6core-6.0.28
dtk6log-0.0.2

Minimal Reproducible Case Code | 最小复现案例代码

  1. Build dtk6log-0.0.2 with cmake -DBUILD_WITH_SYSTEMD=OFF
  2. Try to build dtk6core-6.0.28

OBSERVED RESULT | 观察到的结果

/var/tmp/portage/gui-libs/dtk6core-6.0.28/work/dtk6core-6.0.28/src/log/LogManager.cpp:12:10: fatal error: JournalAppender.h: No such file or directory
   12 | #include <JournalAppender.h>
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.

EXPECTED RESULT | 期望的结果

Compilation should succeed

ADDITIONAL INFORMATION | 额外补充

I am wanting to try out the Deepin Desktop Environment on Gentoo Linux (without systemd). My current/first/intermediate, goal is to compile the treeland window manager. Treeland has a dependency on dtk6declarative, which in turn depends on dtk6core.

@daf0x
Copy link
Author

daf0x commented Jan 19, 2025

This patch fixes compilation for this package, but I don't know yet if it will cause issues down the line:

fix_build_with_systemd_configuration_option.patch
+++ dtk6core-6.0.28/include/log/LogManager.h    2025-01-19 20:07:28.688709621 +0100
@@ -19,7 +19,9 @@
 public:
     static void registerConsoleAppender();
     static void registerFileAppender();
+#if (defined BUILD_WITH_SYSTEMD && defined Q_OS_LINUX)
     static void registerJournalAppender();
+#endif

     static QString getlogFilePath();

@@ -34,7 +36,9 @@
 private:
     void initConsoleAppender();
     void initRollingFileAppender();
+#if (defined BUILD_WITH_SYSTEMD && defined Q_OS_LINUX)
     void initJournalAppender();
+#endif
     QString joinPath(const QString &path, const QString &fileName);

     inline static DLogManager* instance(){
--- dtk6core-6.0.28_/src/log/LogManager.cpp     2025-01-19 20:04:11.040453996 +0100
+++ dtk6core-6.0.28/src/log/LogManager.cpp      2025-01-19 20:06:36.030707208 +0100
@@ -9,7 +9,9 @@
 #include <Logger.h>
 #include <ConsoleAppender.h>
 #include <RollingFileAppender.h>
+#if (defined BUILD_WITH_SYSTEMD && defined Q_OS_LINUX)
 #include <JournalAppender.h>
+#endif
 #include "dstandardpaths.h"

 DCORE_BEGIN_NAMESPACE
@@ -48,7 +50,9 @@
     QString m_logPath;
     ConsoleAppender* m_consoleAppender = nullptr;
     RollingFileAppender* m_rollingFileAppender = nullptr;
+#if (defined BUILD_WITH_SYSTEMD && defined Q_OS_LINUX)
     JournalAppender* m_journalAppender = nullptr;
+#endif
     QScopedPointer<DConfig> m_dsgConfig;
     QScopedPointer<DConfig> m_fallbackConfig;

@@ -143,16 +147,14 @@
     dlogger->registerAppender(d->m_rollingFileAppender);
 }

+#if (defined BUILD_WITH_SYSTEMD && defined Q_OS_LINUX)
 void DLogManager::initJournalAppender()
 {
-#if (defined BUILD_WITH_SYSTEMD && defined Q_OS_LINUX)
     Q_D(DLogManager);
     d->m_journalAppender = new JournalAppender();
     dlogger->registerAppender(d->m_journalAppender);
-#else
-    qWarning() <<  "BUILD_WITH_SYSTEMD not defined or OS not support!!";
-#endif
 }
+#endif

 /*!
 @~english
@@ -175,10 +177,12 @@
     DLogManager::instance()->initRollingFileAppender();
 }

+#if (defined BUILD_WITH_SYSTEMD && defined Q_OS_LINUX)
 void DLogManager::registerJournalAppender()
 {
     DLogManager::instance()->initJournalAppender();
 }
+#endif

 /*!
 @~english

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

No branches or pull requests

1 participant