Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.0.0
-
-
8c49dc9bf (dev), 07ba8781f (6.8)
Description
Uncovered while working on https://codereview.qt-project.org/c/qt/qtquick3d/+/282389/31
Sample failure log:
https://testresults.qt.io/coin/integration/qt/qtquick3d/tasks/web_qt_qtquick3d_1586425297572
Order of static libraries matters when using the GNU ld linker on linux, and because something fishy is going on with how we make Gui plugins depend on Gui, and Gui depend on Gui plugins, the linker static lib order gets messed up somehow, and thus causes undefined symbol errors at link time.
Can be reproduced with an app that depends on Qt::Gui and Qt::OpenGL in a more simplified manner (small project will be attached shortly)
EDIT:
Upstream CMake issue at https://gitlab.kitware.com/cmake/cmake/-/issues/20604 the minimal project can also be found there.
The minimal project involving qt looks like this:
# CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(use_static_qt6_quick LANGUAGES CXX) set(CMAKE_PREFIX_PATH "/path/to/static_qt6_prefix") find_package(Qt6 REQUIRED COMPONENTS Quick) set(CMAKE_CXX_STANDARD 14) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) add_executable(${PROJECT_NAME} main.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Gui Qt6::OpenGL ) qt6_import_plugins(${PROJECT_NAME} NO_DEFAULT INCLUDE Qt::QXcbIntegrationPlugin ) # main.cpp int main() {return 0;}
It appears that this is expected behavior, and that it's the project responsibility to fix it with LINK_INTERFACE_MULTIPLICITY.
But because what we're doing is wrong in the first place (why have target dependency cycles, if there is no cycle in the underlying .cpp code), that's not really the proper fix.
Attachments
Issue Links
- relates to
-
QTBUG-95609 cmake names for qml plugins
- Closed
-
QTBUG-92933 Rework automatic static plugin linkage
- Closed
-
QTBUG-77377 Add CMake feature for a function to be called when a target is "closed" (scope finalizers)
- Closed