Not able to build qt5 in release - visual-studio-2010

I'm buiding QT 5 with Visual Studio 2010 because i need to have debug symbols.
I use the following commands:
configure -debug-and-release -force-debug-info -platform win32-msvc2010 -opensource -mp
nmake
But it seems that QT was built only in debug mode, because i can see only *d.dll files in qtbase/bin and qtbase/lib folders.
When i try to build sample qt project, it goes ok in debug.
But in release i get the following error:
1>LINK : fatal error LNK1181: cannot open input file 'qtmain.lib'
This file is indeed absent in my QT folder.
I also tried "-release" instead of "-debug-and-release" and it also created debug libraries instead of release.

I build Qt5.0.2 with configure -developer-build -opensource -nomake examples -nomake tests
In detail:
Install strawbey perl (http://strawberryperl.com/)
Install Windows SDK http://msdn.microsoft.com/en-us/windows/desktop/aa904949 even when you are using Windows 7. On older versions of Microsoft Windows the DirectX SDK should be installed.
Download Qt 5.0.2 source code from http://qt-project.org/downloads
Start “Open VS2012 x64 Native Tools Command Prompt“
Make sure that python is available on the command prompt. When installing Python you can add python.exe to the environment path. (I used python 3.3)
Switch to Qt 5.0.2 source directory (directory which contains configure.bat)
Run configure -developer-build -opensource -nomake examples -nomake tests
and afterwards
nmake

Here (How To Compile Qt with Visual Studio) is a guide for building Qt on VS2010. In the comments to that article, there are instructions for building Qt 5, here.

Related

Unable to compile llvm pass on Windows using Visual studio

Im learning how to use the llvm toolchain on Windows.
I compiled and installed llvm using the following cmake command
cmake -S llvm -B build -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_USE_LINKER=lld -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_INSTALL_PREFIX="C:\llvm" -Thost=x64
Running the INSTALL project in the solution created in the build folder installed llvm in c:\llvm.
To test my llvm installation i created a new Visual Studio project and placed a Directory.build.props file in the project root with the following contents:
<Project>
<PropertyGroup>
<LLVMInstallDir>C:\llvm</LLVMInstallDir>
<LLVMToolsVersion>14.0.0</LLVMToolsVersion>
</PropertyGroup>
</Project>
I set the project toolchain to LLVM (clang-cl) in project settings and successfully compiled a hello world program.
Now i wanna use llvm for it's intended use and play around with some passes. So i downloaded https://github.com/tsarpaul/llvm-string-obfuscator.
Running cmake -Bbuild -DLLVM_DIR=C:\llvm\lib\cmake\llvm\ generated a Visual Studio solution in .\build.
So far so good i tought. This is similar to the steps required to compile llvm itself.
But running the BUILD_ALL project in the generated solution gave me 105 linker errors.
I have pasted the entire error output here: https://pastebin.com/TAizbAEi.
I have a feeling the required libraries in C:\llvm\lib are not visible to Visual Studio. But i have no idea how to proceed. Could anyone point me in the right direction on how to use llvm with visual studio correctly?
Solved by adding to the cmake file:
llvm_map_components_to_libnames(llvm_libs core)
target_link_libraries(LLVMStringObfuscator ${llvm_libs})
Now the dll build.
I still have problems using opt.exe
PS C:\Users\Administrator\source\repos> C:\llvm\bin\opt.exe -load-pass-plugin=.\11philip22\llvm-string-obfuscator\build\StringObfuscator\Release\LLVMStringObfuscator.dll -passes="string-obfuscator-pass"
C:\llvm\bin\opt.exe: .\11philip22\llvm-string-obfuscator\build\StringObfuscator\Release\LLVMStringObfuscator.dll:1:1: error: expected top-level entity
MZÉ    ╕ # ║ ┤ ═!╕L═!This program cannot be run in DOS mode.
But that's a new problem for another thread :)

How to compile Qt webengine (5.11) on Windows with proprietary codecs

I have a lot of trouble compiling Qt webengine to enable proprietary codecs, documentation is not very clear. I followed others instructions on stackoverflow but it doesn't work. I got error like:
Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?
OR
Needs VS 2015 Update 3 with Cumulative Servicing Release or higher
Qt WebEngine will not be built.
OR
Could not detect Windows SDK Version ('WindowsSDKVersion' environment variable is not set).
Qt Webengine on Windows requires a Windows SDK version 10.0.10586 or newer.
QtWebEngine will not be built.
OR
Needs Visual Studio 2017 or Higher
Qt WebEngine will not be built.
OR
C1905: Front end and back end not compatible (must target same processor).
LNK1257: code generation failed
I had all of those problems for the last 5 days.
I'm doing a step by step instruction if you don't know how to begin with compiling Qt webengine (with or without proprietary codecs).
If you have already done some of the steps, you can freely skip them.
Please if you see any error, if have one by doing this or if some instruction is not clear, tell me so I can update
1. Install Visual Studio 2017
Go to https://www.visualstudio.com/fr/downloads/ and download Visual Studio 2017.
When this window comes, check Desktop Development for C++ and be sure that VC++ toolset 2015.3v v14.00 (v140) and SDK Windows 10 (10.0.xxxxx.x) are checked.
Install and wait until it finishes.
2. Install Qt sources qt webengine
Open MaintenanceTool.exe present into the Qt folder
Add or delete module
Be sure to check at least: MSVC 2015 32-bit, MSVC 2015 64-bit, MSVC 2017 64-bit, Sources, Qt WebEngine
Install and wait until it finishes.
3. Install Qt webengine compile prerequisities
(Original instructions copied from Sébastien Bémelmans on this thread and a bit modified)
Download:
Python 2 (2.7.15 actually, Python 3 is not supported) from https://www.python.org/downloads/windows/
Perl (Strawberry vesion) from http://strawberryperl.com/
Bison and flex from https://sourceforge.net/projects/winflexbison/ (Rename win-bison.exe to bison.exe and win-flex.exe to flex.exe)
Gperf from http://gnuwin32.sourceforge.net/packages/gperf.htm
Be sure to add every .exe to System path, and restart the computer.
4. Compile Qt webengine with proprietary-codecs (or without)
Open cmd.exe (with administrator rights).
type cd + Path to the Microsoft Visual Studio folder where vcvarsall.bat is located:
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"
For compilation into 32-bits:
Type vcvars32.bat into command line
For compilation into 64-bits:
Type vcvars64.bat into command line
Go to the path where Sources of Qt are and enter qtwebengine subdirectory:
cd "C:\Qt\5.11.0\Src\qtwebengine"
For compilation into 32-bits:
Type "C:\Qt\5.11.0\msvc2015\bin\qmake.exe" -- -webengine-proprietary-codecs into command line (note the link is going to msvc 2015 32 bit)
For compilation into 64-bits:
Type "C:\Qt\5.11.0\msvc2017_64\bin\qmake.exe" -- -webengine-proprietary-codecs into command line (note the link is going to msvc 2017 64 bit)
Your console should look like this (32 bit):
And the result:
Now you need to call nmake. Type "Path to nmake.exe for version 32 bit or 64 bit" like this:
For compilation into 32-bits:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx86\x86\nmake.exe" into command line (note the x86 into the path)
For compilation into 64-bits:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\nmake.exe" into command line (note the x64 into the path)
Your command line should now output a lot of things. Compiling qt
webengine requires lot of memory and space (around 90 Go on my
computer and 60% of my 8 GO of RAM). Be sure to have place and free
memory. It is long processing too
If you get a message below after running qmake:
"A suitable version of python2 could not be found."
download the configure file here.
Extract it and run "_configure.py" with python2. It will configure your qt and that error goes away.
One addition to Dardan Iljazi's answer. After successful compilation, I couldn't launch application with proprietary codecs support. I had to do the following in the same console:
nmake install
This command copies all output from previous work to the Qt installation folder. So I can use the same kit in Qt Creator to build and debug app with proprietary codecs support.
Also I was stuck once on detecting python2. Hint: to clean qmake step of build process manually remove config.* files in your qtwebengine folder.

CMake does not find Windows SDK 8.1

I am trying to download a C program called fluidsynth (https://sourceforge.net/p/fluidsynth) so that I can later install python bindings and use it in some code.
I installed CMake and Visual Studio. From the VS command line (as an administrator) I gave the command cmake c:\path\to\fluidsynth. I got a few errors:
In the command line, I got No CMAKE_C_COMPILER could be found.
In the CMake error log it says Build FAILED Then:
error MSB8036: The Windows SDK version 8.1 was not found.
Install the required version of Windows SDK or change the
SDK version in the project property pages or by right-clicking
the solution and selecting "Retarget solution".
[C:\Users\user\Desktop\fluidsynth-1.1.6\CMakeFiles\3.4.3\CompilerIdC\CompilerIdC.vcxproj]
This error persists even after upgrading my Windows SDK.
1.- Visual Basic?? CMake doesn't have native support for VB.
2.- If you are going to use CMake, you must be ensure that Win SDK is propertly registered its paths.
3.- Once is done, you only need to run, from the directory you extracted the files, the following command: cmake . if you still get errors, then something is not correctly registered nor installed. That wouldn't be cmake fault.

How to build Qt 4.8.6 with Visual Studio 2015 without official support?

At this time (September 2015) there is no official Qt build for Visual Studio 2015. How to build it manually?
It can be built manually quite easily. The example below is for Qt 4.8.6.
Download Qt 4.8.6 sources:
http://download.qt.io/archive/qt/4.8/4.8.6/qt-everywhere-opensource-src-4.8.6.zip
and unpack. Let the Qt prefix be c:\Qt-2015\4.8.6\msvc2015. Copy sources inside the downloaded source dir to {prefix dir}.
Apply the patch 02-fix_build_with_msvc2015-45e8f4ee.diff
https://drive.google.com/file/d/0Bz6Oefew6XZnOU9ac0hIeG41UVE/view?usp=sharing
see post: https://forum.qt.io/topic/56453/compiling-qt4-head-with-msvc-2015-cstdint-errors/5
to get rid of compilation errors
(I applied all changes by hand, it's not so long).
Make new win32-msvc2015 spec in mkspecs directory:
create win32-msvc2015 directory, copy the contents of win32-msvc2013 dir,
edit qmake.conf: set _MSC_VER to 1900 and update all text from 2013 to 2015 where appropriate:
Edit makefile.win32 file in {prefix dir}/qmake/ directory:
find all win32-msvc2013 occurences and add win32-msvc2015 similarly:
Now from the Visual Studio 2015 command prompt
run (these are the example commands, additional commands may be different depending on the build needs):
configure -make nmake -platform win32-msvc2015 -prefix c:\Qt-2015\4.8.6\msvc2015 -opensource -confirm-license -opengl desktop -nomake examples -nomake tests
Option -make nmake
is need because configure.exe searches max version vs 2013 of nmake by default, otherwise it uses make.
Then for single core build command
nmake
(or jom.exe -jN, where N <= number of CPU cores).
That's all. This example is without Webkit, examples and demos - for speed.
For me it takes ~1.5 hours to build on the single core.

Integrating Qt 4.7.2 with Visual Studio 2010

I am trying to add Qt 4.7.2 to my Visual Studio 2010. I downloaded the source code, changed the environment variables, ran a configure -no-webkit command (which ended successfully), and an nmake command (which also ended successfully). Afterwards, I installed the Qt Visual Studio Add-in 1.1.9. When in VS I go to Qt->Qt Options->Qt Versions and I add the current Qt Directory (4.7.2) it gives me this error:
This Qt version uses an unsupported makefile generator (used: MSBUILD, supported MSVC.NET)
What should I do? Thank you!
Also, I am running on Windows 7 x64 if that is of any help.
Edit: The problem appears only with VS Add-In 1.1.9. To solve simply install the 1.1.8 version. I found it on a Russian website. Works like a charm!
I did this yesterday, here's how:
Open up the Visual Studio Command Prompt, navigate to your Qt folder
execute "configure -platform win32-msvc2010 -debug-and-release -static -no-exceptions -no-accessibility -no-rtti -no-gif -no-libtiff -no-libjpeg -no-libmng -no-qt3support -no-openssl -no-dbus -no-phonon-backend -no-multimedia -no-audio-backend -no-script -no-scripttools -no-webkit"
(those were my options, you can of course change them)
execute nmake
add an environment variable named QTDIR with your Qt folder as value (had to do that because the add-in failed to do so)
now you can choose this folder to add a Qt version in the add-in
configure.exe -platform win32-msvc2010
will generate both a nmake makefile and a .sln file, build with either
you can also add
-no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools -no-qt3support -fast

Resources