NMAKE static link errors - qt

I am trying to build the static version of Qt and i am currently running into an issue with NMAKE (I think).
Part of the build process here states that I should run the following command:
configure -debug -nomake examples -nomake tests -skip qtwebengine -opensource
when i run the command i get the following error
LINK : fatal error LNK1104: cannot open file 'libucrt.lib'
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\link.EXE"' : return code '0x450'
Stop.
Previous to this i had an error about missing corecrt.h so i added the following to the make file to sort that error out.
set CL=/I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt"
I know that the files i need are located at:
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt
But i am unsure on how to let link.exe know about them.
Thanks in advance

So it turns out i was having problems with the prefix being incorrectly set so going back to the first command it was modified to the following:
configure -debug -nomake examples -nomake tests -skip qtwebengine -opensource -static -prefix C:\QT\qt-everywhere-src-5.10.1 -redo -recheck-all
Where the argument after -prefix is the build location (in my case this is the same as the source directory)
Thanks for your help

Related

How to build Qmake for Visual studio project? specifically for QGLViewer for octomap library

I need to build an octomap on visual studio 2017. According to website they have asked to do the following
open a windows shell (e.g., from the START-Menu -> QT)
cd octovis/src/extern/QGLViewer
qmake -t vclib QGLViewer.pro -spec win32-msvc2010 (ignore any warnings)
So I did the same but in windows command prompt terminal and when I feed the above commands it throws the following error:
#qmake -t vclib QGLViewer.pro -spec win32-msvc2010
Could not find qmake spec 'win32-msvc2010'.
Error processing project file: QGLViewer.pro
#qmake -t vclib QGLViewer.pro -spec win32-msvc2017
Could not find qmake spec 'win32-msvc2017'.
Error processing project file: QGLViewer.pro
What should I do in order to configure and generate a QGLViewer.vcxproj?
Additional details:
Project location : "C:\software\octomap-1.9.0\octomap-1.9.0\octovis\src\extern\QGLViewer"
qmake location : C:\vcpkg\packages\qt5-base_x64-windows\tools\qt5
Visual studio : 2017 ( Version 15.9.8)
Any help in regards to this would be much appreciated as I have a very limited understanding on qmake.
You can build QGLViewer with Qt Creator instead, and then it just works - I was bashing my head against the same issue as you for a while, but then just tried that and it solved my problems. For what it's worth, I used Qt Creator 4.12.4 and did a build all.
I had a few other issues building Octovis on Windows that you might run up against as well. See here for the changes I had to make: https://github.com/OctoMap/octomap/compare/devel...sgolodetz:winchanges

compile qt 5.12.4 with open ssl static fail

I am trying to compile qt with open ssl statically
I could compile openssl using vs2017 after install perl and configuring it
i used nmake and it worked with -no-shared smoothly.
Then i open the openssl folder and have the following
dll->x64->release>
bin
->c_rehash.pl
->libcrypto-1_1-x64.dll
->libcrypto-1_1-x64.pdb
->libssl-1_1-x64.dll
->libssl-1_1-x64.pdb
->openssl.exe
->openssl.pdb
include
openssl
header files
lib ->libcrypto.lib
->libssl.lib
->ossl_static.pdb
- engines-1_1 -> capi.dll
capi.pdb
padlock.dll
padlock.pdb
Then i opened VS command line
and opened Qt 5.12.4 coder
configure -static -openssl-linked -opengl dynamic -nomake tests -nomake examples -I "T:\openssl\dll\x64\release\include" -L "T:\openssl\dll\x64\release\lib" OPENSSL_LIBS="-lUser32 -lAdvapi32 -lGdi32 -lCrypt32"
I get the following:
error feature 'openssl-linked' was enabled but the pre-condition !features.securetransport && libs.openssl' failed

Qt 5.10.0 static build error

