Boost is easy when you are using headers or pre-compiled binaries for visual studio, but it can be a pain to compile from source on windows, especially when you want the 64-bit version of MinGW to use gcc/g++. This installation process should be thorough enough to simply copy and paste commands, but robust enough to install everything you need.
Note: if you need to install any of the libraries that need dependencies, see this great answer from stack overflow
Get the MinGW installer mingw-w64-install.exe from Sourceforge
Get the boost_1_68_0.zip source from Sourceforge
Note: This should work perfectly with other versions of boost as well
Copy these to a new folder
C:\install
It should now contain the following two files
mingw-w64-install.exe
boost_1_68_0.zip
Run mingw-w64-install.exe
Click next
Change the Architecture from i868
to x86_64
Click next and keep the default install location
Click next to start the install
Click Finish to exit the installer
Open a command prompt AS ADMIN
- windows key -> type "cmd"
- right click "command prompt"
- Run as administrator
Enter the following command to create a link to MinGW folder in C:\
mklink /J C:\MinGW "C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64"
Add this to the session and system PATH environment variable
set PATH=%PATH%;C:\MinGW\bin
setx /M PATH "%PATH%"
Check to ensure proper install
g++ --version
should return the following info
cd C:\install
powershell -command "Expand-Archive C:\install\boost_1_68_0.zip C:\install"
This takes about 15 minutes
cd C:\install\boost_1_68_0
mkdir C:\boost-build
mkdir C:\install\boost_1_68_0\boost-build
mkdir C:\boost
cd C:\install\boost_1_68_0\tools\build
prepare b2
bootstrap.bat gcc
Build boost.build with b2
b2 --prefix="C:\boost-build" install
Add C:\boost-build\bin to your session PATH variable
set PATH=%PATH%;C:\boost-build\bin
navigate back up to the boost unzipped root directory
cd C:\install\boost_1_68_0
Build boost with b2
b2 --build-dir="C:\install\boost_1_68_0\build" --build-type=complete --prefix="C:\boost" toolset=gcc install
This is going to take awhile, so try to run this command right before beginning the director's cut of Lord of the Ring Return of the King.
When this is done you should see the following output
You can now delete "C:\install" and "C:\boost-build"
Everything should now be installed
Include folder:
C:\boost\include\boost-1_68
Linker folder:
C:\boost\lib
Link required libraries:
e.g. libboost_atomic-mgw81-mt-d-x64-1_68.a
Hi, installing boost on Windows works great following this tutorial, however, I have problems with missing "shared.cmake" files for the 32-bit part (I need it for boost log setup). My project needs dynamically linked libraries, so in CMakeLists.txt ”Boost_USE_STATIC_LIBS" must be set to OFF). All works well when compiling for x64, but trying to compile a 32-bit build fails with the following error messages:
I found out that at \boost[VERSION]\lib\cmake, 2 files are missing: libboost_log_setup-variant-mgw8-mt-d-x32-1_77-shared.cmake and libboost_log_setup-variant-mgw8-mt-x32-1_77-shared.cmake. The x64 version of these files are there, but NOT the x32 files, meaning that there is no support for shared libraries for 32-bit. No matter which boost version you use, it is always the same. (I have tested 1.74.0 and 1.77.0).
On the internet I found such files for boost built with other mgw versions, and tried to adopt them. They are leading to a file "libboost_atomic-mgw8-mt-d-x32-1_77.a", which is there, however, which obviously does NOT support shared libraries, too. No way to bring it to work.
My question: Does anybody know how I can add 32-bit support for the needed dynamically linked boost libraries? Was anyone successfully with it? If yes, can you provide me with the missing files, please? I would need such files for mgw8.
Thanks