Unable to configure Qt for static building - qt

Essentially this is a repost of this question which was never answered. I am trying to set up Qt for static linking following these instructions.
So far, all I've done is go to where my Qt version is, and run
configure -static
I get some output, ending in:
Sources are in..............C:\QtSDK\Desktop\Qt\4.8.0\msvc2010
Build is done in............C:\QtSDK\Desktop\Qt\4.8.0\msvc2010
Install prefix..............C:\QtSDK\Desktop\Qt\4.8.0\msvc2010
Headers installed to........C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/include
Libraries installed to......C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/lib
Plugins installed to........C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/plugins
Imports installed to........C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/imports
Binaries installed to.......C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/bin
Docs installed to...........C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/doc
Data installed to...........C:/QtSDK/Desktop/Qt/4.8.0/msvc2010
Translations installed to...C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/translations
Examples installed to.......C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/examples
Demos installed to..........C:/QtSDK/Desktop/Qt/4.8.0/msvc2010/demos
WARNING: Using static linking will disable the use of plugins.
Make sure you compile ALL needed modules into the library.
Running syncqt...
I couldn't find a pro file for QtCore module
syncqt failed, return code 9
Please help

It's a known issue compiling Qt 4.8.0 from source.
Just delete syncqt.* in qt bin folder :
http://labs.qt.nokia.com/2011/12/15/qt-4-8-0-released/#comment-49942
http://labs.qt.nokia.com/2011/12/15/qt-4-8-0-released/#comment-49951
http://labs.qt.nokia.com/2011/12/15/qt-4-8-0-released/#comment-49953

I'm in the same situation of user963258 and I get the same error.
I deleted syncqt.* from qt bin folder, but I then get the same error
qmake gives code 3 when attempting to configure qt for static building
Why Qt4.8 has so many issues?

Related

Conan-based Qt installation uses wrong home dir for linking

I'm trying to build our application using Qt 5.13.0 installed via Conan/Artifactory. We run our own Artifactory server and the Qt version there is self-build (and statically linked) in our CI solution. We use the Conan recipe for Qt written by the bincrafters, slightly modified to apply some patches for known Qt bugs and set some flags for building properly on Android and WebAssembly.
When trying to build the application, the linker fails to find the necessary dependencies for Qt itself because it tries to look them up in the home folder of the user who build the Qt package, not the user who's running the build.
Here's an excerpt from the build log, showing the attempt at linking all previously compiled object files together:
application folder-------v subproject of the application----v-------v dependency of the application, correct user home dir---------v Qt library installed via Conan, correct user home dir-------v dependency of Qt, WRONG user home dir------------v
g++ -Wl,--gc-sections -o ../../fah [--> all the .o files <--] -L../lib -lmodel -lcore [--> more linked libraries and application parts <--] -L/home/kaupes/.conan/data/libsodium/1.0.18/bje/stable/package/d1efe3774eed76670888f919621e7c4e1b52efa9/lib /home/kaupes/.conan/data/qt/5.13.0/bje/stable/package/d6b3f512e1a5607061462f94e3271dc8af3dd516/lib/libQt5Gui.a /home/dev/.conan/data/harfbuzz/2.4.0/bje/stable/package/c68551ae35bf5d62e66263379d58a38416eb84a9/lib/libharfbuzz.a [--> many, many more libraries <--]
g++: error: /home/dev/.conan/data/harfbuzz/2.4.0/bje/stable/package/c68551ae35bf5d62e66263379d58a38416eb84a9/lib/libharfbuzz.a: No such file or directory
many, many more errors...
As you can see, the user running the build is kaupes, but the g++ invocation attempts to look for the dependencies in /home/dev/, the home folder of the CI user who build the Qt Conan package.
Only dependencies of Qt itself have the problem. Dependencies of the application (also installed via Conan) are found at the correct place.
The Qt package has been build in the CI using the following Conan invocation:
conan create --profile .conan/profiles/linux -s compiler=gcc -s compiler.version=9 . fah/stable
Compiler and version are explicitly set because I'm also build for another GCC version. The linux profile file also doesn't do anything interesting (as far as I can see):
include(default)
[settings]
build_type=Release
compiler.libcxx=libstdc++11
[options]
OpenSSL:shared=False
OpenSSL:no_asm=True
OpenSSL:no_asm=True
OpenSSL:no_weak_ssl_ciphers=True
OpenSSL:no_ssl2=True
OpenSSL:no_ssl3=True
OpenSSL:no_engine=True
libcurl:shared=False
libxml2:shared=False
libxml2:fPIC=True
libsodium:shared=False
pcre2:shared=False
libpng:shared=False
freetype:shared=False
bzip2:shared=False
libjpeg:shared=False
harfbuzz:shared=False
xkbcommon:shared=False
qt:shared=False
qt:with_glib=False
qt:with_sqlite3=False
qt:with_mysql=False
qt:with_pq=False
qt:with_odbc=False
qt:with_sdl2=False
qt:with_openal=False
qt:with_libalsa=False
qt:openssl=True
qt:commercial=False
qt:qtsvg=True
qt:qtdeclarative=True
qt:qtactiveqt=False
qt:qtscript=False
qt:qtmultimedia=False
qt:qttools=True
qt:qtxmlpatterns=False
qt:qttranslations=True
qt:qtdoc=False
qt:qtrepotools=False
qt:qtqa=False
qt:qtlocation=True
qt:qtsensors=True
qt:qtwayland=True
qt:qt3d=False
qt:qtimageformats=False
qt:qtgraphicaleffects=True
qt:qtquickcontrols=True
qt:qtserialbus=False
qt:qtserialport=False
qt:qtx11extras=True
qt:qtmacextras=False
qt:qtwinextras=False
qt:qtandroidextras=False
qt:qtwebsockets=True
qt:qtwebchannel=False
qt:qtwebengine=False
qt:qtwebview=False
qt:qtquickcontrols2=True
qt:qtpurchasing=False
qt:qtcharts=True
qt:qtdatavis3d=False
qt:qtvirtualkeyboard=True
qt:qtgamepad=False
qt:qtscxml=False
qt:qtspeech=False
qt:qtnetworkauth=False
qt:qtremoteobjects=False
qt:qtwebglplugin=False
qt:qtlottie=False
qt:qtconnectivity=True
Is there something I'm doing wrong during the Conan package creation or installation or is this caused by something different?
Indeed, when building qt, all paths to dependencies are hardcoded in configurations files (mkspecs\modules\qt_lib_*.pri).
I assume you are building your application with qmake, because you use static qt, and static qt is incompatible with cmake. One thing you could try is to pass the full path to harfbuzz lib to qmake by adding argument QMAKE_LIBS_HARFBUZZ=/home/kaupes/.conan/data/harfbuzz/2.4.0/bje/stable/package/c68551ae35bf5d62e66263379d58a38416eb84a9/lib/libharfbuzz.a to your qmake invocation.
Edit: it seems to be a knwonw behaviour of qt >= 5.12.1 : https://bugreports.qt.io/browse/QTBUG-72903. This feature has been reverted in 5.14.x and 5.15.x with https://github.com/qt/qtbase/commit/9864d2c6f3b628ca9f07a56b197e77bd43931cca

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 find c:\Users\qt\work\install\lib\Qt5Widgetsd.lib when compiling QtWebEngine examples

I downloaded Qt5.6 VS2013 32bit and try to run the official example of QtWebEngine.
I just followed the instruction but
When linking it gives out an error of
LNK1104 file not found c:\Users\qt\work\install\lib\Qt5Widgetsd.lib.
However, I have no idea of where this path c:\Users\qt\work\install\lib\ comes from.
I did text search in all directories of example folder and no hits other than generated files(makefiles and pdbs).
I also checked system environment variables but no hits.
Furthermore, I checked Qt Creator'r Projects panel and its Build Environment and still no hits.
Did I miss something?
P.S. this error was given out by linking DemoBrowser example of QtWebEngineWidgets pro
The link is generated by qmake when it generates the build scrip from the qt project file (*.pro). It is based from the qmake application path that is generaly installed together with the libraries (check you qt kit setup to change it if needed: Jst browse to qmake.exe application).
Then try regenerate the build script. It should fix the issue.
You may also have issue with installation not being in debug mode; you are trying to use Qt5Widgetsd.lib library instead of the non-debug one Qt5Widgets.lib

Where can I download qmlscene for Ubuntu

MMMMMM#unbuntu:~/QT/test4Qml$ qmlscene main.qml
qmlscene: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmlscene': No such file or directory
My Qt Development Environment does not have qmlscene. I googled it, and I only found *.deb. How should I do it?
As far as I know, Qt is not installed by default in /usr/lib/x86_64-linux-gnu/qt4. That directory is the default path when linux detects a dependency which requires Qt.
Where did you installed Qt? How did you installed it? Did you set the PATH environment variable to where Qt binaries are installed?
Usually, you have to follow the next steps:
1.- Install the the basic requirements for building Qt applications.
2.- Download Qt. I recommend Qt 5 using an offline installer. Otherwise, you'd need to compile from the source. Here you have a list of older versions of Qt.
3.- Set the environment variable PATH to the directory where you Qt bin directory is installed.

Integrating QWT 6.0.1 with Qt Creator/Designer 4.8.0

I've installed the Qt SDK version 4.8.0 (to C:\QtSDK) on a Windows 7 64-bit machine. I've also installed and successfully compiled QWT 6.0.1 with MSVC2010.
I can use QWT in C++ code by linking to the libraries; however when I try to use the plugin I get an error that I can't seem to find on the Googles.
My failed plugin error is:
The plugin 'C:/QtSDK/QtCreator/bin/designer/qwt_designer_plugin.dll' uses an incompatible Qt library. (4.8.0) [release]
My QWTbuild.pri has CONFIG += debug_and_release
I built the plugin by doing:
C:\QtSDK\QWT\qwt-6.0.1\designer > qmake designer.pro
C:\QtSDK\QWT\qwt-6.0.1\designer > nmake release
I then copied the .dll generated (qwt_designer_plugin.dll) in C:\QtSDK\QWT\qwt-6.0.1\designer\plugins\designer to my plugin path for QtCreator (C:\QtSDK\QtCreator\bin\designer)
I've also put the .dll and the .lib generated in the Qt plugins folder (C:\QtSDK\Desktop\Qt\4.8.0\msvc2010\plugins\designer).
I've also linked my libraries in the project file containing the form I'm trying to build.
I'm sure that there's something small I'm missing, but I can't seem to find it. What am I doing wrong here? Any help would be greatly appreciated.
Regards,
Alexis
The Qt plugins should use the same version of Qt or a lower version with the same major number as the application they are loaded in.
Since the Qt Creator currently included in the Qt SDK seems to use Qt 4.7.4, you should probably recompile Qwt for that version of Qt.

Resources