Windows Build Instructions

From Stellarium

This document explains how to compile the development version of Stellarium on WinXP.

Contents

Building with MinGW32

This process was tested on Windows XP Professional SP2. Building in Windows with MinGW has been made considerably easier after Build 2675 now that curl, SDL and Stlport are no longer required. The only problems are locating the various libraries. This is done by exporting all the necessary paths or placing them permanently in the windows environment by editing the “system” in the windows control panel. Reports of success and failure with this and other set-ups should be made in the discussion page for this article.

The build has also been achieved on a Windows Vista Home basic platform. However the installation of QT, MinGW and MSYS was not smooth and needed to be repeated twice. The first attempt at compiling gave the problem of not being able to compile the test program with Gcc. I tried all the previous solutions but could not get past the "cmake -G "MSYS Makefiles" ../..". I copied the cmakecache.txt from my XP compile (edited it to reflect the changed folders) and the full clean compile from the SVN source worked perfectly. Why I could not make a good cmakecache.txt from MSYS I don't know. Some further work is required.

Installation of development tools & libraries

Install the following packages in the following order:

  • Trolltech's QT OpenSource (current version 4.4.0) from their site http://trolltech.com/products/qt . Note: QT Version 4.4.0 is needed after build 3142. During the install process you will be asked if you want to download and install Mingw32, say YES.
  • MSYS version 1.0.10 (http://sourceforge.net/project/downloading.php?groupname=mingw&filename=MSYS-1.0.10.exe&use_mirror=switch). Install to the root directory and answer yes to the first two questions and set the path to the location of MinGW. Normally [root directory]/MinGW
  • CMake-2.4.7-win32-86.exe from http://www.cmake.org.html/download.html
  • Freetype-2.3.5-setup.exe (from the GnuWin32 set of packages)
  • Gettext-0.14.4.exe (from the GnuWin32 set of packages). Ensure that these two programs are installed into /Program Files/GnuWin32
  • TortoiseSVN-1.4.5.10425-win32-svn-1.4.5.msi into Windows. (if you want to build the latest development version)
  • libcurl 7.16.4. This was installed by downloading the source into the MSYS environment, /home/YOURUSERNAME/libcurl.(not needed after build 2675)
  • STLport 5.1 (needed for 0.9.0 release, but not for development version - dependency has been dropped)
  • Bloodshed devcpp-4.9.9.2_setup.exe from the Bloodshed web site.


Bloodshed Dev-C++ has it's own package downloader and installer. You should use this to install the following from http://sourceforge.net/project/showfiles.php?group_id=94270 within the Dev-C++ environment in the following order:

  • binutils 2.15.91-20040904-1 (already installed)
  • zlib 1.2.3 (zlib-1.2.3-1cm.devpak)
  • libjpeg 6b-4 (libjpeg-6b_4-1spec.DevPak)
  • libpng 1.2.8 (libpng-1.2.8-1spec.DevPak)
  • libtiff 3.6.1-2 (libtiff-3.9.1_2-1spec.DevPak)
  • OpenSSL 0.9.8 (openssl-0.9.8e-1cm.devpak)
  • boost 1.33.1 (boost_1_33_1.tar.bz2) (from www.boost.org)
  • freetype 2.1.10-1 (freetype-2.1.10-1spl.devpak)
  • libiconv 1.9.1 (libiconv-1.9.1-1spec.devpak)
  • libintl 0.14.5 (libintl-0.14.5-spec.devpak)
  • SDL 1.2.8 (SDL-1.2.8-2spec.devpak)
  • SDL_image 1.2.4 (SDL_image-1.2.4.DevPak)
  • SDL_mixer 1.2.6 (SDL_mixer-devel-1.2.6-2mol.devpak)
  • SDL_ttf 2.0.7 (SDL_ttf-2.0.7-1mol.DevPak)

Configuring the MSYS environment

You need to set some environment variables in the MSYS environment. Start MSYS and enter the following commands. If you installed packages listed above in non-standard locations (or with different versions which are expressed in the path to the files), you'll need to modify this command appropriately:

export PATH="$PATH:/c/Qt/4.4.0:/c/Program Files/GnuWin32/bin"
export QTDIR="c:/Qt/4.4.0"
export CMAKE_INCLUDE_PATH="/c/Dev-Cpp/include:/c/Program Files/GnuWin32/include/freetype2:/home/YOURUSERNAME/libcurl/include:/home/YOURUSERNAME/STLport"
export CMAKE_LIBRARY_PATH="/c/Dev-Cpp/lib:/c/Program Files/GnuWin32/lib:/home/YOURUSERNAME/libcurl/lib:/home/YOURUSERNAME/STLport/lib"

After Build 2697 you can remove the references to curl and STl

export PATH="$PATH:/c/Qt/4.4.0:/c/Program Files/GnuWin32/bin"
export QTDIR="c:/Qt/4.4.0"
export CMAKE_INCLUDE_PATH="/c/Dev-Cpp/include:/c/Program Files/GnuWin32/include/freetype2"
export CMAKE_LIBRARY_PATH="/c/Dev-Cpp/lib:/c/Program Files/GnuWin32/lib"

These commands can also be added permanently to the Windows Environment. Control panel – System – advanced – environment variables. Note: use the syntax as shown below in note 2.

These commands can be saved into the .profile file in your /home/[yourusername] directory within MSYS, and will then be executed for every MSYS session you start.

Getting the source code

Release versions

You can download the source code for the release versions from the sourceforge download area. Save the file to the /home/YOURUSERNAME directory within MSYS (typically this is C:\msys\1.0\home\YOURUSERNAME\ within the Windows filesystem). The file name should be stellarium-0.9.1.tar.gz or similar.

De-compress the tar file like this:

tar zxvf stellarium-0.9.1.tar.gz

The root of the source tree will be /home/YOURUSERNAME/stellarium-0.9.1

Development versions from the subversion repository

You can try the latest development code by downloading from the subversion repositry using the TortoiseSVN client. This program integrates with the Windows file browser. See the TortoiseSVN website for details. Check out the source by giving this URL to TortoiseSVN: https://stellarium.svn.sourceforge.net/svnroot/stellarium/trunk/stellarium

Check out to the /home/YOURUSERNAME directory within MSYS (typically this is C:\msys\1.0\home\YOURUSERNAME\ within the Windows filesystem).

The root of the source tree will be /home/YOURUSERNAME/stellarium

Building

  1. Open an MSYS console, and change directory into the root of the source tree, e.g.
cd stellarium-0.9.1
  1. make a build directory and change into it:
mkdir -p builds/msys && cd builds/msys
  1. run CMake:
cmake -G "MSYS Makefiles" ../..

See the notes below for solutions to some common errors

  1. run make:
make && echo "BUILD WORKED" || echo "BUILD FAILED"

There will be quite a few warnings. These can usually be ignored. You will see a message, "BUILD WORKED" or "BUILD FAILED" telling you if it was successful.

Doing a test run

If the build was successful, you can run the program without installing it, just to test everything is OK. First you need to find all the DLLs which Stellarium uses, and copy them to the root of the source tree:

  • From the QT installation area: QtCore4.dll, QtGui4.dll, QtScript4.dll, QtNetwork4.dll and QtOpenGL4.dll
  • From the GnuWin32 installation area: freetype6.dll
  • From the Dev-Cpp bin sub-directory: iconv.dll intl.dll jpeg62.dll libeay32.dll libpng13.dll libssl32.dll mingwm10.dll zlib1.dll SDL_mixer.dll SDL.dll
  • From the MSYS /home/YOURUSERNAME/libcurl/lib directory: libcurl-4.dll (not needed after build 2675)
  • From the MSYS /home/YOURUSERNAME/STLport/lib directory: libstlport.5.1.dll (not needed for ver. 0.9.1)

If you're still in the build directory, change back to the root of the source tree:

cd ../..

Then call the program with this command:

builds/msys/src/stellarium.exe

If all is well, Stellarium should launch.

Making the installer

We use the Inno Setup Compiler to create the installer. These details are for builds source later than 2675

From www.jrsoftware.org download isetup-5.2.2.exe, run it to install . Make a folder /yourname/share. Locate the stellarium source files and copy the data, landscape, nebula, scripts, skycultures, stars and textures folders into it. Make a folder /yourname/locale. Locate the po folder in the stelarium source files and copy the files into it.

Locate the stellarium.iss file and edit it to reflect these additions and changes: Add Source: "QtNetwork4.dll"; DestDir: "{app}"; Source: "QtScript4.dll"; DestDir: "{app}";

Remove Source: "libCurl.dll"; DestDir: "{app}";

there might be more new DLLs which were not present when the stellarium.iss file was last modified). Source: "C:\msys\1.0\home\YOURNAME\stellarium\builds\msys\src\stellarium.exe"; DestDir: "{app}" To reflect the location of your compiled stellarium.exe file (use your path) Source: "C:\msys\1.0\home\YOURNAME\stellarium\builds\msys\src\libstelmain.dll"; DestDir: "{app}" To reflect the location of the compiled libstelmain.dll file (use your path)

Source: "C:\msys\1.0\home\YOURNAME\locale\po\*"; DestDir: "{app}\locale\"; Flags: recursesubdirs To reflect the location of the stellarium locality po source folders (use your path) Source: "C:\msys\1.0\home\YOURNAME\share\*"; DestDir: "{app}\"; Flags: recursesubdirs

To reflect the location of the sellarium share folders, data, landscapes, nebula, scripts, skycultures, stars and textures (Use your path)

When you get the stellarium.iss file to your liking, save a copy of it somwhere where it won’t get overwritten by later versions and can be called easily from the Inno Setup Compiler.

Then execute the setup compiler.

A new Stellarium installer should be built and placed in the output folder of the stellarium source folder :)

NOTES:

Note 1: If the Qt4 install hangs while installing MinGW kill it and check the Dev-Cpp\bin folder to see that make.exe is there. If it is not the Cmake will stop with an error saying that g++ is broken. This error will also occur if Msys has not been installed correctly with the right answers to the install questions..

Note 2: The environment variables can also be entered permanently. Open Control Panel and click on System. Next click on Advanced then Environment variables. Extend the entry for path with ";C:\Qt\4.4.0;C:\Program Files\GnuWin32\bin"

Make a new variable name QTDIR and place "C:/Qt/4.4.0" in it.

Make a new variable name CMAKE_INCLUDE_PATH and place "/c/Dev-Cpp/include:/c/Program Files/GnuWin32/include/freetype2" in it.

Make a new variable name CMAKE_LIBRARY_PATH and place "/c/Dev-Cpp/lib:/c/Program Files/GnuWin32/lib" in it. Press OK..

Note 3: If the error appears that the boost files are not found with an explanation to edit the cmakecache.txt file to reflect the location of the boost_1_33_1 files edit the line. Boost_INCLUDE_DIR:PATH= [the location of the boost_1_33_1 folder] eg. C:/Dev-Cpp/boost_1_33_1

Note 4: If the error appears that the SDLMIXER_INCLUDE_DIR variable path is not found. It can also be added to the CmakeCache.txt. Locate the entry in the file and add the necessary path. eg C:/Dev-Cpp/include/SDL.

Note 5: If zlib can't be found. Check the Dev-Cpp\lib and include folders to ensure libz.a, libz.dll.a, zconf.h and zlib.h have been installed. If not zlib may need to be compiled and the include, lib files placed into the Dev-Cpp include, lib folders.

Note 6: If you needed to upgrade to Qt/4.4.0 delete the old builds/msys folder and start with a new one before starting the compile.

Building with Microsoft Visual Studio 8.0

NOTE: these instructions are quite out of date.

After couple of weeks work I finally got the stellarium compiled and run using MS VisualStudio 8.0. MS C/C++ compiler is quite strict with the declarations of the variables and there is some differences with the functions that MS has/has not, but finally I got it work. A huge patch is posted to Fabien, waiting it to be approved ...

Use SVN to get the source code

Yes. Just use svn to get the source ...

External Libraries

Download the libraries and the development files (include the needed header-files), install packages and go on ...

Getting the source code : use 'SVN

Visual Studio settings

before compiling

Adding paths

Adding paths for include files and libary files To add newly added libraries to default search path for compilation and debugging : start Visual Studio and go to Tools->Options Add external Directories to "Microsoft Visual Studio" from Tools->Options, select "Project and Solutions" anf from there "VC++ Directories".

Select "Include files" from "Show directories for:" and add directories :

C:\Zlib\include
C:\SDL\include
C:\freetype\include
C:\libjpeg\include
C:\libpng\include
C:\Boost\include
C:\GnuWin32\include

Next add Library locations of libraries, Select "Library Files" from "Show directories for:" and add directories:

