Compile with MSYS and Qt5

From Stellarium Wiki
Jump to: navigation, search

This is the instruction for building Windows 32-bit version of Stellarium using MSYS and Qt5/MinGW.

Contents

Installation of development tools & libraries

For building Stellarium from source code you need some required tools and libraries.

Bazaar

To get the source code of Stellarium you need to install DVCS Bazaar from this url. We recommend using latest stable standalone release of Bazaar. If you want GUI clients for management of source code then you can Bazaar Explorer, QBzr and optionally TortoiseBZR.

Note: You should add path to Bazaar to PATH variable if you want use command line for getting source code of Stellarium.

Qt5

Stellarium needs Qt version 5.1.0 or better since revision 6224 for building. You can get latest version of Qt from website of Qt Project. We recommended use Qt 5.2.1, now in the archives section which you can get [1] and get windows-opensource-5.2.1-mingw48_opengl-x86-offline.exe - Qt 5.2.1 with MinGW 4.8 and OpenGL support for 32-bit Windows.

Note: for following steps we will use path C:\Qt as directory with installed Qt5 framework.

CMake

Stellarium uses CMake for configuration of the project and we recommended use CMake 2.8.11 or better.

Note: You should add path to cmake to PATH variable.

zlib

Stellarium wants zlib for manipulation of the archives, e.g. landscapes packages. Latest binary package of zlib for Windows you can get on MinGW website. We recommended use zlib 1.2.5 or better.

For zlib 1.2.8 you should download following files from MinGW website:

and put files from archives into C:\toolchain folder.

gettext[1]

Stellarium required gettext 0.18 or better for localization support. Latest binary package of gettext for Windows you can get on MinGW website. We recommended use gettext 0.18.1.1 or better.

For gettext 0.18.3.1 you should download following files from MinGW website:

and put files from archives into C:\toolchain folder.

Note: For gettext 0.18.1.1 you need use following files:

  • gettext-0.18.1.1-2-mingw32-bin.tar.lzma
  • gettext-0.18.1.1-2-mingw32-dev.tar.lzma
  • libintl-0.18.1.1-2-mingw32-dll-8.tar.lzma
  • libgettextpo-0.18.1.1-2-mingw32-dll-0.tar.lzma

libiconv[2]

Stellarium required libiconv 1.14 or better for localization support (required by gettext library). Latest binary package of libiconv for Windows you can get on MinGW website. We recommended use libiconv 1.14-2 or better.

For libiconv 1.14-3 you should download following files from MinGW website:

and put files from archives into C:\toolchain folder.

MSYS

For building Stellarium through CLI you should install MSYS. We recommended use MSYS 1.0.11 or better.

Default folder for MSYS is C:\msys\1.0.

Configuring the MSYS environment

After installing all required libraries and tools you should configure the MSYS environment.

  • Create home directory for user - for example your login are user and you should create directory C:\msys\1.0\home\user. Source code of Stellarium will be put into C:\msys\1.0\home\user\stellarium directory.
  • Add MinGW files to MSYS - you should open C:\msys\1.0\etc\fstab file in Notepad, write following string inside:
C:\Qt\Tools\mingw48_32 /mingw

and save it.

  • Add C:\toolchain to PATH variable - you should add string C:\toolchain\bin;C:\toolchain\lib;C:\toolchain\include to PATH variable[3].
  • Add C:\Qt to PATH variable - you should add string C:\Qt5\5.2.1\mingw48_32\;C:\Qt5\5.2.1\mingw48_32\bin;C:\Qt5\5.2.1\mingw48_32\lib;C:\Qt5\5.2.1\mingw48_32\include to PATH variable.

Note: After changes the PATH variable you should reboot the computer for apply those changes.

Getting 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.13.0.tar.gz or similar.

You will need a decompression program installed in Windows, for example 7-Zip.

De-compress the tar file like this:

tar zxvf stellarium-0.13.0.tar.gz

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

Development versions from the Bazaar repository

