code

qt를 설치하지 않고 Linux에서 qt5 앱을 실행하는 동안“플랫폼 플러그인”xcb“”를로드하지 못했습니다.

codestyles 2020. 9. 14. 20:56
반응형

qt를 설치하지 않고 Linux에서 qt5 앱을 실행하는 동안“플랫폼 플러그인”xcb“”를로드하지 못했습니다.


Qt5를 사용하는 Linux 용 응용 프로그램을 작성했습니다.

그러나 Qt SDK가 설치되지 않은 Linux에서 실행하려고 할 때 콘솔의 출력은 다음과 같습니다.

플랫폼 플러그인 "xcb"를로드하지 못했습니다. 사용 가능한 플랫폼은 다음과 같습니다.

이 문제를 어떻게 해결할 수 있습니까? 플러그인 파일을 복사해야 할 수도 있습니까? Qt5가 설치된 우분투를 사용하지만 Qt 디렉토리의 이름을 바꾸면 같은 문제가 발생합니다. 따라서 Qt 디렉토리의 일부 파일을 사용합니다.

업데이트 : libqxcb.so 파일을 사용하여 app dir "platforms"폴더에 만들면 앱이 여전히 시작되지 않지만 오류 메시지가 변경됩니다.

플랫폼 플러그인 "xcb"를로드하지 못했습니다. 사용 가능한 플랫폼은 다음과 같습니다.

xcb

어떻게 이런 일이 일어날 수 있습니까? 플랫폼 플러그인을 사용할 수 있지만로드 할 수없는 방법은 무엇입니까?


공유 라이브러리 종속성을 표시하려면 ldd (man ldd)를 사용하십시오. libqxcb.so에서 실행

.../platforms$ ldd libqxcb.so

xcb는 libQt5Core.so.5 및 libQt5Gui.so.5 (및 기타 많은 시스템 라이브러리) 외에도 libQt5DBus.so.5에 의존 함을 보여줍니다. 공유 라이브러리 모음에 libQt5DBus.so.5를 추가하면 계속 진행할 준비가되어 있어야합니다.


앞서 게시 한대로 애플리케이션을 배포 할 때 플랫폼 플러그인을 설치해야합니다. 배포하는 방법에 따라 플랫폼 플러그인 (예 : 플랫폼 / 플러그인 /libqxcb.so)이 런타임에 어디에 있는지 애플리케이션에 알려주는 두 가지 방법이 있습니다.

첫 번째는 QT_QPA_PLATFORM_PLUGIN_PATH 변수를 통해 디렉토리 경로를 내보내는 것입니다.

QT_QPA_PLATFORM_PLUGIN_PATH=path/to/plugins ./my_qt_app

또는

export QT_QPA_PLATFORM_PLUGIN_PATH=path/to/plugins
./my_qt_app

내가 선호하는 다른 옵션은 실행 파일과 동일한 디렉토리에 qt.conf 파일을 만드는 것입니다. 그 내용은 다음과 같습니다.

[Paths]
Plugins=/path/to/plugins

이에 대한 자세한 정보는 여기qt.conf 사용에서 찾을 수 있습니다.


Qt 5.5가 사전 설치된 Ubuntu 16.04 LTS에서 Qt 5.7로 컴파일 된 바이너리를 시작하려고했습니다. 예상대로 작동하지 않았습니다.

처음에는 ldd여기에 제안 된대로 바이너리 자체를 검사하고 "찾을 수 없음"종속성을 모두 만족 시켰습니다. 그런 다음이 악명 높은 This application failed to start because it could not find or load the Qt platform plugin "xcb"오류가 발생했습니다.

이 문제를 해결하기 위해 Linux에서 수행해야하는 작업

먼저 platforms바이너리가있는 디렉토리 를 만들어야 합니다. Qt가 XCB 라이브러리를 찾는 곳이기 때문입니다. libqxcb.so거기에 복사하십시오 . 다른 답변의 저자가 이것을 언급하지 않은 이유가 궁금합니다.

그런 다음 충족되지 않은 QT_DEBUG_PLUGINS=1종속성을 확인하기 위해 환경 변수를 설정 하여 바이너리를 실행할 수 있습니다 libqxcb.so. ( ldd허용 된 답변에서 제안 된대로 이것을 사용할 수도 있습니다 ).

명령 출력은 다음과 같습니다.

me@xerus:/media/sf_Qt/Package$ LD_LIBRARY_PATH=. QT_DEBUG_PLUGINS=1 ./Binary
QFactoryLoader::QFactoryLoader() checking directory path "/media/sf_Qt/Package/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/media/sf_Qt/Package/platforms/libqxcb.so"
Found metadata in lib /media/sf_Qt/Package/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 329472
}


Got keys from plugin meta data ("xcb")
loaded library "/media/sf_Qt/Package/platforms/libqxcb.so"
QLibraryPrivate::loadPlugin failed on "/media/sf_Qt/Package/platforms/libqxcb.so" : "Cannot load library /media/sf_Qt/Package/platforms/libqxcb.so: (/usr/lib/x86_64-linux-gnu/libQt5DBus.so.5: version `Qt_5' not found (required by ./libQt5XcbQpa.so.5))"
This application failed to start because it could not find or load the Qt platform plugin "xcb"
in "".

Available platform plugins are: xcb.

Reinstalling the application may fix this problem.
Aborted (core dumped)

실패한 libQt5DBus.so.5라이브러리에 유의하십시오 . 라이브러리 경로에 복사하십시오. 제 경우에는 바이너리가있는 동일한 디렉토리였습니다 (따라서 LD_LIBRARY_PATH=.). 모든 종속성이 충족 될 때까지이 프로세스를 반복하십시오.

추신에 대한 이 답변 의 작성자에게 감사드립니다 QT_DEBUG_PLUGINS=1.


Ubuntu 16.04 64bit. I got the problem for apparently no reasons. The night before I watched a movie on my VideoLan instance, that night I would like to watch another one with VideoLan. VLC just didn't want to run because of the error into the question. I google a bit and I found the solution it solved my problem: from now on, VLC is runnable just like before. The solution is this comand:

sudo ln -sf /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/ /usr/bin/

I am not able to explain what are its consequencies, but I know it creates some missing symbolic link.


Since version 5, Qt uses a platform abstraction system (QPA) to abstract from the underlying platform.

The implementation for each platform is provided by plugins. For X11 it is the XCB plugin. See Qt for X11 requirements for more information about the dependencies.


I tried the main parts of each answer, to no avail. What finally fixed it for me was to export the following environment variables:

LD_LIBRARY_PATH=/usr/local/lib:~/Qt/5.9.1/gcc_64/lib
QT_QPA_PLATFORM_PLUGIN_PATH=~/Qt/5.9.1/gcc_64/plugins/ 

Probably this will help. I'm using Ubuntu 18.04 and when I installed Krita using the ppa method. I got this error:

This application failed to start because it could not find or load the Qt platform plugin "xcb" in "".

Available platform plugins are: linuxfb, minimal, minimalegl, offscreen, wayland-egl, wayland, xcb.

Reinstalling the application may fix this problem. Aborted

I tried all the solutions that I found in this thread and other webs without success.

Finally, I found a post where the author mention that is possible to activate the debugging told of qt5 using this simple command:

export QT_DEBUG_PLUGINS=1

After adding this command I run again krita I got the same error how ever now I know the cause.

libxcb-xinerama.so.0: cannot open shared object file: No such file or directory.

This error prevents to the "xcb" to load properly. So the solution will be install the `libxcb-xinerama.so.0" right? However, when I run the command:

sudo apt install libxcb-xinerama

I the lib was installed. So I used an old trick yeah --reinstall

sudo apt install --reinstall libxcb-xinerama

This last command solved my problem.


So, I spent about a day trying to figure out what was the issue; tried all the proposed solutions, but none of that worked like installing xcb libs or exporting Qt plugins folder. The solution that suggested to use QT_DEBUG_PLUGINS=1 to debug the issue didn't provide me a direct insight like in the answer - instead I was getting something about unresolved symbols within Qt5Core.

That gave me a hint, though: what if it's trying to use different files from different Qt installations? On my machine I had standard version installed in /home/username/Qt/ and some local builds within my project that I compiled by myself (I have other custom built kits as well in other locations). Whenever I tried to use any of the kits (installed by Qt maintenance tool or built by myself), I would get an "xcb error".

The solution was simple: provide the Qt path through CMAKE_PREFIX_PATH and not though Qt5_DIR as I did, and it solved the problem. Example:

cmake .. -DCMAKE_PREFIX_PATH=/home/username/Qt/5.11.1/gcc_64


In my case, I needed to deploy two Qt apps on an Ubuntu virtualbox guest. One was command-line ("app"), the other GUI_based ("app_GUI").

I used "ldd app" to find out what the required libs are, and copied them to the Ubuntu guest. While the command-line executable "app" worked ok, the GUI-based executable crashed, giving the "Failed to load platform plugin "xcb" error. I checked ldd for libxcb.so, but this too had no missing dependencies.

The problem seemed to be that while I did copy all the right libraries I accidentally had copied also libraries that were already present at the guest system.. meaning that (a) they were unnecessary to copy them in the first place and (b) worse, copying them produced incompatibilities between the install libraries. Worse still, they were undetectable by ldd like I said..

The solution? Make sure that you copy libraries shown as missing by ldd and absolutely no extra libraries.


I faced the same problem when after installing Viber. It had all required qt libraries in /opt/viber/plugins/. I checked dependencies of /opt/viber/plugins/platforms/libqxcb.so and found missing dependencies. They were libxcb-render.so.0, libxcb-image.so.0, libxcb-icccm.so.4, libxcb-xkb.so.1 So I resolved my issue by installing missing packages with this libraries:

apt-get install libxcb-xkb1 libxcb-icccm4 libxcb-image0 libxcb-render-util0


I link all Qt stuff statically to the generic Linux builds of my open source projects. It makes life a bit easier. You just need to build static versions of Qt libraries first. Of course this cannot be applied to closed source software due to licensing issues. The deployment of Qt5 apps on Linux is currently a bit problematic, because Ubuntu 12.04, for example, doesn't have Qt5 libraries in the package repositories.


I like the solution with qt.conf.

Put qt.conf near to the executable with next lines:

[Paths]
Prefix = /path/to/qtbase

And it works like a charm :^)


I had this problem, and on a hunch I removed the Qt Configs from my environment. I.e.,

rm -rf ~/.config/Qt*

Then I started qtcreator and it reconfigured itself with the existing state of the machine. It no longer remembered where my projects were, but that just meant I had to browse to them "for the first time" again.

But more importantly it built itself a coherent set of library paths, so I could rebuild and run my project executables again without the xcb or qxcb libraries going missing.


There might be many causes to this problem. The key is to use

export QT_DEBUG_PLUGINS=1

before you run your Qt application. Then, inspect the output, which will point you to the direction of the error. In my case it was:

Cannot load library /opt/nao/plugins/platforms/libqxcb.so: (/opt/nao/bin/../lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib/x86_64-linux-gnu/libpng16.so.16))

But that is solved in different threads. See for instance https://stackoverflow.com/a/50097275/2408964.


sudo ln -sf /usr/lib/...."adapt-it"..../qt5/plugins/platforms/ /usr/bin/

It creates the symbolic link it's missed. Good for QT ! Good for VLC !!

참고URL : https://stackoverflow.com/questions/17106315/failed-to-load-platform-plugin-xcb-while-launching-qt5-app-on-linux-without

반응형