Windows Installation Guide with MinGW
This page has not changed since 2014. It might be out of date. Please consider Windows Install with MSYS2 instead.
HINT: In this tutorial, we use a base directory for all the tools we install: c:\ow_workspace
. We also use several version numbers for dependent libraries in the text below. You will need to change them accordingly.
Preparing your Build Environment
In this section, we prepare your build environment by installing the needed compilation tools. The steps in this section only need to be done once. Now, what is needed to compile OpenWalnut? We use the MinGW GNU compiler collection in an MSYS environment.
- Download and execute the latest
mingw-get-setup.exe
version from SourceForge.- Choose
c:\ow_workspace\MinGW
as installation path (If the folders does not exist, you have to create them.). Leave the other options untouched and click the Continue-button. - Press the continue Button again after the MinGW-Setup is finished. Now you can select the components to be installed. Install the following packages by navigating through the folder structure on the left side:
- mingw32-gcc (GNU C Compiler)
- mingw32-gcc-g++ (GNU C++ Compiler)
- msys-base (Basic MSYS Installation)
- To apply the changes: Select "Installation/Apply Changes" from the menubar and then click the Apply-Button.
- Choose
Thats it. But we are not yet done. Several libraries and OpenWalnut itself uses CMake as Makefile generation tool. We need to install this tool and tell MSYS where to find it.
- Download CMake and install it with the following options:
- The CMake installer asks you whether to add the CMake path to your PATH variable. You will not need it. But it will not be a problem if you choose to add it.
- Choose
c:\ow_workspace\CMake
as installation path.
- Add the CMake executable to your PATH inside the MSYS environment.
- Open the file
c:\ow_workspace\MinGW\msys\1.0\etc\profile
in a text editor - Add the line
export PATH="/c/ow_workspace/CMake/bin:$PATH"
- Open the file
- Add the line "c:\ow_workspace\MinGW /mingw" to the file
c:\ow_workspace\MinGW\msys\1.0\etc\fstab
- Most probably the
fstab
file does not exist. When you create it, make sure it has no extension like ".txt". - There should be a new line at the end of the file.
- Most probably the
- Create a link on your desktop (or startmenu) to the file
C:\ow_workspace\MinGW\msys\1.0\msys.bat
and name it "MinGW Shell".
If everything went well, you will be able to open a MinGW Shell and start cmake, g++, gcc and others directly. Ensure that this works properly now. If not, try uninstalling everything and re-run the procedure and double-check that you do all the steps properly.
Preparing Dependencies
We can now start setting up the libraries on which OpenWalnut depends. Be warned: this is a quite time-consuming step but needs to be done only once. For simplicity, we begin with everything which does not need manual compilation:
-
Download and install the Qt SDK
- Choose
c:\ow_workspace\QtSDK
as installation directory - Select Custom as installation type
- Select the components you want. We definitely need:
Development Tools->Desktop-Qt->Qt 4.8.0->Desktop Qt Development Libraries for MinGW
- Everything else is optional and NOT needed for OpenWalnut.
- Tell our Build environment where to find Qt in
c:\ow_workspace\MinGW\msys\1.0\etc\profile
- Add the line
export QTDIR="/c/ow_workspace/QtSDK/Desktop/Qt/4.8.0/mingw"
- Add the path to the DLL files to your PATH environment variable by adding
export PATH="$QTDIR/bin:$PATH"
- Add the line
- Choose
-
Download and install libz version 1.2.3 for mingw32 (
libz-1.2.3-1-mingw32-dev.tar.gz
andlibz-1.2.3-1-mingw32-dll-1.tar.gz
)- These files are listed under
MinGW/Extension/zlib
- Extract to
c:\Program Files (x86)\zlib
- NOTE: unfortunately, the CMake search scripts for zlib do not allow a environment variable pointing to the zlib location. So we are forced to install the files to the location CMake is aware of.
- Add the path to the DLL files to your PATH environment variable by adding
export PATH="/c/Program Files (x86)/zlib/bin:$PATH"
- These files are listed under
-
Download and extract Eigen3
- Extract to
c:\ow_workpsace
- Please rename the created folder with a weird name like
eigen-eigen-ffa8ffb5570
or something similar toeigen3
.
- Please rename the created folder with a weird name like
- Tell our Build environment where to find it in
c:\ow_workspace\MinGW\msys\1.0\etc\profile
- Add the line
export EIGEN3_INCLUDE_DIR="/c/ow_workspace/eigen3"
- Add the line
- Extract to
Thats it. To summarize: we had to download Qt, ZLib, and Eigen3 and install them. We have added the corresponding paths to your profile
. This, later on, allows CMake to find these libraries. Now, lets continue with boost and OpenSceneGraph.
-
Download and build the newest OpenSceneGraph.
- Extract the files to
c:\ow_workspace
- Open a MinGW Shell.
- Type
cd /c/ow_workspace/OpenSceneGraph-3.0.1
- Use CMake to generate the Makefile
- Type
cmake-gui .
- IMPORTANT: do not use a separate build directory. Build in-source or cmake will later not find the headers properly.
- Press the
Configure
button - Select
MSYS Makefile
as makefile generator- Ignore the missing PNG lib warning
- Set the value of
CMAKE_BUILD_TYPE
to "Release" - Press the
Configure
button again - Press the
Generate
button - Exit
- Type
- As you now have a Makefile, compile OpenSceneGraph:
- Type
make
-
HINT: if you have a multi core machine, you can tell
make
to use N jobs in parallel by usingmake -jN
- Type
- Tell our build environment where to find it in
c:\ow_workspace\MinGW\msys\1.0\etc\profile
- Add the line
export OSG_ROOT="/c/ow_workpsace/OpenSceneGraph-3.0.1"
- Add the path to the DLL files to your PATH environment variable by adding
export PATH="$OSG_ROOT/bin:$PATH"
- Add the line
- Extract the files to
-
Download and build Boost, version 1.40.0 or higher
- Extract to
c:\ow_workspace
- Change to this directory in you MinGW Shell:
cd /c/ow_workspace/boost_1_48_0
- Type
./bootstrap.sh --with-toolset=mingw
to initially generate the boost build system - Delete project-config.jam
- Build and boost via
./bjam --prefix=/c/ow_workspace/boost_build --layout=system toolset=gcc link=shared variant=release threading=multi install
- Move the libraries to the correct place:
mv /c/ow_workspace/boost_build/lib/libboost*.dll /c/ow_workspace/boost_build/bin
- Tell our build environment where to find it in
c:\ow_workspace\MinGW\msys\1.0\etc\profile
- Add the line
export BOOST_ROOT="/c/ow_workspace/boost_build"
- Add the path to the DLL files to your PATH environment variable by adding
export PATH="$BOOST_ROOT/lib:$PATH"
- Add the line
- Extract to
Congratulations. If everything went well, you are now able to build OpenWalnut! You think it is too complicated? You probably should have a look at Linux. There, it is only a matter of a handful of keystrokes and you have OpenWalnut up and running.
Build OpenWalnut
First, we need to get the source code! You can download a corresponding source archive or get the latest source via Mercurial. Check Getting_OpenWalnut for all the links. On Windows, TortoiseHG allows you to check out our up-to-date code from our repository. In this tutorial, we assume you have downloaded the code somehow.
- Get OpenWalnut code
- Put/Extract it into
c:\ow_workspace\OpenWalnut
- Put/Extract it into
- Build OpenWalnut
- Open a MinGW Shell
- Change to the OpenWalnut Build directory with
cd /c/ow_workspace/OpenWalnut/build
- run
cmake.exe ../src
- Press
Configure
button - Select MSYS Makefile generator
- Press
Generate
Button - Exit
- Press
- run
make
- You can, again, add a number of parallel jobs via the
-jN
parameter
- You can, again, add a number of parallel jobs via the
- run OpenWalnut with
bin/openwalnut
That is it. If cmake prints an error due to missing libraries and similar, double-check that you properly followed the above steps.
Re-distribute the OpenWalnut binary
As we have added each DLL path to the $PATH environment variable, Windows' dynamic linker finds all the required DLLs properly. If you want to re-distribute a binary OpenWalnut package, you need to collect the required DLL files and OpenWalnut into one directory. This section shows how this can be done easily.
Remember: The file names and paths might change in future versions of MinGW or the third party libs. Please adapt it accordingly.
-
Copy OpenWalnut to the package directory
- In a MinGW Shell, change to your OpenWalnut build directory:
cd /c/ow_workspace/OpenWalnut-1.2.5/build
- Start CMake with
cmake-gui.exe .
(the dot is important) - In CMake, search the property
CMAKE_INSTALL_PREFIX
- Set this to
C:/ow_workspace/packaging/
- Set this to
- Configure, Generate and Exit
- Call
make install
to copy binaries and required resources to the packaging directory.
- In a MinGW Shell, change to your OpenWalnut build directory:
-
Copy the basic MinGW runtime files from C:\MinGW\bin@ to
C:/ow_workspace/packaging/bin
- libgcc_s_dw2-1.dll
- libstdc++-6.dll
- mingwm10.dll
-
Copy the zlib DLL from
/c/Program Files (x86)/zlib
to/c/ow_workspace/packaging/bin
-
Copy the following Qt DLLs from
/c/ow_workspace/QtSDK/Desktop/Qt/4.8.0/mingw
to/c/ow_workspace/packaging/bin
- QtCore4.dll
- QtGui4.dll
- QtOpenGL4.dll
- QtWebKit4.dll
- QtNetwork4.dll
-
Copy all OSG DLLs from
/c/ow_workspace/OpenSceneGraph-3.0.1/bin
toC:/ow_workspace/packaging/bin
- Use
cp /c/ow_workspace/OpenSceneGraph-3.0.1/bin/*.dll /c/ow_workspace/packaging/bin
- Also copy OSG Plugins, use
cp -r /c/ow_workspace/OpenSceneGraph-3.0.1/bin/osgPlugins-3.0.1 /c/ow_workspace/packaging/bin
- Use
-
Copy all Boost DLLs from
/c/ow_workspace/boost_build/lib
toC:/ow_workspace/packaging/bin
- Use
cp /c/ow_workspace/boost_build/lib/*.dll /c/ow_workspace/packaging/bin
- Use
NOTE: Although OpenWalnut itself does not need all boost and OSG libraries directly, some modules might! So we copy all the DLLs to ensure everything works directly.
Thats it. You can now compress this into an archive and redistribute it on multiple Windows PCs without the need of a running MinGW installation.