See also Bzr checkout

You can try the latest development code by downloading from the bzr repository using the TortoiseBZR client bzr shell. This program integrates with the Windows file browser. See the TortoiseBZR website for details. Check out the source by entering the folder where you have the stellarium source code and from the Windows menu bar:

The root of the source tree typically will be /MSYS/1.0/home/YOURUSERNAME/stellarium.

You will first need to get the source code.

For example you use TortoiseBZR and want get the source code of the Stellarium. Run Explorer and open directory C:\msys\1.0\home\user\, choose directory stellarium and make right click mouse. In opened window select "Bazaar create working copy/branch". Set source as "lp:stellarium", destination directory will be "C:\msys\1.0\home\user\stellarium". Press OK for getting source code.

If you want use command line for getting source code then open MSYS to see the command line and enter:

cd /c/msys/1.0/home/YOURNAME

then

bzr co lp:stellarium

This will download the trunk into .bzr (nearly 1GB at the moment), a hidden folder in the stellarium folder, so it may take some time. When this completes the trunk source code will be written into your stellarium folder.

When the source code is loaded into your stellarium folder you can add any updates from the Windows pull down menu. Note: in Windows 7 the menu will appear if you right click the mouse in a vacant area of the stellarium folder.

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

Building

  1. Open an MSYS console, and change directory into the root of the source tree, e.g.
    cd stellarium
  2. make a build directory and change into it:
    mkdir -p builds/msys && cd builds/msys
  3. run CMake[4] (you can use following configuring build options):
    cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=C:/stellarium ../..
    See the notes below for solutions to some common errors
  4. 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.
  5. run make install
    make install

This will place all the compiled files in C:\stellarium. From where they will be found when you run the installer program stellarium.iss after you install the Inno Setup Compiler.

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\5.2.1\mingw48_32\bin folder: Qt5Core.dll, Qt5Concurrent.dll, Qt5Declarative.dll, Qt5Gui.dll, Qt5Network.dll, Qt5OpenGL.dll, Qt5Widgets.dll, Qt5Sql.dll, Qt5XmlPatterns.dll, icudt51.dll, icuin51.dll, and icuuc51.dll;
  • From the \Qt\Tools\mingw48_32\bin folder: libgcc_s_dw2-1.dll, libstdc++.dll, and libwinpthread-1.dll
  • From the \toolchain\bin folder: zlib1.dll
  • From the \Qt\5.2.1\mingw48_32\plugins\platforms folder to the /platforms of the source tree: qwindows.dll
  • From the \Qt\5.2.1\mingw48_32\imports\Qt\labs\shaders folder to the /Qt/labs/shaders of the source tree: qmldir, plugins.qmltypes, and qmlshadersplugin.dll

If you need a language other than English copy the stellarium\translations folder from C:\stellarium\share (or \program files\stellarium\share if you don't set CMAKE_INSTALL_PREFIX variable) to the stellarium source tree root folder.

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.

Finally Run

make install

This will place all the necessary files in your program files folder stellarium where the installer expects to find them.

Making the installer

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

From http://www.jrsoftware.org download version 5.5.3 (unicode) or better, run it to install.

If you have followed the above procedure the current bzr build will generate the necessary stellarium.iss file. Double click on it, then from the menu bar "build-compile". It will build the stellarium installer package and place it in a folder of the stellarium source tree root folder "installers"

Run the program generated and Stellarium will be installed in program files\stellarium or wherever you select and place an icon on the desktop.

Notes

  1. This requirement is optional - you need enable gettext support only for creating a *.pot files (e.g. you are developer)
  2. This requirement is optional - you need this library only for creating a *.pot files (e.g. you are developer)
  3. See instructions for adding data to PATH here
  4. If the compile fails with the error "can't find a particular file". Check the CMakeCache.txt file in the ...\builds\msys folder and make sure the variable/path/file is directed to the correct source.
Personal tools
Namespaces
Variants
Actions
in this wiki
other languages
Toolbox