libGL.so.1 not found: Qt GUI app in docker with centos - qt

I am trying to run a Qt app in docker. I have a very limited Linux experience. The OS is centos. Qt version is 5.9.1. The overall idea is to run it in Xvbf. (I have already run firefox in DISPLAY:1(Xvbf) inside docker under centos)
When I try "docker run -it myTestGuiApp", I get an error libGL.so.1: cannot open shared object file: No such file or directory.
What is missing here?
Thanks in advance.

You probably have a missing library. You might need to install this : yum install mesa-libGL
Just add this line in your dockerfile : RUN yum install mesa-libGL
If this doesn't work, copy here your dockerfile.

Related

Can't load shared library libQt5Core.so.5

This question has been asked before, but the fixes don't work for me. I am running Windows 10 with WSL (Debian) and I am unable to run a QT program because of the error
texconv: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
I found a post which discusses the same problem. I've tried tolos' and Envek's solutions, but they don't work for me. For me the file is under /usr/lib/x86_64-linux-gnu/ like tolos' was. I also sudo-ed the strip and recompiled the qt program (If that even matters), but it still doesn't work.
If it matters, my kernel version (checked with uname -r) is 4.4.0-18362-Microsoft and I have no issues running this qt program on my other PC that uses WSL Ubuntu. And I installed the qt stuff with this command: sudo apt-get install qt5-default qtbase5-dev
I had an image that I would run using docker run and which would successfully launch KStars -- an application that uses this libQt5core.so.5.
If I ran the very same image on a Kubernetes cluster then I would get an error message when launching KStars like libQt5Core.so.5: cannot open shared object file: No such file or directory or some such.
Putting this strip command into the Dockerfile and rebuilding the image allowed the application to load successfully in both environments.
sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
I got it working in the end. I upgraded from WSLv1 to WSLv2 and that solved it. Not sure why, but it must have been a WSLv1 Debian bug

Symlink lost within Docker image

I am defining a Dockerfile where I install sqlite3 in a ubuntu based image, something very similar (I also install grpc and rust as well as all the necessary dependencies) to:
FROM ubuntu
RUN apt-get update && \
apt-get install -y sqlite3 libsqlite3-dev&& \
apt-get clean && \
apt-get autoremove
I use this image to built my Rust project within it. The issue that I am facing is that cargo build fails on my GitLab CI due to a linking issue:
Compiling migrations_macros v1.4.0
error: linking with `cc` failed: exit code: 1
...
= note: /usr/bin/ld: cannot find -lsqlite3
I found out that this is due to this symlink not being present on the Docker image that is running on CI:
libsqlite3.so -> /usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6
while the file libsqlite3.so.0.8.6 exists. So if I create the symlink during the CI jobs I can have a working workaround. The weird thing is that if I pull the same exact image from my registry on my pc and run the container I can build without any issue and any change because the symlink is actually there.
What could be the cause of the problem and how to solve it?
After quite a bit of thinking the following ideas come to my mind which could help.
Docker history
Docker command has a build in feature to view the history of a built image. You have the option to identify the problematic command in the DockerFile.
docker history <image id or name>
For more visual filtering i do recommend dive tool but others are also available on google.
Correct docker version
Since in this scenario the two docker instances are different the question is trivial. Are they on the same version of docker daemon and docker file system driver?

Qt non-interactive install in Docker file fails with QXcbConnection DISPLAY Error

I am running a Docker file that does a non-interactive installation. The installation fails with a DISPLAY error. I can confirm that the non-interactive install works on a Ubuntu 14.04 VM with a display. I'm trying to install on a development server without a display.
Here is the output:
Step 15/21 : ENV QT_VERSION_A=5.8
---> Using cache
---> 585508f8fb4e
Step 16/21 : ENV QT_VERSION_B=5.8.0
---> Using cache
---> 32eb654acb19
Step 17/21 : ENV QT_VERSION_SCRIPT=580
---> Using cache
---> 7be314d66824
Step 18/21 : RUN wget https://download.qt.io/archive/qt/${QT_VERSION_A}/${QT_VERSION_B}/qt-opensource-linux-x64-${QT_VERSION_B}.run
---> Using cache
---> b16f68a4774e
Step 19/21 : RUN chmod +x qt-opensource-linux-x64-${QT_VERSION_B}.run
---> Using cache
---> dcd41dd5c287
Step 20/21 : COPY qt-noninteractive.qs /qt-noninteractive.qs
---> Using cache
---> 72c46b2abe23
Step 21/21 : RUN ./qt-opensource-linux-x64-${QT_VERSION_B}.run --script qt-noninteractive.qs
---> Running in e75d96617513
QXcbConnection: Could not connect to display
Aborted (core dumped)
Is there an option I can give where it doesn't need a display?
I tried going the non-GUI install apt-get method on Ubuntu to install Qt but the problem is 'apt-get qt5-default' does not contain Qt5 WebEngine which I require. Any help would be appreciated.
Here's the Docker File Qt install snippet:
ENV QT_VERSION_A=5.8
ENV QT_VERSION_B=5.8.0
ENV QT_VERSION_SCRIPT=580
RUN wget https://download.qt.io/archive/qt/${QT_VERSION_A}/${QT_VERSION_B}/qt-opensource-linux-x64-${QT_VERSION_B}.run
RUN chmod +x qt-opensource-linux-x64-${QT_VERSION_B}.run
COPY qt-noninteractive.qs /qt-noninteractive.qs
RUN ./qt-opensource-linux-x64-${QT_VERSION_B}.run --script qt-noninteractive.qs
I tried going the non-GUI install apt-get method on Ubuntu to install Qt but the problem is 'apt-get qt5-default' does not contain Qt5 WebEngine which I require
You could (additionally to the apt-get qt5-default) install the package which does contain it. If you check https://packages.ubuntu.com/search?keywords=web+engine there are the packets. Maybe libqt5webengine5 or libqt5webenginewidgets5. So your command would then be:
apt-get qt5-default libqt5webengine5
First, ensure you have the silent option enabled in your .qs controller
function Controller() {
gui.setSilent(true);
Then, use the --platform minimal option when calling the Qt Installer.
RUN ./qt-opensource-linux-x64-${QT_VERSION_B}.run --platform minimal --script qt-noninteractive.qs

Centos6 PHP7 Install SPL_Types

I am running CentOS 6 and am trying to install the SPL_Types extension for PHP7. I have php7 up and running however, any time I do pecl install SPL_Types,
I get massive compiler errors and can't find a way around. Ubuntu users can fix the issue by installing libpcre3-dev, but this is not a valid package on CentOS 6. I have verified that pcre and pcre-devel are installed and the latest version. Does anyone have a solution to this?
EDIT 1: A full log when I run the sudo pecl install SPL_Types command: http://pastebin.com/QG3mFjaf
I got it figured out. For those who wish to know, I had to use a third party source to compile and install the extension, then I had to edit my php.ini file manually to add the new module.
https://github.com/esminis/php_pecl_spl_types
then once you have it, run the commands:
phpize --clean
phpize
chmod +x configure
./configure --prefix=/usr
make install
Then, edit your php.ini file and under the dynamic modules section, add
extension=spl_types.so
Restart the httpd service by doing
sudo service httpd restart
Then verify the new module is loaded with phpinfo().

How to install wkhtmltopdf patched qt without compiling?

I'm using google cloud instance for host Odoo, somo reports print to pdf ok, but other with custom paperformat get the following error:
"The switch --header-spacing, is not support using unpatched qt, and will be ignored.The switch --header-html, is not support using unpatched qt, and will be ignored.The switch --footer-html, is not support using unpatched qt, and will be ignored.QXcbConnection: Could not connect to display"
I google it, and to solve I need to compile wkhtmltopdf like this:
http://www.grobak.net/id/blog/how-fix-wkhtmltopdf-failed-error-code-6 but this proccess need 3 hs and I'm building a script to install google instances on the run with odoo dependencies.
the .deb package have a dependency broken
Anyone know other solution?
My system configuration is Ubuntu 14.04 and 64 bit. So, i am downloading according to that.
First you have to check your system OS name by
lsb_release -a
Check to see if your Ubuntu Linux operating system architecture is 32-bit or 64-bit, open up a terminal and run the following command below.
file /sbin/init
Download wkhtmltopdf patched with qt using below command
sudo wget -P Downloads https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
Here, replace "trusty" with your OS name and if 64 bit only then keep "amd64" like that , otherwise change it to "i386" and down load the deb file.
After that execute the following commands,
cd ~/Downloads
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
Now, check wkhtmltopdf version with below command,
wkhtmltopdf -V
Enjoy!!
After trying many ways I finally made it work.
First I removed all my previous installation by
sudo apt-get remove --purge wkhtmltopdf
sudo apt-get autoremove
Then I opened wkhtmltopdf.org and navigated into their Downloads > Archive. In Archive section I downloaded 0.12.1 .deb version by
wget <copy the link from website for the.deb file and paste it in terminal here>.
sudo dpkg -i <package name>
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
This is because odoo looks for wkhtmltopdf in /usr/bin directory otherwise gives IOError. I also set my webkit_path parameter in Odoo System Parameters to /usr/bin.
Thats it. Hope this helps
I was facing same issue with wkhtmltopdf 0.12.4
installed new version of wkhtmltopdf 0.12.6-1
follow below commands to install wkhtmltopdf 0.12.6-1
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
yum localinstall wkhtmltox-0.12.6-1.centos7.x86_64.rpm #centos specific command

Resources