Commit ac19548d authored by Tomaz  Canabrava's avatar Tomaz Canabrava
Browse files

Create a konsoleprivate_core static library

This new cmake target will hold classes that do not depend
on other konsole classes, so we can start to untangle the
source code.

next: export profile as a static library
parent 0478529c
......@@ -49,6 +49,38 @@ qt5_add_dbus_adaptor(windowadaptors_SRCS
ViewManager.h
Konsole::ViewManager)
set(konsole_LIBS
KF5::XmlGui
Qt5::PrintSupport
Qt5::Xml
KF5::Notifications
KF5::WindowSystem
KF5::TextWidgets
KF5::GuiAddons
KF5::IconThemes
KF5::Bookmarks
KF5::I18n
KF5::Pty
KF5::KIOWidgets
KF5::DBusAddons
KF5::GlobalAccel
KF5::NewStuff
)
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
#kinfo_getfile() is in libutil
list(APPEND konsole_LIBS util)
endif()
# This konsoleprivate_core is the "core" library that depends in nothing from konsole itself
# so we can start to detangle the codebase.
set(konsoleprivate_core_SRCS ShellCommand.cpp)
add_library(konsoleprivate_core STATIC ${konsoleprivate_core_SRCS})
target_link_libraries(konsoleprivate_core ${konsole_LIBS})
set(konsoleprivate_SRCS ${sessionadaptors_SRCS}
${windowadaptors_SRCS}
hsluv.c
......@@ -121,7 +153,6 @@ set(konsoleprivate_SRCS ${sessionadaptors_SRCS}
session/SessionManager.cpp
session/SessionListModel.cpp
session/SessionTask.cpp
ShellCommand.cpp
widgets/TabTitleFormatButton.cpp
TerminalCharacterDecoder.cpp
ExtendedCharTable.cpp
......@@ -177,7 +208,12 @@ qt5_add_resources( konsoleprivate_SRCS ../desktop/konsole.qrc)
add_library(konsoleprivate ${konsoleprivate_SRCS})
generate_export_header(konsoleprivate BASE_NAME konsoleprivate)
target_link_libraries(konsoleprivate PUBLIC ${konsole_LIBS})
target_link_libraries(konsoleprivate
PUBLIC
konsoleprivate_core
${konsole_LIBS}
)
set_target_properties(konsoleprivate PROPERTIES
VERSION ${KONSOLEPRIVATE_VERSION_STRING}
......
  • This (or one of the subsequent commits) has broken building konsole on the OBS:

    /libQt5Network.so.5.15.0 /usr/lib/libQt5Widgets.so.5.15.0 /usr/lib/libQt5Gui.so.5.15.0 /usr/lib/libQt5Core.so.5.15.0 
    [  291s] /usr/lib/gcc/i586-suse-linux/10/../../../../i586-suse-linux/bin/ld: /tmp/konsolepart.so.k1EWfK.ltrans4.ltrans.o: in function `Konsole::ProfileManager::deleteProfile(QExplicitlySharedDataPointer<Konsole::Profile>)':
    [  291s] /home/abuild/rpmbuild/BUILD/konsole-20.11.70git.20200728T171329~74764db4/src/profile/ProfileManager.cpp:477: undefined reference to `KonsoleDebug()'
  • @lbeltrame that code is defined in CMake:

    176:ecm_qt_declare_logging_category(konsoleprivate_SRCS HEADER konsoledebug.h IDENTIFIER KonsoleDebug CATEGORY_NAME org.kde.konsole)

    and konsoleprivate_SRCS is added to the konsoleprivate library sources. Locally konsole builds for me, can you test with obs if you change this KonsoleDebug definition to konsoleprivate_core things build?

  • @tcanabrava What are your linker flags?

    The ones we use here are

    -Wl,--as-needed -Wl,--no-undefined -Wl,-Bsymbolic-functions

  • I don't change the cmake default linker flags.

  • Can you try setting

          -DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-Bsymbolic-functions"
          -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-Bsymbolic-functions"
          -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed -Wl,--no-undefined -Wl,-Bsymbolic-functions"

    I'm guessing it will fail to build for you too. It is likely that the default linker flags don't catch this undefined reference.

    Also, from a quick chat on IRC with @fvogt discussing this issue, it looks like there is indeed some linking problem:

    [12:21] konsoleprofile only links against konsoleprivate_core, but the references are in konsoleprivate

  • AFAICT it's actually a664523f which broke it. EditProfileDialog.cpp needs to be linked against konsoleprivate.

  • Profile should not link against konsoleprivate, but the KonsoleDebug should be moved to konsole_core, I'm creating a patch for this.

  • AFAICT that would only fix undefined reference to `KonsoleDebug()' but none of the others.

    The issue is that profile depends on konsoleprivate but does not link against it.

  • @fvogt that was the original one the comment from @lbeltrame, I tougth it was the only one. the issue is that konsole used to be a single library and it's a tangled mess impossible to reason about, that's why I'm starting to separate the libraries. It indeed fails to link against it currently, that's not a reason to just throw away the start of the separation and link. I'm trying again with another patch, keeping things separated.

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment