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
Finally I managed to compile a 32-bit version of boost_1.77,0 which works for my project !!!!
How did I make it? Somewhere else on the internet (https://sourceforge.net/projects/mingw-w64/files/ ) I found this file: https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z . It contains mingw32 v8.1. But in contrast to all other “mingw32” versions I have found so far, when compiling boost with this version it builds only “for x86”. And the resulting boost files contain both static and shared libraries. These files also include the missing “shared” files I was looking for, so that I now have the needed dynamic 32-bit libraries. For those of you who may need this too: Find my compiled boost_1.77.0_32 libraries here: https://sourceforge.net/projects/hamlib-sdk/files/Windows/JTSDK-3.2-x86-Patches/boost_1.77.0_32.zip/download.