Qt project release ubuntu - error while loading shared libraries: libQt5Widgets.so.5 - c++

I want to release my project written with Qt to a Ubuntu / Linux user. If they try to execute the build release version they get this error message, because they have not installed Qt:
error while loading shared libraries: libQt5Widgets.so.5:
cannot open shared object file: No such file or directory
Is there a way to add all the libraries such as libQt5Widgets.so.5 to the folder where the executable is, just like under Windows with qt.conf, where you can specify the Plugins folder?

Try this
sudo apt-get install libqt5widgets5

One solution could be:
export LD_LIBRARY_PATH=/path/to/dir/with/libs:$LD_LIBRARY_PATH
But a proper solution would be to install QT libraries in system and/or package your app for Ubuntu (in your case).

I had recently updated the Android tools via the SDK manager when I saw this error.
Re-install the SDK tools to fix. That is what worked for my machine.

It may be simplest to package the project using Ubuntu's package management system. The Qt dependency will then be automatically installed by the package manager when your project is installed. That'd be the best way to go about it, as long as there is a version of Qt 5 available in Ubuntu's package repository. It'll save you a whole lot of grief.

Related

MinGW Installation Manager - Missing devpropdef.h file

I downloaded the MinGW Installation Manager and installed most of the packages available there in trying to find the 'devpropdef.h' file.
This file is needed by the openframeworks library and without it, I cannot compile the most basic project.
This file was listed by one of the contributors in this thread, but I don't know what happened to it.
Does anyone know which package it is in from the MinGW installation manager? Or how I can get my hands on it?
The http://winlibs.com/ build of GCC/MinGW-w64 has a very recent version of MinGW-w64 which contains devpropdef.h.

Qt - How to deploy application dynamically on Linux?

I have an application that I built using Qt Creator on Linux and want to deploy it now. However, I don't want to statically build it as I don't want it to be open-sourced. I tried the ldd ./YourExecutable command, however that only lists (and not add) the additional dependencies the application needs in order for it to run. My question is, how do I gather the necessary dependencies without having to individually look for these files? Is there a tool, such as windeployqt.exe on Windows, that I can use on Linux for the same purpose? Or is there a better approach than the one I'm thinking of?
Get Cygwin setup.exe: http://www.cygwin.com/
1.1. Run setup.exe and continue to package selection list.
1.2. Under Devel catagory select tools you need for compiling your source. For
example 'GNU make'.
1.3. Finish installing.
Get linux crosscompilers for cygwin:
"cygwin-gcc-linux.tar.bz2" (68.2 Mb).
md5sum: 340e91a346f5bb17e660db10e43005b8
These compilers are made with crosstool 0.28-rc37. This package contains:
gcc-3.3.4 and gcc-2.95.3 for i386 (glibc 2.1.3) and gcc-3.3.3 for amd64
(glibc 2.3.2).
Note! There is now newer version of GCC avaible with glibc 2.3.2:
"cygwin-gcc-3.3.6-glibc-2.3.2-linux.tar.bz2 (i386, x86_64)".
2.1. Copy 'cygwin-gcc-linux.tar.bz2' to 'c:\cygwin' or install directory which
you selected in setup.exe.
2.2. Open Cygwin shell and change directory to root with 'cd /'.
2.3. Uncompress to Cygwin root with command:
'tar -jxvf cygwin-gcc-linux.tar.bz2'.
Cross-compilers are installed under '/opt/crosstool'. You can use theim
directly or with commands: gcc-linux, g++-linux, gcc-linux-2.95,
g++-linux-2.95, gcc-linux-x86_64 and g++-linux-x86_64.
From: Cross-compiling on Windows for Linux
More info here.
It sounds like you want to use the shared library deployment option:
http://doc.qt.io/qt-5/linux-deployment.html#creating-the-application-package
Then if you wanted to go further than that, you could look into making a .rpm or a .deb .
There are lots of examples of qt projects that are now available on GitHub and have packages made. Usually for prebuilt binaries you need to make one for x86 and a separate one for x64.
Hope that helps.

Error in running Qt created executable on Ubuntu

I have written a code that runs successfully on a ubuntu machine having Qt installed but when I'm trying to run the executable on another ubuntu machine that don't have Qt I am getting this error:
error while loading shared libraries: libQt5Widgets.so.5
Since you have a shared build, you need the required shared Qt libraries on your system.
Alternatively if you want to build a standalone executable then you will have to compile it statically.
Following link maybe helpful:
How to make binary distribution of Qt application for Linux
As is clear, the required Qt libraries are not installed on the other machine, you will need to install Qt libraries first.
The standard procedure followed on Linux, is to create a package (Debian, rpm, pacman etc.) Since you are using Ubuntu, you should create a Debian package with libqt5gui5 mentioned as dependency, so when you install the package, Qt libraries are automatically downloaded and installed if necessary.

GL/glfw.h does not exist

I'm using Fedora 17 and compiling cocos2d-x. I've got an error at the compilation when I'm launching ./make-all-linux-project.sh.
G++ tells me that GL/glfw.h does not exist and then I yum install glew but it wasn't solved. So how can I solve this?
The package glew is actually the OpenGL Extension Wrangler. In this case your error is referring to a different package - GLFW. The problem with the build script you are trying to run is that it was made for deb-based systems, not rpm-based systems like Fedora. What's going to make this more difficult is that if you use YUM to download glfw and glfw-devel, they are not the version Cocos2d-x needs, so the build will fail. What you will need to do is first download a legacy version of glfw from Git Hub and build it from source.
git clone https://github.com/glfw/glfw-legacy.git
Once you build this package, you will need to modify the Cocos2d-x make file: $COCOS_ROOT/cocos2dx/proj.linux/cocos2dx.mk to include the legacy headers and also link to the legacy lib. The build should go smoothly after this, assuming all of your other dependencies are installed. You can refer to a blog post I put together for the detailed instructions: http://voidfuture.wordpress.com/2013/10/08/building-cocos2d-x-on-rhel-fedora-centos-linux/

G++/GCC: how to make your app tell OS to download libs it needs into system?

So for example I am creating some app that uses boost or openCV and on my developer machine all that is installed so app compiles without any problem. But I wonder how to make app tell OS to download libs I use on first run? Is it possible? (sorry - I am linux noob)
This is what package managers are for. What you do is you compile your project, and then you build a package (e.g. .deb or .rpm), using the appropriate tools. While doing so, you can specify where the various files in your package should go, but also which other packages your package relies on. These are known as "dependencies", and package managers like apt and rpm are pretty good at resolving them.
Here's the official debian guide to making packages to give you an idea:
http://www.debian.org/doc/maint-guide/
Alternatively, you can just distribute your program as-is and list the dependencies in the install instructions; users will then have to manually install them through their package manager before running your program.