Deployment of statically linked Qt application backward compatibility - qt

This is my first attempt at making a Qt Application work on different systems.
I have opted for static linking method.I have already compiled the sources of Qt 5.5 and compiled my application with the static Qt. The executable is working fine on my computer.
My operating system is Ubuntu 15.04. But when I tried to run the same executable on Ubuntu 14.04 then I ran into trouble. The key details of the error message are given below.
libstdc++.so.6 cxxabi_1.3.8 not found
I did a standard Google search and realised it was because I had a newer version of it on my machine, the machine where I had created the executable. There were so many different approaches to handle this problem. One of the solutions I saw involved shipping your own copy of libstdc++.so with the executable. But when I tried to copy the .so file to a pen drive, there was a warning saying that the file system does not support such files.
My question is , what am I doing wrong ? Also if I wanted to make the executable target Ubuntu 10.04, what would be the correct procedure handling the backward compatibility issues. I know that one method would be to install the same OS on my machine and then create the executable , is there any other way?

libstd++ is backward compatible but not forward compatible, which means you can run a program with a newer version of libstdc++ than the one you compiled it with but not vice-versa. This is what you experienced.
One way to deal with this issue is using older OS versions as the build machine. When you for example use Ubuntu 14.04 LTS, you'll get this list of compatible target systems.
The build system you're using will probably limit available compilers. On Ubuntu 14.04 you get GCC 4.8, which is good for most C++11 and packages for clang 3.6 are available, which will give you full C++14 support.
Targeting Ubuntu 10.04 will be challenging if you do not want to use a stone age compiler.
The idea of shipping libstdc++ will not help you much because you'll run into the same problem with libc.

Related

Run Binary With Specific QT Version - Cannot mix incompatible Qt library

I'm trying to replicate an application that we currently have running on a physical Ubuntu server using an Ubuntu machine in Virtual Box. It is a QT application but on the server we are running it using pm2 from NPM. After installing QT, and installing drivers needed for the application i've tried to run it but keep coming across this error:
Cannot mix incompatible Qt library (version 0x50701) with this library (version 0x50905)
I've inherited the code from someone else and don't want to change the project to QT5.9.5, so i'm trying to run with 5.7.1, I've followed instructions on other questions in order to change the QT version to 5.7.1 but still get the same error when running it.
I followed the instructions here:
https://unix.stackexchange.com/questions/116254/how-do-i-change-which-version-of-qt-is-used-for-qmake
When checking the QT version using "qmake -v" in the console I get the following output:
QMake version 3.0 Using Qt version 5.7.1 in /home/sam/Qt5.7.1/5.7/gcc_64/lib
So although it looks to me like i'm using the desired version of Qt (5.7.1), i'm still getting the incompatible library issue, i'm very new to all of this so apologies if this is a stupid question. If anyone could tell me what to do in order to use the compatible library that'd be great, thanks.
I will try to explain this in steps!
Each complete set of Qt libraries is called a Qt "distribution". You can get Qt distributions from a variety of sources:
Installed from the package manager of your OS (.deb/.rpm).
From a downloaded zip file on http://qt.io
As a cloned repo from git
etc..
Some of the available Qt distributions will come pre-built, and some will need to be built from sources. In either case they will all have a qmake program that is specific to that particular Qt distribution. This program is responsible for building programs so that they link to the particular Qt distribution that the qmake is part of. qmake is also used when building with QtCreator.
If you have a binary built with one qmake and you try to run it on another computer, it might find the wrong Qt libraries during dynamic linking and spit out errors of "incompatible version of Qt".
There are many solutions to this problem;
Collect all the Qt libraries (Mine are in /home/myusername/Qt/5.version/gcc_64/lib/*.so) in the same folder as your program executable. This will make sure they are prefered to any other version of Qt that may be in your dynamic linker's path.
Uninstall the OS supplied Qt version(s). This may not be advisable especially if other programs use them.
Rebuilt your program from source using the correct qmake.

Cannot cmake kde-connect

I am trying to install kde-connect following this.
Although my kubuntu version is 14.04, I wanted to compile them so that I can have the latest version. But when I followed the instructions to compile, i get the following error.
-- Found Qt-Version 5.2.1 (using /usr/bin/qmake)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
QT_QT_INCLUDE_DIR
used as include directory in directory /home/vinaychandra/Downloads/t/CMakeFiles/CMakeTmp
CMake Error: Internal CMake error, TryCompile configure of cmake failed
CMake Error at /usr/share/kde4/apps/cmake/modules/FindKDE4Internal.cmake:1311 (message):
Unable to compile a basic Qt application. Qt has not been found correctly.
Call Stack (most recent call first):
/usr/share/cmake-2.8/Modules/FindKDE4.cmake:95 (find_package)
CMakeLists.txt:7 (find_package)
Please point out how to correct this.
I have tried giving -DQT_QT_INCLUDE_DIR=/usr/share/qt4/
then it tells that You must build your code with position independent code if Qt was built with -reduce-relocations.
Your cmake by default uses a different QT version.
So, you must explicitly tell him which version of QT he have to use for this job.
This one
-DQT_QT_INCLUDE_DIR=/usr/share/qt4/
Is wrong because you mustn't give QT position explicitly.
All you need is to use the right qmake.
So, give'em this flag and you'll be happy!
-DQT_QMAKE_EXECUTABLE=/usr/bin/qmake-qt4
Since most of kde applications are not ported to Qt5, you need Qt4.x for building kdeconnect(don't know x, mine is 4.8.6).
Also Qt4 installer is not available (I think !), so you have to build it also from source. Building Qt4 is quite easy, just download the source and run the usual commands.
After building it, it qmake name will be qmake-qt4 in /usr/bin.
So for building kdeconnect, first run its cmake, then a Cmaketextcache.txt file will form.
In that change the path of qmake (i.e somewhere written /usr/bin/qmake to /usr/bin/qmake-qt4) and also the path of qt include dir to (I think /usr/include/qt5 to /usr/include/qt4), and run the cmake again.
If some packages are missing, then you have to install it.
But with the above changes, you will get a make file to install it.
Unfortunately, the cited documentation is lagging behind the current state of kdeconnect. I ran into similar problems but I managed to solve them by installing the following required packages from the Kubuntu repositories:
sshfs
libfakekey-dev
libxtst-dev
libqca2-dev
libqjson-dev
I trust these are all of them. I installed kdeconnect from the latest git commit and it seems to run fine.
This answer comes a bit late, but this is the first Google search result for the question. In systems with qtchooser (Kubuntu, Ubuntu at least), this can be fixed by running first:
export QT_SELECT=qt4
This makes all of the Qt build tools to default to the Qt4 version instead of Qt5. You can check which Qt version is active by running:
qmake --version
Try kde connect install on ubuntu: https://fazlerabbi37.github.io/blogs/install_kde_connect_in_ubuntu_18.04.html
(in 18.04 & 19.04 it works with simple sudo apt install kdeconnect
Install kde connect on android device (google play store is where I installed from)
Invoke kde connect from desktop
Invoke kde connect from android and search device.
Your ubuntu will be found / initiating a search from desktop results in android phone pulled up for pairing
Accept pairing request
Provide access to folders
Try clicking on a video/image file for transfer
I could see the new file transferring in /Downloads folder of desktop
allowing/disallowing desktop to access sms, notifications etc are now a choice
Note: Pl treat this with pinch of salt. This appears very simple, effective for a main reason it worked for me in no time.

pip install PySide fails QtCore Framework check (OS X)

The error
When I run pip install PySide – whether in a virtual environment or not – build fails with the following error:
... [lots of build info, including a few warnings but no errors, for shiboken]
Linking CXX executable shiboken
ld: framework not found QtCore
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Seeing as I have QtCore installed and the framework present (see below), I'm not sure why that should be.
Setup info
Software versions
OS X 10.8.2
Qt 4.8.4 from the developer distributed binaries
Python 3.3 installed and working normally
XCode 4.6
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.1
Virtual environment generating using pyvenv (with and without --no-site-packages)
Other configurations attempted
Python 2.7 installed and working normally
Virtual environment generated using mkvirtualenv (with and without --no-site-packages)
virtualenv 1.8.4
mkvirtualenv 3.6
System configuration
I've confirmed that QtCore is in fact installed correctly: ls /Library/Frameworks shows a number of Frameworks, including QtCore.Framework.
My path currently includes both /Library/Frameworks/QtCore.framework and /Library/Frameworks/QtCore.Framework/Versions/4 – the former of which has a symbolic link to the component in the latter location. I've even tried it with /Library/Frameworks, though for obvious reasons I didn't expect that to help and it did not.
Other notes
I've tried the same thing with easy_install and by doing a pull from the Git repository and building manually using setup.py. As one would expect, they all return the same results.
Things I've already read
PyPi Installation walkthrough
Link error: QtCore.framework/Versions/4/QtCore for architecture x86_64 (Stack Overflow) – but it seems the linker is already asking for the framework, based on the error message I'm receiving.
Mac OS X: trying to link (ld) against a framework (Stack Overflow) – general info on linking against Frameworks; again, I seem to have this covered.
OSX deployment target confusion for 2.8.10 (CMake Mailing list) – looks like a very similar error, but I don't have direct control of the -isysroot flag using pip (or easy_install or even python setup.py) for one and for another, installation structure seems to have changed substantially between OS X 10.6 and 10.8. For example, /Developer no longer has the SDKs directory in it at all.
CMake bug report 0013765 – this one looks exactly the same, but appears to have been patched, so I'm not sure why it would still be causing me a problem.
Preferences
I'm not using a package manager like Homebrew or MacPorts at this time, and I'd prefer not to, either, as I need to get as close as possible to a platform-agnostic installation procedure for this (we're looking at doing cross-platform development; I'll ultimately be targeting Windows applications primarily, but need to see if it's workable on my Mac development machine outside a VM).
It needs to be able to work with a Python 3-style virtual environment (pyvenv) setup, as that's our preferred means of isolating our particular requirements.

Qt 4.8.3 installation on Windows 7 & QtWebkit problems

I just updated my Qt to 4.8.3, because the program built from older version is not compatible to the new framework.
So I have to upgrade.
This process was frustrating and time consuming. So many problems came out.
I download Qt from this url:
http://qt-project.org/downloads
At beginning, I installed the MinGW one (I'm not a fan of MSVC).
I tried the newest ( I think it's 4.6) version of MinGW and order version (4.4).
However, after I installed MinGW and tried to install Qt 4.8.3, during the process, the following message shows up:
There is a problem with your MinGW installation:
The installer could not find a valid C:\MinGW\include\w32api.h (Only versions with W32API 3.13 are supported)
Do you still want to continue? (Your installation may not work)
The 4.6 version does have this w32api.h file, I don't know what's going on. And I have trouble finding MinGW 4.4 with this head file.
I decide to ignore this warning and continue to install Qt and Qt creator. After that,
I opened my current project, configure it (why the configuration become so complex...), I tried to build it.
Then the following message shows up because some external lib I used requires Exception Handling:
exception handling disabled, use -fexceptions to enable
And I don't know how to enable the it.
I tried to add -fexceptions flag in QMAKE_CXXFLAGS but it doesn't work.
By the way, I tried the VC version of Qt too, but I used the MinGW before and the VC compiler is quite different, if I use VC version, it will take a lot of time to make it compilable by VC compiler.
Does anyone know how to install Qt 4.8.3 on Windows? my project works fine before, now I just want to compile it successfully.......
These are not the only problem.
I updated the Qt on Mac machine too, it is easier to have the compiler work since it's unix base.
However, I used QtWebkit lib in my project and obviously, they changed this lib and it's not compatible to order version.
I can compile my project on Mac, however, every time I run it, following massage shows up and the program stopped.
dyld: Symbol not found: _OBJC_CLASS_$_CALayerHost Referenced from:
/Library/Frameworks/QtWebKit.framework/Versions/4/QtWebKit Expected
in:
/System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore
The program has unexpectedly finished.
Does any one know how to solve this QtWebKit problem? I'll really appreciate.
I remembered that when Qt is under nokia, it's so easy to install and use, the Qt SDK is perfect.
I really hate the change made after it was bought by digia.........
I found solutions of my first two problems:
for the first problem, as I described, download the MinGW provided by Nokia Qt
ftp.qt.nokia.com/misc/MinGW-gcc440_1.zip [ftp.qt.nokia.com]
Tried several versions of MinGW 4.4, I think this is the only one works.
About the second problem, add following configure in the project file:
CONFIG += exceptions
Now the QWebKit problem is only one unsolved.
Is it all relevant that your include directory for MinGW has two "i's" in it or was that a typographic error when posted on SO? See:
The installer could not find a valid C:\MinGW\iinclude\w32api.h

Can you install Qt-4.6.0-wince successfully?

I'm trying to install Qt-4.6.0-wince on XP and Vista. I read the instructions and follow it to install.
However, I can't install it successfully due to some fatal errors on all of the two machines. I think the problem is that qconfig.[h cpp] files are not created automatically during the configuration.
I already report about this problem, so you can see the more information here. However, it is still remained as unresolved.
Anybody here who has been installed it successfully?
#KernelJ I believe the original poster is using the correct install distro - the final product will be cross compiled from Win32 to WinCE; as is pointed out in the Qt for Windows CE Requirements.
#Brian, Unfortunately, I can't answer your original question - I have had unrelated trouble with the WinCE distribution myself and am working the issues now. However, I can provide some help: I was able to get the Qt Everywhere 4.6 to cross compile on my Win32 (XP) host for WinCE. I used the commercial version, but here is a link to the Open Source Qt Everywhere 4.6 package. As is pointed out in the nokia instructions, make sure to use the Visual Studio command prompt, get your environment variables ironed out, create a custom mkspec (if you have to), and keep a close eye during the configuration for any warnings.
Good luck.
Qt-4.6.0-wince, as is implied in the name and said explictly on the page you linked, is for Windows CE, NOT for Windows XP and Vista!!!
Nokia have released a nice software development kit for Qt which you can download here. It is very impressive and powerful!
I got things running as compilable (and running on emulator) with VS 2008, so your milage may vary:
Make sure the PATH variable points to \bin
Open a command prompt (using the Visual Studio Command Prompt)
Run the vcvars32.bat file (in C:\Program Files\Microsoft Visual Studio 9\VC\bin) folder
Cd into the qt folder
Run this: configure -no-sql-sqlite -no-qt3support -platform win32-msvc2008 –xplatform wincewm50pocket-msvc2008 -no-phonon -no-phonon-backend -no-webkit (building for WINCE 5.0, and all the '-no-...' makes it build faster, removing stuff we don’t want)
The setccepaths script provided sometimes doesn’t work. I used checksdk.exe –script temp_script.bat (It creates a script, the default is for Pocket PC SDK 5)
Run that script you just created (the temp_script.bat thing. It sets up environment variables.
Run nmake
*whew*
and good luck.

Resources