`Could not find feature system-zlib` during building QT source code - c++

I'm trying to build QT from source code in Windows.
I installed QT binary (5.12.8) to get qmake, the bin path is added to system environment.
I downloaded QT source code (qtbase only) tag v5.12.8 and unzip to d:\github\qtbase
I opened the vs native x64 cmd shell and run: qmake qtbase.pro
The output is like:
Support enabled for:
Using pkg-config ....................... no
udev ................................... no
Using system zlib ...................... no
.
.
.
Qt is now configured for building. Just run 'nmake'.
Once everything is built, you must run 'nmake install'.
Qt will be installed into 'C:\Qt\Qt5.12.8\5.12.8\msvc2017_64'.
then I run nmake but I had this error:
Project ERROR: Could not find feature system-zlib.
NMAKE : fatal error U1077: 'cd' : return code '0x3'
Stop.
From the config log above, system zlib is not used, I assume QT's internal zlib will be used.
I have checked my folder, \src\3rdparty\zlib\src is existed and zlib.h is there.
I'd like to know how to fix this error or disable zlib.

#AlanBirtles Thanks for the hint, I followed the official instructions and compiled again, it works.
In the official instruction, configure.bat is used instead of my direct use of qmake.
There is one more difference in my second try: I use the src code in C:\Qt\Qt5.12.8\5.12.8\Src, not the code from github in d:\github\qtbase.
The code in C:\Qt is downloaded during my installation of binary QT, because I checked the source code item in the installation.

Related

How do i install socket.io c++ client library

I am trying to use socket.io c++ client implementation.I have never used an external library before with c++ so im confused.
This is the library i am trying to use:
https://github.com/socketio/socket.io-client-cpp
So i followed this instructions:
https://github.com/socketio/socket.io-client-cpp/blob/master/INSTALL.md
Installed boost and cmake as its stated and i guess it is fine.
My problem is with the 4th step and the rest of it.
If i run
make install
console throws:
make: *** No rule to make target 'install'. Stop.
current dir looks like:
To be honest i didnt understand what is 5th step, and the installation process in general.How should i include this library in my main.cpp so that i can use it ? What are those visual studio project files generated ?
Edit:
If i open INSTALL visual studio project file and build INSTALL project from solution explorer,i get this error:
Edit2:
After updating websocketpp library now i get this error after build:
if you are having lots of issues this is how i solved mine:
boost 1.7.0 was not working for me.I installed boost 1.65.0
after that update websocketpp library
go to C:\socket.io-client-cpp\.git\modules\lib\websocketpp directory with command line and type
git pull origin master
so after changing boost version to 1.65.0 and updating websocketpp finally it built succesfully.

Cannot Run Compiler 'cl' for qt5.10.1 on Windows 10 in terminal

I have never used qt before, but I got a task to build an already existing application for Windows and Mac using the newest version of qt. What I have done so far is:
Installed Visual Studio Professional 2017.
Installed the latest Qt 5 Open Source.
Note: when installing the QT 5 I installed all of the components under QT/ QT 5.10.1 which were: qt 5.10.1 components and under QT/Tools I installed QT Creator 4.6.0 CDB Debugger Support and MinGW 5.3.0 : qt 5 Tools
I cloned the branch from GitHub that I wanted to build to C:/Projects
Then in Git Bash I cd to the project and tried to run qmake. The first time I had this problem:
"bash: qmake: command not found"
After searching into the problem I found out that I haven't added "Qt/5.10.1/msvc2017_64/bin" to PATH and I added it. Now when I echo $PATH I can see the directory added.
Now after bash recognises qmake and I try to run it it says:
Project ERROR: Cannot run target compiler 'cl'. Output:
===================
Maybe you forgot to setup the environment?
I have no idea how to fix the problem due to the fact that I have never used QT to build anything before. Can you help me?
In the read me file for the application I am trying to build it says:
Step-by-step instructions
1. Clone this branch
2. cd into the project
3. Run qmake - this wil generate Makefiles for all of the project's modules
4.Run make (Use the -j4 of -j flags - this greatly speeds up the build process - see the manual page for make for more info). You can also use the -s flag to silence the output - this also wins you a few seconds.
I am a bit puzzled by the instructions, it does not say to run qmake -project anywhere, but there is a qt project file in the directory that I cd to. Does this mean that I don't have to run qmake -project?
Also I have no idea how to run make by using the -j4 and -j flags and how to run flags in general. Could someone help me?
I believe that for the Cannot Run Compiler 'cl' issue I have some kind of a problem with the set up. Did I install too many components or is it to do with the VS setup?
I highly recommend you to install Qt from the Qt installer, and to use Qt Creator.
However, if you want to use it from source, you first need to get a compiler (ex: MinGW). Then you need to execute the instructions, but you need to use a MinGW (or whatever compiler you use) command prompt, which will automatically set the environment variables needed.
Note that this is Windows specific. On mac and linux, the compiler's environment variables are already set in the default command prompt (if there is a compiler, obviously).

