Versuchen, C++ Qt5.6.1 Anwendung zu erstellen und starten Sie es auf Debian. Es wird entweder ein Verbindungsfehler oder ein Ladebibliotheksfehler angezeigt.Lade-Bibliothek oder Verknüpfungsfehler für XCB-Plugin von statisch verknüpften Qt5
Qt zu einem statischen Libs bauen, verwendete Konfiguration
configure -release -confirm-license -opensource -static -no-dbus -no-openssl -no-qml-debug -no-opengl -qt-freetype -qt-xcb -nomake tools -nomake tests -nomake examples -no-sql-db2 -no-sql-oci -no-sql-tds -no-sql-sqlite2 -no-sql-odbc -no-sql-ibase -no-sql-psql -skip doc -skip imageformats -skip webchannel -skip webengine -skip webview -skip sensors -skip serialport -skip script -skip multimedia
Projekt mit CMake erstellt, Libs auf diese Weise festgelegt ist:
SET(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${QT5_LIB_ROOT}/cmake")
FIND_PACKAGE(Qt5Core REQUIRED)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5Network REQUIRED)
FIND_PACKAGE(PNG REQUIRED)
FIND_PACKAGE(ZLIB REQUIRED)
FIND_PACKAGE(Threads REQUIRED)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(QT_LIBS
libqtharfbuzzng_debug.a
libqtpcre_debug.a
libQt5PlatformSupport_debug.a
libxcb-static_debug.a
)
ELSE()
SET(QT_LIBS
libqtharfbuzzng.a
libqtpcre.a
libQt5PlatformSupport.a
libxcb-static.a
)
ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(OS_SPECIFIC_LIBS
dl
Qt5::QXcbIntegrationPlugin
${CMAKE_THREAD_LIBS_INIT}
${ZLIB_LIBRARIES}
${PNG_LIBRARY})
FOREACH(lib_name ${QT_LIBS})
IF(NOT EXISTS ${QT5_LIB_ROOT}/${lib_name})
MESSAGE(FATAL_ERROR "Could not locate required Qt lib ${QT5_LIB_ROOT}/${lib_name}")
ENDIF()
LIST(APPEND OS_SPECIFIC_LIBS ${QT5_LIB_ROOT}/${lib_name})
ENDFOREACH(lib_name)
Und wenn ich den Import XCB Plugin im Code (Q_IMPORT_PLUGIN (QXcbIntegrationPlugin) es gibt mir Link-Fehler:
/Qt5/plugins/platforms/libqxcb.a(qxcbmain.o): In function `QXcbIntegrationPlugin::create(QString const&, QStringList const&, int&, char**)':
qxcbmain.cpp:(.text+0x67): undefined reference to `QXcbIntegration::QXcbIntegration(QStringList const&, int&, char**)'
Anf wenn ich plu nicht importieren gin - es startet einfach nicht mit fehler:
This application failed to start because it could not find or load the Qt platform plugin "xcb"
Irgendwelche Hilfe? Rat?
Danke.
Ich denke, statische Verknüpfung und CMake ist sowieso im Moment kaputt, vgl. https://bugreports.qt.io/browse/QTBUG-38913, aber das sieht nach einem anderen Problem aus - und ich denke, Sie sollten nicht manuell in das Plattform-Plugin einbinden, das die CMake/Qt-Integration übernehmen soll Sorge dafür, aber ich kann mich irren ... – peppe
Es ist ein bisschen anders. Das Problem, das ich habe, ist spezifisch für Linux. Habe keine Probleme unter OSX und Windows (anderes Plugin also, plattformspezifisch). – Ation