I used 4.7.2 for the past months. Now I downloaded 4.7.3. Now I am searching to type "configure -static". But I don't know where the hell "the qt path". Can anybody shed a light on this issue.
Download the source package here. Download and install your favorite perl distribution. I must warn you that Strawberry perl comes with its own toolchain and that may get used instead of the MinGW you downloaded. Use ActivePerl if you don't want any trouble, or build it yourself.
Unzip it to say, C:\Qt-source so that there is a configure.exe in C:\Qt-source
Open the toolchain's command prompt
a) If you're using the Visual Studio compiler, search in the "start" menu for a CMD shortcut in the Visual Studio folder. The Windows SDK also has this shortcut.
b) If you're using MinGW, either use the accompanying mingwvars.cmd, or open a command prompt, (Run->"cmd.exe") and type set PATH=C:\path\to\mingw\bin;%PATH%. Try gcc -v to see if it can be found.
Make a build directory, preferable something like C:\Qt. Do set QTPATH=C:\Qt and set PATH=C:\Qt\bin;%PATH% and cd C:\Qt, and type:
..\Qt-source\configure -static
After configure finishes, you'll either have to type nmake (Visual Studio) or mingw32-make.
Go do something else, because it will take a while.
Some tips that result from my experience, and add a bit more to the answer of rubenv:
Pass the install directory as a flag of the configure; be sure to choose a different directory from the one where you have stored a non-static version of Qt!
Some modules will likely cause you troubles when compiling statically because you need to resolve the dependencies statically; one example is webkit, so if you don't need it be sure to disable it
It is generally not a good idea to build the debug symbols into a static library, so I normally debug with the dynamic version, and use the static Qt to generate releases only.
Therefore, my configure looks something like this:
configure -static -prefix C:\Qt\4.8.6_static -no-webkit -release
Related
How can I make a Qt build that I built with the -prefix parameter portable to other machines? When I copy my build over to a location on a different machine which differs from the location is specified for -prefix on the build machine qmake complains about not being able to find files and from the error messages it is clear that the files are being searched for in the directory that was used as the -prefix parameter on the original build machine. I mean, the builds that come from the Qt maintenance tool obviously do not have this problem since they do not know where they will be installed at.
My configure line is configure.bat -prefix C:\Development\qt-5.8.0-msvc2015-x86 -opensource -debug-and-release -nomake examples -confirm-license
Side question - when I use this build for Visual Studio with this build Qt cannot find qwindows.dll platform plugin. I copied it over to the binary folder under platforms and it works, but how does the installed Qt version get around this without copying anything?
the builds that come from the Qt maintenance tool obviously do not have this problem since they do not know where they will be installed at.
They do have that problem, and the maintenance tool works around it by binary patching the installation paths. You could do so as well. The paths are stored with empty space appended to facilitate this.
There's nothing you need to do to the build itself. Only after you unzip the build on the target machine, you need to patch it. A rudimentary patcher iterates all the files, and replaces the install path prefix with the real path.
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.
I followed these instructions in the configuration of OpenCV SDK for using it in Qt Creator IDE, but I couldn't conclude point 6.5, due to configuration errors in Cmake-GUI. I setup the configuration in CMake of the compilers gcc and g++ contained in Qt folder for MinGW32, and all looks Ok. But when Cmake-GUI starts the process of build configuration it ends up saying
"Error in configuration process, project files may be invalid".
It can't find the following:
QT_QMAKE_EXECUTABLE;
Qt5Concurrent_DIR;
QT5Core_DIR;
QT5Gui_DIR;
QT5Test_DIR;
QT5Widgets_DIR.
After this issue I tried to go on with following points of configuration tutorial, without reaching the final instruction of mingw32-make install. I'm using the following versions of softwares: Qt 5.3.0, OpenCV 2.4.9, CMake 2.8.12.2. My OS is Windows 7.
How can I recover the missing Qt files in CMake configuration?
Is there an alternative way for configuring OpenCV with Qt (like using precompiled build of OpenCV libraries)?
You just need to indicate CMake the correct paths to each one. Click oh the path to browse and set each one individually:
QT_QMAKE_EXECUTABLE;
For this one, you need to search inside the Qt installation folder for the /bin directory. On it, you' ll find the qmake.exe. In my case it was C:/Qt/5.3/winrt_x64/bin/qmake.exe
All the following ones are in the Qt's /lib/cmake directory. In my case: C:/Qt/5.3/winrt_x64/lib/cmake :
Qt5Concurrent_DIR;
C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Concurrent
QT5Core_DIR;
C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Core
QT5Gui_DIR;
C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Gui
QT5Test_DIR;
C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Test
QT5Widgets_DIR.
C:/Qt/5.3/winrt_x64/lib/cmake/Qt5Widgets
Then click generate. It' ll show a new error and ask you for the QT5OpenGL_DIR. Just as before, show CMake the correct directory. In my case: C:/Qt/5.3/winrt_x64/lib/cmake/Qt5OpenGL. Finally, click Configure again, and then Generate, and now you're done creating the build files.
You have to specify the location of Qt manually by passing it as an argument for QT5Core_DIR. Qt5_DIR or CMAKE_PREFIX_PATH does also the trick.
Example
Given your Qt 5 is installed at /opt/selfcompiled/Qt5. When calling cmake, add the flag from above:
cmake -DQt5_DIR=/opt/selfcompiled/Qt5 <pathToSourceDir>
Once the Qt 5 directory is set and found by CMake, all the other variables related to Qt 5 should be found from there, too.
I downloaded C++ libJSON from this link:
And they suggest me to use it as a library. How can I create library using the code they have provided?
you must have installed g++ and make in console/terminal just compile it type make, it will produce libjson.a which is static libary. When you create you C/C++ program you can link it with it g++ -l libjson.a
and in your code include libJSON.h header file.
#include "libJSON.h"
and you can use all functions from that header file.
On windows you must Install MinGW (GNU utilities for Windows), or IDE like DevC++ or Code::Blocks (Code::Blocks use MinGW). You can also use Cygwin unix like environment for windows (but when you compile file in cygwin you can run it only in Cygwin)
In Code::Blocks when you create project you can set additinal library which will be linked with your executable.
i was trying to compile libjson 7.6.1 for Visual Studio 2010. And was facing some difficulties in compiling it. What i did was
Download Libjson
open libjson.vcproj and goto line 240. You will find a missing ">". Type it in and save the file.
Now this can be used to build dynamic and static lib.
A simple thing wasted my couple of hours. Hope it saves some of yours.
This solution also works for more recent versions of Visual studio (e.g. 2015) which otherwise fail to complete the conversion to the mare recent project format.
I was searching a lot through Qt forums and Google for the last few days, but I could not find any obvious answer to this question.
I found the -prefix option (not even documented on Windows) that can be supplied to configure to specify different install directory, but this is not clear separation of the sources and binaries at all, since the build is still done in the source directory and then the files needed for installation are copied to the install directoy. I tried this -prefix option, and came to some problems. (i.e It doesn't copy the .pdb files to the install directory.)
Then I found this link about doing shadow builds but it has the big limitation that the build dir must be at the same level as the source dir.
I'm guessing you didn't try make
install? So try that. It should
install Qt to a separate directory
away from the sources.
Are you saying that after I do configure, I should do nmake install instead just nmake? I know that nmake will process the generated makefiles from qmake and will place them in the source Qt dir, but what nmake install will exactly do i.e in which directory will install the files and how to specify the directory where the files will be installed.
Note that I already do this:
configure -prefix builddir -platform win32-msvc2005
nmake install
The effect of the above two lines was that qt was compiled in the source dir and not directly to my builddir specified with prefix. Then the compiled files were copied in my builddir. I was hoping for something that will build my Qt files directly to the build dir, cause this way I stil need 4 Gb space for my source dir during the compilation. Also the pdb files were not copied to my buildir which is another issue.
Basically, you just have to run configure.exe from your build directory. For example:
mkdir \qt\4.5.2-build
cd \qt\4.5.2-build
set PATH=%cd%\bin;%PATH%
\qt\4.5.2-sources\configure.exe -platform win32-msvc2005
Where sources are in \qt\4.5.2-sources, that would cause the build to go into \qt\4.5.2-build on the current drive.
Also, you must have perl in your PATH, ActiveState Perl is suggested.
I had not previously heard of this limitation where the build and source directories must be at the same level. If you hit this problem you could try working around it by creating a symbolic link (see mklink command).
IIRC on Windows, you have to do a sandbox install, you can't do the UNIX-typical "make install".
There are two options usually for building Qt, -prefix-install and -prefix /foo
You pick one, so if -prefix doesn't allow you to type make install, then I guess on Windows you have to use the -prefix-install route, which is a sandboxed install to the directory you extract Qt to.
I'm guessing you didn't try make install? So try that. It should install Qt to a separate directory away from the sources.
At least the problem with the missing include files (e.g. qscriptengine.h) may by solved by temporary adding \qt\4.5.2-sources\include\Qt to the include path.
I moved the shadow build out of my home folder to a folder in C: and it worked. I know it's weird, but that's what happened. I suspect it must be a bug in syncqt.