I'm trying to build Qt 5.10.0 statically from source on Windows.
I've run Visual Studio 2017 Command Prompt and executed the following command:
>configure -static -release -platform win32-msvc
But I've got an error:
cl -c -Fo./ -Fdqmake.pdb -W2 -nologo -O1 /MP /wd4577 -IC:\qtbase-5.10\qtbase-5.10\qmake -IC:\qtbase-5.10\qtbase-5.10\qmake\library -IC:\qtbase-5.10\qtbase-5.10\qmake\generators -IC:\qtbase-5.10\qtbase-5.10\qmake\generators\unix -IC:\qtbase-5.10\qtbase-5.10\qmake\generators\win32 -IC:\qtbase-5.10\qtbase-5.10\qmake\generators\mac -IC:\qtbase-5.10\qtbase-5.10/include -IC:\qtbase-5.10\qtbase-5.10/include\QtCore -IC:\qtbase-5.10\qtbase-5.10/include\QtCore\5.10.1 -IC:\qtbase-5.10\qtbase-5.10/include\QtCore\5.10.1\QtCore -I..\src\corelib\global -IC:\qtbase-5.10\qtbase-5.10\mkspecs\win32-msvc -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -DQT_VERSION_STR=\"5.10.1\" -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=10 -DQT_VERSION_PATCH=1 -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DPROEVALUATOR_FULL -DQT_NO_FOREACH -DUNICODE -c -Yc -Fpqmake_pch.pch -TP C:\qtbase-5.10\qtbase-5.10\qmake\qmake_pch.h
qmake_pch.h
..\src\corelib\global\qglobal.h(63): fatal error C1083: cannot open include file: QtCore/qconfig-bootstrapped.h: No such file or directory
NMAKE : fatal error U1077: "d:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\cl.EXE" : return code "0x2"
Stop.
What can I do with this?
You should run configure from Visual Studio Developer Command Prompt.
You can also open regular command prompt and run following commands before configure
CALL "<path inside to your Visual Studio installation>\vcvarsall.bat" x86
SET PATH=<path to Qt sources>\qtbase\bin;%PATH%
SET PATH=<path to Qt sources>\gnuwin32\bin;%PATH%
Use amd64 instead of x86 for 64 bit Qt build as vcvarsall parameter.
Make sure you have perl and python in your path.

Build Qt (static linking) for Visual Studio 2017 32bits

On my Windows 7 SP1 machine I would like to use Qt in Visual Studio and compile Qt projects with Visual Studip with static linking,to be able to share my projects in a single .exe file.
Since there are no precompiled libraries for Visual Studio 2017 32bits (although they exists for x64),i'm going to compile Qt from sources.
Following Qt's documentation,I started by installing Python 2.7.13 and Active-Perl,and adding their installation path to the PATH variable,along with the gnuwin32/bin folder
Then i created a qt5vars.cmd file under C:\Qt,here's his content :
REM Set up \Microsoft Visual Studio 2017, where <arch> is \c amd64, \c x86, etc.
CALL "C:\Program Files\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
SET _ROOT=C:\Qt\5.9.1
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
REM Uncomment the below line when using a git checkout of the source repository
#REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET _ROOT=
And finally I unzipped Qt sources (downloaded from here to C:\Qt\5.9.1,and jom under C:\Qt\jom
I'm planning to use these commands (after executing qt5vars.cmd) to compile and install Qt :
configure -debug-and-release -opensource -platform win32-msvc2017 -static -nomake examples -nomake tests -prefix C:\Qt-5.9.1
jom -j 2
jom install
I already installed Qt vs tools in VS2017.
Is the procedure correct,or should I change something ? (particularly in the configure command)
Looks good. My only remarks would be:
To remove gnuwin32 path as I don't see a reason why would you need it.
And consider making a shadow build to keep Qt sources unpolluted.
set _SHADOW_DIR="C:\build_static"
set _SOURCE_DIR="C:\SrcQt5.9.1"
...
cd %_SHADOW_DIR%
call %_SOURCE_DIR%\configure ...
Run: "x86 Native Tools Command Prompt for VS 2017"
Or from console
%comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
Go to your Qt source dir "qt-everywhere-src-5.14.0/"
Run
configure -static -debug-and-release -prefix "f:\Qt\Static\build\5.14\build" -platform win32-msvc -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -qt-sqlite -sql-odbc -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -skip qtwebengine
After some hours run
nmake
Wait some hours again and run
nmake install
A lot of post about qtwebengine,ssl i simply disable this.
Hope this post help you save your expensive time.

qt nmake error c2440

I begin to learn qt one month ago. I want to compile a static library for qt.
I follow the following instructions:
1: download the latest qt source code
2: configure -static -platform win32-msvc2013 -nomake tests -nomake tools -no-sql-sqlite
3: nmake
step1 and step 2 work well. After more than one hour running nmake, I come to some error as below.
I have search the www for answers, even though many people have questions similar to mime, none solve my problem. Hope someone can help me.
Qt 5.7.0; Qt Creator 4.1.0; win7 64; vs2013
mimetypemodel.cpp
.\mimetypemodel.cpp(74) : error C2440: '<function-style-cast>' : cannot convert from 'initializer-list' to 'QStringList'.
NMAKE: fatal error U1077: ""D:\program Files(x86)\Microsoft Visual Studio 12.0\VC\BIN\nmake.exe"" : return code "0x2"
Stop

Resources