C:\Zlib\lib
C:\SDL\lib
C:\freetype\lib
C:\libjpeg\lib
C:\libpng\lib
C:\Boost\lib
C:\GnuWin32\lib

Create Solution

1) To create solution for stellarium

* Select "New...->Project" from "File"-menu
* From "Visual C++" type select general and from there select "Empty Project"
* Enter name form project "Stellarium"
* Enter name for Solution "Stellarium"
* If You want to change the location of project just do it ;}
* Click "OK"

Now there should be a solution called "stellarium" and under it project called "stellarium". Next step is to set the project properties

2) Project Properties

Select "Project->Properties"
* Select "All Configurations" from "Configuration:", browse and set 
  in "Configuration Properties" and set 
 General : 
  Output Directory as C:\Stellarium
  Configuration Type as Appllication (.exe)
 C/C++
  General
   Additional Include Directories:
    ...\stellarium\src\planetsephems;
    ...\stellarium\src\stelutils;
    ...\stellarium\src\msdirent;
    ..\stellarium\src;
   Preprocessor
    Preprocessor Definitions:
     _USE_MATH_DEFINES;
     _CRT_SECURE_NO_DEPRECATE;
     _ATL_SECURE_NO_DEPRECATE;
     main=SDL_main;
     POSIX;
     WIN32;
     WIN32_LEAN_AND_MEAN
 Linker
  Input
   Additipnal Dependices
    msvcrt.lib 
    Ws2_32.lib 
    freetype221.lib 
    libpng13.lib 
    SDL.lib 
    libjpeg.lib 
    libintl.lib 
    SDLmain.lib 
    zdll.lib 
    Opengl32.lib 
    Glu32.lib 
   Ignore Specific Libraries as LIBCMT.lib
  System
   SubSystem as Console (/SUBSYSTEM:CONSOLE)
* Select "Release" from "Configuration:", browse and set 
  in "Configuration Properties" and set 
 C/C++
  General
   Optimization as Optimization: Maximize Speed (/O2)
* Select "Debug" from "Configuration:", browse and set 
  in "Configuration Properties" and set 
 C/C++
  General			
   Debug Information Format as Program Database for Edit & Continue (/ZI)
   Optimization
    Optimization as Disabled (/Od)
   Preprocessor
     _USE_MATH_DEFINES;
     _CRT_SECURE_NO_DEPRECATE;
     _ATL_SECURE_NO_DEPRECATE;
     main=SDL_main;
     POSIX;
     WIN32;
     WIN32_LEAN_AND_MEAN
     DEBUG
   Output Files
    Program Database File Name as $(TargetDir)\vc80.pdb
  Linker
   Input
    Ignore Specific Libraries as LIBCMT.lib
   Debugging
    Generate Debug Info as Yes(/DEBUG)

2) Add files to "stellarium" project Add existing files to project:

"Header Files"  : Add existing files, select all header files from ...\Stellarium\src
"Source Files"  : Add existing files, select all header files from ...\Stellarium\src

Now we have solution and project for stellarium, next thing is to add projects for "iniparser", "msdirent", "plantetsephms" and "stelutils". The creation of these projects is similar to "stellarium" project except the :

"Project type"s areStatic Library (.lib) 

and the

"C/C++->Preprocessor->Preprocessor Defines"s are 
_CRT_SECURE_NO_DEPRECATE;_USE_MATH_DEFINES 

also the "stelutils"-project should have

"Additional Include Directories" as 
...\stellarium\src\stelutils\iniparser
...\stellarium\src\planetsephems;
...\stellarium\src\stelutils;
...\stellarium\src\msdirent;
...\stellarium\src

Create dependencies

To create dependencies right-click on "Stellarium" solution and select "Properties" 1) check that the "Single startup project" in "Common Properties->Startup Project" is checkd and the project selected is "Stellarium". 2) on "Project Dependencies" Stellarium is depended all other projects and other projects are independed

Build

Yes, that's all folks! Just try to build the solution first on "Debug"-mode

Run

Before actually run the application You must copy the libraries *.dll's into the target directory of build e.g. C:\Stellarium or have the *.dll's in Your path (I prefere the first: copy the dll's)

Also the directory structure of config/data/texture and so on must be present in the target directory e.g. C:\Stellarium

That's all !

Now! Just have fun and don't hesitate to contact me if You have problems and/or suggestions

Lippo (lippo dot huhtala at saunalahti dot fi)