CMake zlib Dependency Error on Windows

I'm trying to build OpenEXR 2.2 on Windows, but the instructions that came with the download aren't working as expected. The instructions for IlmBase worked, but once I get to the OpenEXR instructions, it fails because of zlib. The steps at this point are:
3. Go to http://www.zlib.net and download zlib
So I went to this website and in the section that starts with: The current release is publicly available here: I downloaded zlib source code, version 1.2.8, zipfile format...
Then, I moved on to the next step, which is where I get the error:
4. Launch a command window, navigate to the OpenEXR folder with
CMakeLists.txt, and type command:
setlocal
del /f CMakeCache.txt
cmake
-DZLIB_ROOT=<zlib location>
-DILMBASE_PACKAGE_PREFIX=<where you installed the ilmbase builds>
-DCMAKE_INSTALL_PREFIX=<where you want to instal the openexr builds>
-G "Visual Studio 10 Win64" ^
..\openexr
So here's the command I type:
cmake -DZLIB_ROOT=C:\Users\erik\Documents\zlib-1.2.8 -DILMBASE_PACKAGE_PREFIX=C:\Users\erik\Documents\ilmbase-2.2.0\bin -DCMAKE_INSTALL_PREFIX=C:\Users\erik\Documents\ilmbase-2.2.0\bin -G "Visual Studio 10 Win64" ^..\openexr-2.2.0
And here's the error I get:
Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.8")
First problem is, the instructions don't say anything about ZLIB_LIBRARY. Second is, the zlib download looks like it's all source code. No .lib or .dll files are involved.
You have downloaded only the source code. You need to compile it first. Or download the pre-compiled DLL: "zlib compiled DLL" from the zlib homepage.
ZLIB_LIBRARY will be derived from ZLIB_DIR, so this part is correct.

Unable to build for Windows on Linux, with MinGW

Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.

Qt installation error

i got an error when am trying to configure Qt.
Erro :
execute: File or path is not found (nmake)
execute: File or path is not found (nmake)
Cleaning qmake failed, return code -1
// installion files.
InterBase...............no
Sources are in..............E:\xampp\Qt\4.6
Build is done in............E:\xampp\Qt\4.6
Install prefix..............E:\xampp\Qt\4.6
Headers installed to........E:\xampp\Qt\4.6\include
Libraries installed to......E:\xampp\Qt\4.6\lib
Plugins installed to........E:\xampp\Qt\4.6\plugins
Binaries installed to.......E:\xampp\Qt\4.6\bin
Docs installed to...........E:\xampp\Qt\4.6\doc
Data installed to...........E:\xampp\Qt\4.6
Translations installed to...E:\xampp\Qt\4.6\translations
Examples installed to.......E:\xampp\Qt\4.6\examples
Demos installed to..........E:\xampp\Qt\4.6\demos
Creating qmake...
execute: File or path is not found (nmake)
execute: File or path is not found (nmake)
Cleaning qmake failed, return code -1
E:\xampp\Qt\4.6>
If you are trying to build Qt with a Visual Studio enviroment, you have to make sure that nmake and cl are in the PATH.
The easiest way to do that is to simply use the Visual Studio Command Prompt (found e.g. in the start menu).
You need to change your path so that it leads to wherever nmake is.
Try adding the flag "-make nmake" to your configure command.