Boost library error in Windows 7 64-bit - windows

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.

Related

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.

C++ Program compiled with QT does not find automatically QT dlls in Windows

I have succesfully compiled a QT program for windows. I can not directly run the program in the build directory. The Dependency Walker shows that the paths to Qt5Gui.dll Qt5Widgets.dll Qt5Core.dll are not found. I am copying the dlls to the build directory and the program runs as expected. My question is how can I avoid copying the dlls in the build directory. Is there an option that I should add to the CMakeLists.txt to help in this situation ? I am using windows 10.

Linking errors with boost, VS2010, and CMake

I have searched high and low for this answer. I have tried suggestions to similar problems posted on Stack and other sites. My toolchain consists of an x64 machine with windows 7, visual studio 2010, opencv 2.4, qt 4.8, and boost. I configure all of my projects using CMake, which finds all of these libraries and includes and creates my visual studio project. I have compiled two versions of boost, a 32-bit version build in the command line and placed in \boost\boost_1_47_0\lib\win32, and a 64-bit compiled in the Windows SDK v7.1 64-bit compiler and stored in \boost\boost_1_47_0\lib\x64. Everything in the project compiles fine with the exception of boost. I get a compiler error:
fatal error LNK1104: cannot open file 'libboost_filesystem-vc100-mt-1_47.lib'
As a reminder, CMake is handling all of my linking and it properly locates this lib and adds it to the visual studio project. I can verify this by looking at Properties->Linker->Command Line. Here, in addition to files representing other libraries, it has listed:
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_filesystem-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_program_options-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_date_time-vc100-mt-1_47.lib"
"C:\Tools\boost\boost_1_47_0\lib\x64\boost_thread-vc100-mt-1_47.lib"
I can suppress this error by manually adding my boost\boost_1_47_0\lib\x64 directory to Properties->Linker->General->Additional Library Dependencies. This compiles without error. However, when I go to run the application, I am met with a system error that tells me:
The program can't start because boost_filesystem-vc100-mt-1_47.dll is missing from your computer. Try reinstalling the program to fix this problem.
In this /x64 directory I have:
boost_filesystem-vc100-mt-1_47.dll
boost_filesystem-vc100-mt-1_47.lib
libboost_filesystem-vc-100-mt-1_47.dll
Any insight would be incredibly appreciated. Thanks!
To solve the runtime error:
Add the location of the dll(s) to the PATH environment variable.
For example on my machine:
set PATH=%PATH%;c:\users\chris\boost_regex-vc140.1.63.0.0\lib\native\address-model-32\lib
or copy the dll(s) to a directory already in the PATH
See here: https://msdn.microsoft.com/en-us/library/7d83bc18.aspx?f=255&MSPPError=-2147217396

Where is llvm-config in Windows?

I am open to either a Visual Studio answer or a MinGW answer. I just finished building LLVM 3.2 using CMake and Visual Studio 2010. Everything went smoothly, but I have no llvm-config. Do I need it? Every example I see on the intertubes makes use of that tool. If I don't need it, how do I configure my project to make use of LLVM?
To be clear, I am not trying to use LLVM tools/compilers (like clang and whatnot). I am trying to write C++ code that uses the LLVM libraries to produce LLVM IR and even compile that stuff. I setup my include and lib folders. I ran llvm-config in Linux and saw a long list of macros and libraries.
I have a wonderful folder full of goodies. It just has no llvm-config in there: C:\Program Files (x86)\LLVM\
llvm-config does not exist in windows prebuilt binaries. You need to compile from the source code to get it.
Grab CMAKE > 3.5 , install it and make sure you add it to PATH.
Download Visual Studio 2019
Donwload the source code (9.0.1 is the latest as I'm writing this)
Extract the source code
Cd into the root of the llvm source-code
In cmd, type cmake . this will generate Visual Studio 2019 sln.
open sln file(LLVM.sln), change the build type to Rlease, build the whole project
navigate to your Rlease\bin, and there you have your llvm-config.exe
If you have built the LLVM in debug version all the executables (including llvm-config) have been placed in your build directory (containing Visual Studio project and solution files) in bin/Debug/ subdirectory. In case of release build replace Debug with Release.
If you are interested in using LLVM on Windows more than building it, check out Windows snapshot builds.

VS 2010 Premium : Navigating into Windows directories in a 64-bit project

VS 2010 Premium :
I have a project which targets x86 platforms and I need to make it target x64 platforms.
I went to the Configuration Manager and from there to the Active Solution Platform, chose "new",added an 'x64' option and copied the settings from a Win32 platform (It's the only option I had).
So now the project should be targeting x64 platforms, if I'm not mistaken.
I have a code line in my project which asks for the file with this path :
Common Files\Microsoft Shared\OFFICE14\ACEDAO.dll
Yet it seems that during compilation, this file is being requested from the "Common Files" directory within the Program Files(x86) directory (the one for 32-bit). Naturally the compilation fails, since no such file exists in this path.
How can I make it to navigate to the (Program Files\Common Files ..) directory ?
The project should be targeting 64-bit after all and I require the 64-bit version of this dll.
The binary produced by the compiler and linker is indeed a 64-bit image. The compiler however is not, that's the one that reads the file so it is subject to file system redirection. The default 64-bit compiler is the one in the vc\bin\x86_amd64 directory. It is a 32-bit compiler that produces 64-bit code. You could select vc\bin\amd64 in the project's VC++ Directories setting to select the 64-bit compiler.
Something wrong with your machine setup though, I have this file present in c:\program files (x86). Windows 7 x64, Office 2010, VS2010. I have no clue why you don't have it, you could ask at superuser.com. Just copying the file is a simple workaround. Also beware that the 64-bit version of the ACE provider is not distributable.

Resources