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
Gerrit Reviews
For Gerrit Dashboard: QTBUG-83498 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
298067,7 | Update dependencies | dev | qt/qttools | Status: MERGED | +2 | 0 |
298271,5 | CMake: Fix failing linux static build | dev | qt/qtquick3d | Status: MERGED | +2 | 0 |
303989,4 | CMake: Implement workaround for failing linux static builds | dev | qt/qtbase | Status: MERGED | +2 | 0 |
303991,2 | CMake: Fix failing linux static build | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
303995,3 | Revert "CMake: Fix failing linux static build" | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
599864,3 | CMake: Increase static library link multiplicity for VxWorks to 3 | dev | qt/qtbase | Status: MERGED | +2 | 0 |
600201,2 | CMake: Increase static library link multiplicity for VxWorks to 3 | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |