Qt GUI app not running in container. Error : /lib/x86_64-linux-gnu/libQt6Core.so.6: version `Qt_6.8’ not found (required by ./<GUI_App>)

Hello,

I am trying to run a QT GUI app inside the docker container. As a frirst step I read few blogs and went with GitHub - arBmind/qtcreator-containers: Docker containers with QtCreator - Ready to develop, build and run Qt Gui applications. to try to run my GUI app.

As am new to this I thought and used same dockerfile and I copied my GUI App and tried running it.

I got the below error:

/lib/x86_64-linux-gnu/libQt6Qml.so.6: no version information available (required by ./<GUI_App>)
/lib/x86_64-linux-gnu/libQt6Core.so.6: version `Qt_6.8’ not found (required by ./<GUI_App>)

Letr I used below lines inside the dockerfile then the first error fixed.

RUN export LD_LIBRARY_PATH=/opt/qtcreator/lib/Qt/lib/:$LD_LIBRARY_PATH
RUN echo ‘export LD_LIBRARY_PATH=/opt/qtcreator/lib/Qt/lib/:$LD_LIBRARY_PATH’ >> ~/.bashrc

But now when I try to run the app again the second/below error I got:

/lib/x86_64-linux-gnu/libQt6Core.so.6: version `Qt_6.8’ not found (required by ./<GUI_App>)

I understood it is version missmatch issue. But since 2 days I have tried many things that i can still issue persists. I failed to fix. Can anyone help m eon this please?

When I see the lib present inside the container it shows below libs :

And I am using below command to run the container :

sudo docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -it <GUI_APP>

Our app is based on Qt.6.8.2 and qml6.

later I tried another way lets where Qt 6.8.2 is installed but there qml is not supporting.

currently we are trying this on native host but the end goal is to run it on Renesar R-car H3 started kit.

The application needs 6.8. But when i try to install 6.8 version it is not allowing to do so. Am I missing anything here? please help.

regards,
Siddhartha V

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello Siddhartha,

Thank you for reaching out with your question. It sounds like you’re encountering a version mismatch issue with your Qt GUI application inside a Docker container. Let’s work through this step-by-step to resolve the problem.

  1. Verify Installed Qt Version: First, confirm the version of Qt installed in your Docker container. You can do this by running qmake --version or checking the library files directly. Ensure it matches the required version, Qt 6.8.2.

  2. Install the Correct Qt Version: If the required version isn’t installed, you’ll need to add the appropriate Qt repository to your Dockerfile and install the specific version. For Debian-based images, you might use:

    RUN apt-get update && apt-get install -y qt6-base-dev
    

    Ensure this installs the correct version by specifying the version number if necessary.

  3. Set LD_LIBRARY_PATH: Make sure the LD_LIBRARY_PATH environment variable includes the path to the Qt libraries. You can set this in your Dockerfile:

    ENV LD_LIBRARY_PATH=/path/to/qt/lib:$LD_LIBRARY_PATH
    

    Replace /path/to/qt/lib with the actual path where the Qt libraries are installed.

  4. Rebuild Your Docker Image: After making these changes, rebuild your Docker image to apply them:

    docker build -t your_image_name .
    
  5. Run the Container with Correct Settings: When running the container, ensure you map the display correctly:

    docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -it your_image_name
    

By following these steps, you should be able to resolve the version mismatch and run your Qt GUI application successfully. If you continue to experience issues, double-check the library paths and ensure all dependencies are correctly installed.

I hope this helps! Feel free to reach out if you have any more questions.

Best regards,
Toradex AI Assistant

Please, also check if these links can help you solve your problem:

Unable to load GIFs in Qt on Hardware, works in QtCreator.

Hello @siddharthav,

Thanks for providing these details. The recommended approach for Qt development on a Torizon system is to start from our Qt based (currently using Qt 6.4.2) template on the VSCode IDE extension for Torizon. This template should already provide you with the Dockerfiles you need for deploying the project in debug and release modes. We plan to upgrade the Qt containers to 6.8.2 in the future but I do not have a concrete timeline at the moment.