How to compile TOL on Windows with gcc-mingw32
In this page we describe how to compile TOL for Windows with the compiler gcc-mingw32. We recommend to use the compiler provided in Rtools because we want to ensure a smooth integration with R. All the external code used in TOL has being also compiled with that compiler. Below we provide information about all the tools and libraries used and the full development environment.
Prerequisites
Prepare a root directory, for instance
mkdir c:\users\toldevel
Next install the required packages and tools as described below.
Subversion
In order to download the source code we need subversion. You can download a good subversion client for windows from TortoiseSVN
Make sure to select the option "command line client tools" as "Will be installed on hard drive" which comes unselected by default.
CMake
CMake is a family of tools designed to build, test and package software. CMake is able to generate from a set of configuration files either the Makefile for Unix or a workspace for Visual Studio o CodeLite for Windows. We can download it from CMake download.
We must add CMake to the system path either for all users or the current user.
TOL external libraries
TOL depends on a set of external libraries provided by the open source community. All this libraries has been compiled with Rtool and packaged in a bundle. This package can be downloaded from toldevel-rtools-m32. This package must be executed to extract its contents, for instance under c:\users\toldevel
. As a result the directory c:\users\toldevel\toldevel-rtools-m32
will be created.
Rtools
Rtools is a set of tools to compile R packages and R itself. We have chosen this tools to compile also TOL in order to make smoother the integration between TOL and R. You can download it from Rtools download. When installing accept all the suggested path and installation options.
Select the option to include the Rtools path in the system path.
One more step is required, we need to download mingw32-make and uncompress into C:\Rtools\gcc-4.6.3\bin\
.
CodeLite
We recommend CodeLite as a good IDE to develop TOL in windows because CMake is able to generate native workspace from the CMake configuration files. The configuration described next requires the instalation of this IDE which can be downloaded from CodeLite download. While installing it is not required to install the mingw32 compiler as we are going to use the compiler from Rtools.
We can also check if there is a more recent version available at http://downloads.codelite.org
Download source code of TOL
The source code of TOL can be downloaded with svn. For instance the main development branch (trunk) can be downloaded like:
cd c:\users\toldevel svn co https://www.tol-project.org/svn/tolp/trunk
Configuration of build process
The build process is configured with CMake. The first step is to create the build directory where the CodeLite workspace and Makefile will be generated:
mkdir c:\users\toldevel\trunk\tol\CodeLite\Debug mkdir c:\users\toldevel\trunk\tol\CodeLite\Release
Next move into the Debug directory and configure to build the debug flavor of TOL
cd c:\users\toldevel\trunk\tol\CodeLite\Debug cmake -DTOL_EXTERNAL_DEVEL_DIR=C:\users\toldevel\toldevel-rtools-m32 -DCMAKE_TOOLCHAIN_FILE=..\..\cmake\mingw-m32.toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -G"CodeLite - MinGW Makefiles" ..\..
The release flavor is configured like:
cd c:\users\toldevel\trunk\tol\CodeLite\Release cmake -DTOL_EXTERNAL_DEVEL_DIR=C:\users\toldevel\toldevel-rtools-m32 -DCMAKE_TOOLCHAIN_FILE=..\..\cmake\mingw-m32.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -G"CodeLite - MinGW Makefiles" ..\..
From this point we can run CodeLite IDE and open the workspaces generated at CodeLite\Debug
or CodeLite\Release
Alternative call
When cmake
finds sh.exe
aborts. In this case, we can reset locally the environment variable PATH
.
For successive uses (in case of errors) a clean execution (for the Debug mode) can be done as:
set Path=C:\Program Files\CMake\bin;C:\RBuildTools\3.2\gcc-4.6.3\bin;C:\Program Files\R\R-3.1.2\bin;C:\Program Files\R\R-3.1.2\bin\i386;C:\Program Files\SlikSvn\bin\ cd c:\users\toldevel\trunk\tol\CodeLite rmdir /S /Q c:\users\toldevel\trunk\tol\CodeLite\Debug mkdir c:\users\toldevel\trunk\tol\CodeLite\Debug cd c:\users\toldevel\trunk\tol\CodeLite\Debug cmake -DTOL_EXTERNAL_DEVEL_DIR=C:\users\toldevel\toldevel-rtools-m32 -DCMAKE_TOOLCHAIN_FILE=..\..\cmake\mingw-m32.toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -G"CodeLite - MinGW Makefiles" ..\..
Value of the environment variable PATH
should be verified with your own local paths.
Equivalent lines can be executed for the Release mode.
Build from command line
TOL can be compiled also from command line, use the following command to build both the Debug and Release configuration:
cd c:\users\toldevel\trunk\tol\CodeLite\Debug mingw32-make
cd c:\users\toldevel\trunk\tol\CodeLite\Release mingw32-make
Runtime install
In order to test the result of the compilation we must prepare a runtime enviroment with the needed programs and dll libraries. For that we have the following commands:
cd c:\users\toldevel\trunk\tol\CodeLite\Debug mingw32-make install
cd c:\users\toldevel\trunk\tol\CodeLite\Release mingw32-make install
This will create a directory Runtime_Base within the corresponding configuration either Debug or Release.
TOLTCL
toltcl is a TOL executable which include a Tcl interpreter. In order to build toltcl first prepare the directory to build the software:
cd c:\users\toldevel\trunk\toltcl mkdir CodeLite\Debug mkdir CodeLite\Release
The configure the makefiles for the specific configuration either Debug or Release:
cd c:\users\toldevel\trunk\toltcl\CodeLite\Debug cmake -DTOL_PREFIX_PATH=C:\users\toldevel\trunk\tol\CodeLite\Debug\Runtime_Base -DCMAKE_TOOLCHAIN_FILE=..\..\..\tol\cmake\mingw-m32.toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -G"CodeLite - MinGW Makefiles" ..\..
cd c:\users\toldevel\trunk\toltcl\CodeLite\Release cmake -DTOL_PREFIX_PATH=C:\users\toldevel\trunk\tol\CodeLite\Release\Runtime_Base -DCMAKE_TOOLCHAIN_FILE=..\..\..\tol\cmake\mingw-m32.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -G"CodeLite - MinGW Makefiles" ..\..
To build from command line just issue the command mingw32-make from any of the directories Debug or Release:
cd c:\users\toldevel\trunk\toltcl\CodeLite\Debug mingw32-make
cd c:\users\toldevel\trunk\toltcl\CodeLite\Release mingw32-make
Finally if everything was ok we must install the binaries generated to the corresponding runtime directory:
cd c:\users\toldevel\trunk\toltcl\CodeLite\Debug mingw32-make install
cd c:\users\toldevel\trunk\toltcl\CodeLite\Release mingw32-make install
This will install the toltcl package and the executable tolsh.exe
TOLBASE
In order to build tolbase first prepare the directory to build the software:
cd c:\users\toldevel\trunk\tolbase mkdir CodeLite\Debug mkdir CodeLite\Release
Then configure the makefiles for the specific configuration either Debug or Release:
cd c:\users\toldevel\trunk\tolbase\CodeLite\Debug cmake -DTOL_PREFIX_PATH=C:\users\toldevel\trunk\tol\CodeLite\Debug\Runtime_Base -DCMAKE_TOOLCHAIN_FILE=..\..\..\tol\cmake\mingw-m32.toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -G"CodeLite - MinGW Makefiles" ..\..
cd c:\users\toldevel\trunk\tolbase\CodeLite\Release cmake -DTOL_PREFIX_PATH=C:\users\toldevel\trunk\tol\CodeLite\Release\Runtime_Base -DCMAKE_TOOLCHAIN_FILE=..\..\..\tol\cmake\mingw-m32.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -G"CodeLite - MinGW Makefiles" ..\..
To build from command line just issue the command mingw32-make from any of the directories Debug or Release:
cd c:\users\toldevel\trunk\tolbase\CodeLite\Debug mingw32-make
cd c:\users\toldevel\trunk\tolbase\CodeLite\Release mingw32-make
Finally if everything was ok we must install the binaries generated to the corresponding runtime directory:
cd c:\users\toldevel\trunk\tolbase\CodeLite\Debug mingw32-make install
cd c:\users\toldevel\trunk\tolbase\CodeLite\Release mingw32-make install
This will install the tolbase at the runtime location.
TOL INSTALLER
cd c:\users\toldevel\trunk\ mkdir installer cd installer cmake -DTOL_RUNTIME_DIR=C:\users\toldevel\trunk\tol\CodeLite\Release\Runtime_Base -DCMAKE_BUILD_TYPE=Release -G"CodeLite - MinGW Makefiles" C:\users\toldevel\trunk cpack
OTAN: Binaries packages
The binaries packages most be compiled with MING32 in order to be compatible with the TOL compiled with MINGW32. The compilation of a binary package is based also in CMake and the instructions to compile is similar to all.
Here we are going to escribe the compilation of one of the binaries packages: TclCore.
In order to build the dll for the binary package first prepare the directory to build the software:
cd C:\users\toldevel\OfficialTolArchiveNetwork\TclCore mkdir CodeLite\Debug mkdir CodeLite\Release
Then configure the makefiles for the specific configuration either Debug or Release:
cd C:\users\toldevel\OfficialTolArchiveNetwork\TclCore\CodeLite\Release cmake -DTOL_PREFIX_PATH=C:\users\toldevel\trunk\tol\CodeLite\Release\Runtime_Base -DCMAKE_TOOLCHAIN_FILE=..\..\..\tol\cmake\mingw-m32.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -G"CodeLite - MinGW Makefiles" ..\..
To build from command line just issue the command mingw32-make from any of the directories Debug or Release:
cd C:\users\toldevel\OfficialTolArchiveNetwork\TclCore\CodeLite\Release mingw32-make
Attachments (3)
- svn_select_cmd_client.png (17.0 KB) - added by 10 years ago.
- cmake_set_path.png (10.3 KB) - added by 10 years ago.
- Rtools_path.png (9.1 KB) - added by 10 years ago.
Download all attachments as: .zip