Sarg is developed on Linux and designed to run on Unix like systems. But people sometime want to run it on Windows.
This page describes how to build it on Windows with MinGW.
I have found that what works one year doesn't necessarily work next year as MinGW constantly changes without regard for backward compatibility. I haven't successfully build sarg on MinGW since sarg version 2.4.0-pre1. Any help is welcome.
Get MinGW installer mingw-get-setup.exe from http://sourceforge.net/projects/mingw/files/Installer/.
Run it and follow the install procedure until the MinGW Installation Manager shows up.
Check the following packages for installation:
Don't forget mingw32-libz
or you'll get errors saying that libz1.dll
cannot be found when running the compiler.
Open the Installation
menu and select Apply changes
.
Sarg can be build with CMake. It can be downloaded from http://www.cmake.org.
Sarg can take advantage of libraries installed on your system to provide some features. Here is a list of what libraries must be installed on your system to use the listed feature:
I haven't managed to install all those libraries on my test Windows. Therefore, if the wiki page is missing, it means I can't provide direction about how to install the libraries on Windows.
You can either get the latest stable sources or get the development sources from our git repository. The two following sections describe those two methods. You only need to use one.
Get sarg sources from http://sourceforge.net/projects/sarg/files/sarg/
Uncompress the tar.gz file in a directory of your choice.
It will create a directory named, for instance, sarg-2.3.5 where the sources are located.
You need a Windows port of git
. For instance, download msysgit here: http://msysgit.github.com/ and install it.
Open msysgit bash and get sarg:
cd /c/path/where/you/want/to/build/sarg git clone git://git.code.sf.net/p/sarg/code sarg
The directory to change to is the directory where you want to build sarg. The above git
command will write the sources in a subdirectory named sarg
, adding a new level to the directory tree you typed in the cd
command.
Open a dos prompt and change directory to the directory where you installed the source code. Then move to a new directory where you will build sarg. Yes, it is recommended to build sarg in a separate directory because you'll find it convenient to delete the whole build directory to start from scratch if the build procedure fails or if you simply want to rebuild sarg with other configuration options (such as adding libgd).
cd c:\path\where\you\want\to\build\sarg mkdir build cd build
Update the path to make it points only to the tools needed to build sarg. Excluding all the tools that usually clutter the path on most Windows systems saves a lot of trouble figuring out why some command fails.
path c:\mingw\bin;c:\progra~2\cmake\bin;c:\windows;c:\windows\system32
Run CMake from the dos prompt where you typed the above commands:
cmake -G"MinGW Makefiles" ..\sarg -DCMAKE_INSTALL_PREFIX=c:\sarg
The above command assumes the source code is installed in a directory named sarg
at the same level as the build directory. That's what you should have obtained if you followed the procedure so far.
Once CMake completes, start the build sequence proper:
mingw32-make
And, finally, install sarg:
mingw32-make install
Everything you need should be installed in c:\sarg
.
This procedure is broken. It doesn't work with MinGW as available on March 2015.
Open a msys shell and prepare the compilation steps with these commands:
cd sarg autoreconf -fi
The above commands work because msys shell default current directory is your home directory and you cloned sarg sources into the directory named "sarg". If you have cloned sarg sources in another directory, cd to that directory instead.
Open a msys shell and type:
cd sarg ./configure --prefix=c:/sarg make make install
If the sources are not in a directory named "sarg" in your msys home directory, cd to that directory instead. For instance, if you uncompressed sarg-2.3.5.tar.gz as explained above, you'll have to enter that command instead:
cd sarg-2.3.5
Configure c:/sarg/etc/sarg.conf
to your liking.
In particular, change the following options:
Sarg depends on an external sort command compatible with the Unix sort command. The sort command provided with Windows isn't compatible with sarg. To install the right sort command, open the MinGW Installation Manager and install the mingw32-mingw-utils
package. It will pull many dependencies including the sort command sarg needs.
Once the installation completes, copy the following files from C:\MinGW\msys\1.0\bin
to c:\sarg\bin
:
Run sarg in a bat file containing this:
PATH=c:\mingw\bin;c:\mingw\msys\1.0\bin;C:\windows\system32;C:\windows; c:\sarg\bin\sarg.exe
You have to run the script once a day to generate the reports. On unix like systems, sarg is ran by cron. On Windows, it should run as a scheduled task. Have a look at the page describing how to [Run with cron and anacron] to get some ideas of what must be done.
Discussion: Sarg IN-CACHE-OUT always zero or minus zero?!
Support Requests: #34
Wiki: Build gd on Windows
Wiki: Run with cron and anacron
Wiki: Table of content