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.
Related
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
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
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
I'm new to Qt Creator and wanted to import an existing CMake project into it. I loaded the CMakeLists.txt file as a project, and after running CMake, it found my files like I hoped.
But when it builds, it seems to end prematurely after one second. Here is the log:
17:11:46: Running steps for project My-GUI...
17:11:46: Starting: "C:\Program Files\JetBrains\CLion 2017.1.3\bin\cmake\bin\cmake.exe" --build . --target clean
17:11:46: Starting: "C:\Program Files\JetBrains\CLion 2017.1.3\bin\cmake\bin\cmake.exe" --build . --target spectrumSaver
"C:\Program Files\JetBrains\CLion 2017.1.3\bin\cmake\bin\cmake.exe" -HC:\Users\user\WorkingFiles\Excellims\My-GUI -BC:\Users\user\WorkingFiles\Excellims\build-My-GUI-Desktop_Qt_5_9_0_MSVC2015_64bit-Default --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f CMakeFiles\Makefile2 /nologo -L spectrumSaver
"C:\Program Files\JetBrains\CLion 2017.1.3\bin\cmake\bin\cmake.exe" -HC:\Users\user\WorkingFiles\Excellims\My-GUI -BC:\Users\user\WorkingFiles\Excellims\build-My-GUI-Desktop_Qt_5_9_0_MSVC2015_64bit-Default --check-build-system CMakeFiles\Makefile.cmake 0
"C:\Program Files\JetBrains\CLion 2017.1.3\bin\cmake\bin\cmake.exe" -E cmake_progress_start C:\Users\user\WorkingFiles\Excellims\build-My-GUI-Desktop_Qt_5_9_0_MSVC2015_64bit-Default\CMakeFiles 7
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f CMakeFiles\Makefile2 /nologo -L CMakeFiles\spectrumSaver.dir\all
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f shared\CMakeFiles\shared.dir\build.make /nologo -L shared\CMakeFiles\shared.dir\depend
"C:\Program Files\JetBrains\CLion 2017.1.3\bin\cmake\bin\cmake.exe" -E cmake_depends "NMake Makefiles" C:\Users\user\WorkingFiles\Excellims\My-GUI C:\Users\user\WorkingFiles\My-GUI\src\shared C:\Users\user\WorkingFiles\My-GUI\build-My-GUI-Desktop_Qt_5_9_0_MSVC2015_64bit-Default C:\Users\user\WorkingFiles\My-GUI\build-My-GUI-Desktop_Qt_5_9_0_MSVC2015_64bit-Default\shared C:\Users\user\WorkingFiles\Excellims\build-My-GUI-Desktop_Qt_5_9_0_MSVC2015_64bit-Default\shared\CMakeFiles\shared.dir\DependInfo.cmake --color=
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f shared\CMakeFiles\shared.dir\build.make /nologo -L shared\CMakeFiles\shared.dir\build
[ 28%] Built target shared
"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f CMakeFiles\spectrumSaver.dir\build.make /nologo -L CMakeFiles\spectrumSaver.dir\depend
17:11:47: Elapsed time: 00:01.
You can see that CMake reports the build is 28% complete, just before ending.
I can't find any information on this and all my fiddling has yet to fix it. I'm using CMake 3.7.2 (that comes with CLion), but I have also used CMake 3.8.2 (independently installed). This is on Windows 7, with Qt Creator 4.3.0 using the Microsoft Visual C++ 2015 compiler.
It's not clear what was causing it to stop building prematurely, but after I restarted Qt Creator, the problem went away. It now builds completely.
I have been trying to build Qt 5.6.0 for use with Visual Studio 2015 Community, but the documentation on their website and on the Qt wiki is not very specific when it comes to building it for Visual Studio. I have also tried other tutorials for building it but to no success.
Tutorials I have tried following:
https://wiki.qt.io/Building_Qt_5_from_Git
https://doc.qt.io/qt-5/windows-building.html
These are the steps that I take when attempting to build it:
Cloned the source code from the git repo to D:\Programs\qt5.
Checked out the branch I wanted. In this case it was 5.6.0.
Cloned only the essentials module subset to reduce build time.
Created a batch script to set the environment variables for the cmd session and placed it in D:\Programs\qt5:
REM Set up \Microsoft Visual Studio 2015, where <arch> is \c amd64, \c x86, etc.
CALL "D:\Programs\Visual Studio 2015 Community\VC\vcvarsall.bat" amd64
SET _ROOT=D:\Programs\qt5
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;%PATH%
REM Uncomment the below line when using a git checkout of the source repository
SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET QMAKESPEC=win32-msvc2015
SET _ROOT=
REM When compiling with ICU, uncomment the lines below and change <icupath> appropriately:
REM SET INCLUDE=<icupath>\include;%INCLUDE%
REM SET LIB=<icupath>\lib;%LIB%
REM SET PATH=<icupath>\lib;%PATH%
*Tried removing the SET QMAKESPEC line and it did not affect the resulting errors.
Open the Developer Command Prompt for VS2015 and navigate to D:\Programs\qt5.
Run the script in number 4.
Enter the commands to configure the Qt5 build.
configure -developer-build -opensource -confirm-license -nomake tests -nomake examples -mp -skip qtwebengine -skip qtwebchannel
*Is there a way to use the configure command to only build the essentials module subset?
Enter the command to build Qt.
nmake
I get this error when I try to build it:
D:\Programs\qt5>nmake
Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd qtbase\ && ( if not exist Makefile D:\Programs\qt5\qtbase\bin\qmake D:\Programs\qt5\qtbase\qtbase.pro -o Makefile ) && nmake -f Makefile
Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd src\ && ( if not exist Makefile D:\Programs\qt5\qtbase\bin\qmake D:\Programs\qt5\qtbase\src\src.pro -o Makefile ) && nmake -f Makefile
Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
cd corelib\ && ( if not exist Makefile.qtzlib D:\Programs\qt5\qtbase\bin\qmake D:\Programs\qt5\qtbase\src\corelib\qtzlib.pro -o Makefile.qtzlib ) && nmake -f Makefile.qtzlib
Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
nmake -f Makefile.qtzlib.Debug all
Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
copy /y ..\..\lib\Qt5Zlibd.dll ..\..\bin
The system cannot find the file specified.
nmake -f Makefile.qtzlib.Release all
Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
copy /y ..\..\lib\Qt5Zlib.dll ..\..\bin
The system cannot find the file specified.
cd tools\bootstrap\ && ( if not exist Makefile D:\Programs\qt5\qtbase\bin\qmake D:\Programs\qt5\qtbase\src\tools\bootstrap\bootstrap.pro -o Makefile ) && nmake -f Makefile
Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
nmake -f Makefile.Debug
Microsoft (R) Program Maintenance Utility Version 14.00.23506.0
Copyright (C) Microsoft Corporation. All rights reserved.
cl -c -nologo -Zc:wchar_t -FS -Zi -MDd -D_HAS_EXCEPTIONS=0 -MP -GR -W3 -w34100 -w34189 -w44996 -WX /Fd..\..\..\lib\Qt5Bootstrapd.pdb -DUNICODE -DWIN32 -DWIN64 -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_SYSTEMLOCALE -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQT_NO_TRANSLATION -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 -DQT_NO_CAST_FROM_ASCII -DQT_BUILD_BOOTSTRAP_LIB -DQT_BUILDING_QT -D_CRT_SECURE_NO_WARNINGS -D_USE_MATH_DEFINES -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x040800 -DQT_NO_EXCEPTIONS -I. -I..\..\3rdparty\zlib -I..\..\..\include -I..\..\..\include\QtCore -I..\..\..\include\QtCore\5.6.1 -I..\..\..\include\QtCore\5.6.1\QtCore -I..\..\..\include\QtXml -I..\..\..\include\QtXml\5.6.1 -I..\..\..\include\QtXml\5.6.1\QtXml -Itmp -I..\..\..\mkspecs\win32-msvc2013 -Fo.obj\debug\ #C:\Users\Justin\AppData\Local\Temp\nm3B49.tmp
qlatincodec.cpp
qtextcodec.cpp
qutfcodec.cpp
d:\programs\qt5\qtbase\include\qtcore\../../src/corelib/global/qflags.h(52): error C2220: warning treated as error - no 'object' file generated (compiling source file ..\..\corelib\codecs\qlatincodec.cpp)
d:\programs\qt5\qtbase\include\qtcore\../../src/corelib/global/qflags.h(52): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc (compiling source file ..\..\corelib\codecs\qlatincodec.cpp)
d:\programs\qt5\qtbase\include\qtcore\../../src/corelib/global/qflags.h(52): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings (compiling source file ..\..\corelib\codecs\qlatincodec.cpp)
d:\programs\qt5\qtbase\include\qtcore\../../src/corelib/global/qflags.h(52): error C2220: warning treated as error - no 'object' file generated (compiling source file ..\..\corelib\codecs\qutfcodec.cpp)
d:\programs\qt5\qtbase\include\qtcore\../../src/corelib/global/qflags.h(52): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc (compiling source file ..\..\corelib\codecs\qutfcodec.cpp)
d:\programs\qt5\qtbase\include\qtcore\../../src/corelib/global/qflags.h(52): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings (compiling source file ..\..\corelib\codecs\qutfcodec.cpp)
d:\programs\qt5\qtbase\include\qtcore\../../src/corelib/global/qflags.h(52): error C2220: warning treated as error - no 'object' file generated (compiling source file ..\..\corelib\codecs\qtextcodec.cpp)
d:\programs\qt5\qtbase\include\qtcore\../../src/corelib/global/qflags.h(52): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc (compiling source file ..\..\corelib\codecs\qtextcodec.cpp)
d:\programs\qt5\qtbase\include\qtcore\../../src/corelib/global/qflags.h(52): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings (compiling source file ..\..\corelib\codecs\qtextcodec.cpp)
NMAKE : fatal error U1077: '"D:\Programs\Visual Studio 2015 Community\VC\BIN\amd64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"D:\Programs\Visual Studio 2015 Community\VC\BIN\amd64\nmake.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
I have tried searching this error to find a fix, but so far I haven't been able to get much information about it at all.
Any help on the subject would be greatly appreciated, thanks.
This is a manual fix, not a solution per se, but if you look at the error message you see this:
cd tools\bootstrap\ && ( if not exist Makefile...
nmake -f Makefile.Debug....
Go to that folder and open the file MakeFile.Debug. There you will find an entry called CXXFLAGS. Append "/EHsc" to the end and save the file.
Then simply run nmake again.
The error is slightly confusing. The first one
error C2220: warning treated as error - no 'object' file generated
is a following error from the problem that Qt is having. Visual Studio 2015 has some new redisigns that causes the actual problem:
warning C4577: 'noexcept' used with no exception handling mode specified
The local solution is also mentioned:
Specify /EHsc
So that is what my fix does. It simply tells the compiler to ignore some exceptions or handle them differently. In this case the problem probably emerges from a C function that throws an exception, but the C++ wrapper does not handle it.
For more info please read /EH documentation.
I compiled without problem (including openssl and mysql). I figured some points out:
Perl-bin has to be in front of Git.
Use Python 2.7 (Current 3.x will crash Angle).
Use perl init-repository with -f (otherwise you might have inconsistent versions)
Use correct x86 / x64 3rd party libraries. (Compiling in x64 command prompt you have to use x64 libs).
Branch 5.7 seems to be buggy (compile problems with qt3d). Branch dev (from August, 29 2016) seems to be our friend.