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

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.

Related

rust: link.exe not found

I installed the rust compiler and also MSVC v142 - VS 2019 C++ x64/x86 build tools (v14.27) (as an individual component)
This does not seam to be working.
Does rust require anything more which I have not installed? Thank you in advance.
Install the Windows SDK too.
I also didn't want to install all of Visual Studio just to compile rust from the command line.
Based on the info in coder-256's link, I tried running C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat. Then, instead of being unable to find link.exe, I got the error:
note: LINK : fatal error LNK1181: cannot open input file 'advapi32.lib'
Searching Stack for that error led to this answer: Install the Windows SDK
So I installed the Windows 10 SDK, and now (after launching a new cmd window) it works.
Using Win11, here's the specific steps that worked for me (assumes VSCode and Rust are already installed):
Go to the Visual Studio Download site
Download Build Tools for Visual Studio 2019 (version 16.9)
Install
Create a "hello world" Rust project (cargo new hello)
Open project in VSCode
Set path info in launch.json file (located at folder root, may need to create this first)
Type Shift+Ctrl+B to build the Rust project

Qt 5.8 msvc 2015 compile error

I have installed Qt using an offline installer qt-opensource-windows-x86-msvc2015_64-5.8.0. I have visual studio community edition 2017 installed with c++ build tools. because it's compiler was incompatible with the qt version, then I installed visual c++ build tools 2015 from http://landinghub.visualstudio.com/visual-cpp-build-tools . When I try to compile a project it gives an error :-1: error: LNK1158: cannot run 'rc.exe'. Heres how my qt kit looks like,
Can someone figure out whats the mistake and how to fix it.
Thanks.
I've fixed this both on my own machine and on several co-workers machines.
It tends to happen when you have both Visual Studio 2015 and VS 2017 installed. Or more precisely, multiple versions of the Windows SDK installed. When that happens, the vcvars32.bat script (located in your Visual Studio install dir) does not correctly add the location of the resource compiler (rc.exe) to your PATH. Thus, QT Creator runs vcvars32.bat (as specified in Qt Creator under Option->Build&Run->Compilers, but the tools directory for the Windows SDK Kit isn't properly added to the PATH environment.
The simple fix is to add the appropriate version of RC.exe to your path.
Do this from the command line:
cd "c:\program files(x86)"
dir /s rc.exe
You'll get several versions (x86 and x64) and for several versions of the SDK. Add the PATH for where rc.exe lives for the version that corresponds to the SDK and build flavor to your vcvars32.bat startup script.
For example:
PATH="C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86";%PATH%
Restart Qt Creator and that should fix it.
Another fix that worked for me is to uninstall all versions of Visual Studio (and all those side installs of SQL, Windows SDKs, dev tools, etc...). Reboot. Then cleanly install VS 2017 again. Then cleanly uninstall and re-install all of Qt again. That seemed to work for me. A wonderful way to spend an afternoon.
If you update to Qt 5.9 it supports MSVC 2017. However, if you want to get it working with 5.8, I believe you might be missing the Windows SDK. You can download the SDK from Microsoft for Windows 7, 8 or 10, just get whichever version is appropriate for you.
With some googling I found a couple of other somewhat related solutions here, & here, and I've summed them up below:
If you've already got the SDK or installed it and it still doesn't work, it appears that copying rc.exe and rcdll.dll from the WindowsSDK folder to your MSVS installs \VC\bin folder may fix the problem. You might also try copying those same two files to Qt's \Qt*version number**compiler version*\bin.

Qt 5.3 configuration error for VisualStudio 2010

I am relatively new to the Qt. At the moment I'm trying to configure Qt library for my machine before installing add-in for VisualStudio'10. I tried to download Qt library only (withouth a Qt creator IDE), and found "qt-everywhere-opensource-src-5.3.2.zip" and extracted it to my external drive: "F:\Programs\Qt\5.3.2". Then I run command "configure" on VisualStudio command prompt.
F:\Programs\VStudio'10\VC>cd F:\Programs\Qt\5.3.2
F:\Programs\Qt\5.3.2>configure
After a while it gave me following error:
Running configuration tests...
NMAKE : fatal error U1077: 'F:\Programs\VStudio'10\VC\BIN\link.EXE' : return cod
e '0x463'
Stop.
Could not find output file: No such file or directory
WARNING: The DirectX SDK could not be detected:
There is no Direct X SDK installed or the environment variable "DXSDK_DIR" is
not set.
Disabling the ANGLE backend.
WARNING: Using OpenGL ES 2.0 without ANGLE.
Specify -opengl desktop to use Open GL.
The build will most likely fail.
On the installation instruction that was found on Qt webpage, it was said to set environmental variables: "Add this 2 paths to the Environment Variables: “C:\Qt\2009.01\bin” and
“C:\Qt\2009.01\qt\bin”." But I was unable to find any "bin" directory in my qt-everywhere folder. Instead I set up following variable to my path: "F:\Programs\Qt\5.3.2\Qtbase\bin". Still no help.
How can I resolve these issues? Any ideas and help are highly appreciated.
What you've done is more like attempting to prepare building Qt itself from the source code (but that is not exactly how to do that, anyway). You don't need that at least now but when you start customize Qt framework, say, for static build. That is when configure tool comes handy. And you will need to read on that.
You need just to download its installer from: http://qt-project.org/downloads
I assume you don't have prebuilt Qt and Qt Creator in your system but that is prerequisite for what you want to do. Take either Community version or start download immediately. After you've installed certain Qt version for your platform including Qt Creator (which is native Qt IDE) you will also be able to install and use Visual Studio AddIn. And then take Visual Studio AddIn for Qt 5 from: http://download.qt-project.org/official_releases/vsaddin/qt-vs-addin-1.2.3-opensource.exe and install it. Read the instruction on how to use it. There will be some new menu for importing Qt project, though.
BTW, Qt Creator itself is not bad at all and maybe preferable for most of Qt development tasks except some debugging. I maintain entire project in Qt Creator and write the code there and only occasionally go to Visual Studio with AddIn installed to import Qt project there for some better debug experience.
you can try run "configure -opengl"
or , you can download Microsoft DirectX SDK and install it ,then try again.
http://www.microsoft.com/en-us/download/details.aspx?id=6812

Boost library error in Windows 7 64-bit

I have correctly compiled Boost for Windows 8 with VS-10 as given in this link. My project works fine. But when I copy the project to another Windows 7 machine it returns an error message as "The application was unable to start correctly (0xc000007b). Click OK to close this application.". I have correctly installed Boost in the second PC as well. Both PCs are 64-bit and I installed 32-bit Boost in both. As I found from some links this is because the project try dynamically linking 64-bit libraries instead 32-bit. Could you kindly advice how to build this as a portable solution. Thanks in advance.
Update 1:
Following is the dependency walker output.
Are you sure you selected the Visual Studio 2010 Command Prompt x86 to compile the library? or the x64 version? there is more than 1 version of the command prompt in the start menu. my guess would be that you accidentally ran the x64 version, and then compiled boost with it, resulting in a x64 bit version of the library compiled.
Here's a batch file that compiles the static and shared version of boost in x86:
compileboost.bat:
call "%vs110comntools%..\..\VC\vcvarsall.bat" x86
cd C:/boostsourcefolder/
call bootstrap.bat
.\b2 runtime-link=static
.\b2 runtime-link=shared
Then in your VS2010 project properties, Common Properties -> VC++ Directories -> Include Directories, type your boost folder (C:/boostsourcefolder/). and in Common Properties -> VC++ Directories -> Library Directories, type the boost compiled library folder (C:/boostsourcefolder/stage/lib/).
That's pretty much all you need to do.

Compile CUDA without Visual Studio - "Cannot find compiler cl.exe in path"

I've just begun a small project in CUDA.
I need to know the following:
Is it possible to compile CUDA code without using/buying Microsoft Visual Studio?
Using Nvcc.exe I get the error "Cannot find compiler cl.exe in path".
I've tried to install a CUDA plugin for NetBeans, but it doesn't work. (with current version of NetBeans)
Platform: Windows 7
Thanks in advance.
Update
As noted in the comments, versions of the SDK after Windows 7's do not include the build tools. If you want to use Microsoft's most recent tools you have to install Visual Studio. Once installed, you can use the tools from the command-line.
At the moment the free versions are the "Community" versions, e.g. Microsoft Visual Studio Community 2015.
You can continue to develop apps for Windows 7 and earlier (and they will run on later versions of Windows) using the old SDK tools as I described before:
Original Answer
If you desperately want to avoid Visual Studio, download and install the Windows SDK. This contains (more or less) the same build tools as Visual Studio.
Then run the Windows SDK Command Prompt (which you'll find on the start menu under Microsoft Windows SDK) to set the path to point to the tools, and you are set.
Or just use Visual C++ Express.
Following the previous comments I've installed Studio Express & VS2010.
This did not solve the "cl.exe not in path" problem.
I solved the problem with the error Cannot find compiler cl.exe in path, by including
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64 in PATH,
before installing Windows SDK.
This question also contains valuable information.
For some reason VS2010 & Studio Express failed to set the proper variables in path even after the execution of vsvars32.bat.
Thank you all for your valuable help.
add this options to nvcc
nvcc x.cu <other options> -ccbin "D:\Program Files\Microsoft Visual Studio 11.0\VC\bin"
i use VS2012 and my cl.exe dir is here.
You have to figure out where NVIDIA GPU Computing Toolkit is installed.
In my system it's in "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe" Then
"Edit Environment Variables" on Windows.
Click on New...
Variable name: NVCC
Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin\nvcc.exe
Click on OK.
Use windows subsystem for linux and install ubuntu and nvcc along with gcc and g++ using the ubuntu terminal in windows (gui does not works for linux subsystem for windows). Then configure .bashrc using bash and vim/nano with a 'cd' command to your desired location as it is done in usual linux terminal (makes it easy as bash opens in system32 folder everytime). And then you can compile .cu files using nvcc over bash. As nvcc supports gcc and g++ under linux so it solves the problem. No need to sacrifice peace for switching over to linux or dealing with crappy visual studio. It worked for me.

Resources