Cairo-Dock / cairo-dock-core

Core part of Cairo-Dock project.
http://glx-dock.org
GNU General Public License v3.0
186 stars 46 forks source link

Help module does not appear with git head #20

Closed mtasaka closed 4 months ago

mtasaka commented 4 months ago

Trying with https://github.com/Cairo-Dock/cairo-dock-core/commit/1f316862d9d4d28e11283d67a79724ce94e93280 , "Help" module does not appear.

$ cairo-dock -c

(cairo-dock:364510): dbind-WARNING **: 22:06:36.189: Couldn't connect to accessibility bus: Failed to connect to socket /root/.cache/at-spi/bus_0: 許可がありません

 ============================================================================
Cairo-Dock version: 3.5.99
   compiled date: May  4 2024 00:00:00

Cairo-Dock was built with support for:
 * GTK version:                  3.24
 * X11:                          yes
 * Wayland:                      yes
 * GLX:                          yes
 * EGL:                          yes
 * gtk-layer-shell:              yes
 * additional Wayland protocols: yes
 * Wayfire IPC:                  no

Cairo-Dock is currently running with:
 * display backend:              X11
 * OpenGL:                       no
 * taskbar backend:              X11
 * desktop manager backend(s):   X11
 * detected desktop environment: unknown
 ============================================================================

warning :  (/home/tasaka1/rpmbuild/fedora-specific/MY-PKG/cairo-dock/rawhide/cairo-dock-3.5.99-20240501git1f31686/src/gldit/cairo-dock-module-manager.c:gldi_module_new_from_so_file:162)  
  while opening module '/usr/lib64/cairo-dock/libcd-Help.so' : (/usr/lib64/cairo-dock/libcd-Help.so: undefined symbol: cairo_dock_show_items_gui)

Although cairo_dock_show_items_gui is defined in src/cairo-dock-gui-backend.c which is linked into cairo-dock binary, actually latest head cairo-dock binary does not have this symbol:

$ nm -D /usr/bin/cairo-dock | grep cairo_dock_show_items_gui
$

On the other hand, cairo-dock 3.5.0 does have this symbol:

$ nm -D ./cairo-dock | grep cairo_dock_show_items_gui
000000000001efc0 T cairo_dock_show_items_gui

Some debugging seems to suggest this is due to this change: https://github.com/Cairo-Dock/cairo-dock-core/commit/9558f8245bd039eea590c3c77e4e5955da686a14

With this change, compiling cairo-dock no longer have -rdynamic . cairo_dock_show_items_gui symbol itself is not used in cairo-dock binary, yet it is used in libcd-Help.so when ldopen'ing it, so missing -rdynamic flag makes libcd-Help.so no longer working.

Looks like the following change makes compiler flag add -rdynamic again, but I don't know how cmake_minimum_required works with compilation flags :-( cmake is difficult...

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c0fb6985..55db1fa1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
 ########### requirements ###############

-cmake_minimum_required (VERSION 3.16.0)
+cmake_minimum_required (VERSION 2.6)
 find_package (PkgConfig)
 include (CheckLibraryExists)
 include (CheckIncludeFiles)
mtasaka commented 4 months ago

Or explicitly pass -rdynamic ?

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e0cb247f..dd09bfb2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,6 +47,10 @@ target_link_libraries (${PROJECT_NAME}
    gldi
    ${LIBINTL_LIBRARIES})

+target_link_options (${PROJECT_NAME}
+   PRIVATE
+   "-rdynamic")
+
 # install the program once it is built.
 install(
dkondor commented 4 months ago

Hi, thank you for the detailed analysis. It seems that the behavior changed with newer CMake versions: https://cmake.org/cmake/help/latest/policy/CMP0065.html

What is very strange that I don't have this problem; even though I confirmed that -rdynamic is not used, the Help applet works. Probably there is a difference based on compiler / linker version though.

How about the following patch:

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b126b637..83df531a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -41,6 +41,8 @@ link_directories(
 add_executable (${PROJECT_NAME}
        ${cairo_dock_SRCS} )

+set_target_properties (${PROJECT_NAME} PROPERTIES ENABLE_EXPORTS True)
+
 # Link the executable to the librairies.
 target_link_libraries (${PROJECT_NAME}
        ${PACKAGE_LIBRARIES}

This seems to be the "recommended" solution (see e.g. the the above link), although I'm not sure if there is a difference from just setting -rdynamic

dkondor commented 4 months ago

Let me know if #21 also works for you and then I'll merge it. Thanks!