How to compile Stellarium with a Windows seven 64bits platform, and how to make it a fully redistribuable package

This is what you shoul'd be able to do at the end of this article

In this article, I'll assume that you're familiar with c/c++ and Qt. if not, there are plenty of complete tutorials and resources on the Internet.

As we wanted to modify Stellarium's telescope plugin to make it fit its use with Picastro, I was kind of afraid for Stellarium compilation. As you may know, it's often difficult for the average joe to compile open-source softwares, especially when no documentation is available. By chance, there is a lot of documentation for Stellarium. The bad part is that it's kind of out-dated, so you'll need to put your hands in dirt areas. Nothing impossible, through.

Download all the things !

The first thing to do is to get the Stellarium source code. Two ways are possible, depending on what you want to do. You can first download the current release source code, which is stable. Or you can download the "under development" source code. You'll conveniently use a CSV soft, Bazaar, to do this. To retrieve the updated version, you should go to the official web site  . Click on Linux (Source), for the current version 1.3, will give you a link to the sourceforge project.

The second thing you'll do is to get the software QTCreator.  Even it's not your favorite one, I didn't find an easy way to pass through it. (for example, you can't compile it with Microsoft Visual Studio compiler, since there are parts in the Stellarium source code that aren't compatible with this compiler). But as you'll probably see, it's a pretty nice IDE. Download the whole SDK, including the desktop compiler for QT, this is the one that will be used to compile stellarium. Install it under its default path (C:\QtSDK) and choose a custom installation. Under Development tools, only select the last Desktop QT for MinGW compiler. You can select the documentation of Qt as it will be a nice help if you're unfamiliar with Qt development process.

Then, there are 4 open source softwares you'll need for compiling stellarium, which are:

  • CMAKE , that will create the project. It's not really a compiler, it only tells QTCreator how stellarium's code source is organized so QT compilers can do their job. Notice that in the official wiki, it is said that you can't compile directly on a win7 64b plateform directly, and that you must use a virtual xp computer. This information seems to be out-dated, as I was able to compile on my 3 Windows 7 64b computers. Just install Cmake in the default directory, and choose to add Cmake to your path.

Then, you'll need the 3 following softs, which are dependances for Stellarium (if you miss-installed them, you'll get an error at the CMAKE step). Those softs are :

  • GETTEXT, for translating purpose,
  • ICONV for character encoding conversion purpose,
  • ZLIB, for compression purpose.

You should install the three last softwares on the same folder where the mingw compiler is. For me, it's "C:\QtSDK\mingw". Then, you must tell your computer where are all those compilers by adding to the PATH environment variable the path to needed binaries and include files (of course this will depends on the version of Qt you get):

C:\QtSDK\mingw\bin; C:\QtSDK\mingw\include; C:\QtSDK\mingw\lib; C:\QtSDK\Desktop\Qt\4.8.1\; C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin; C:\QtSDK\Desktop\Qt\4.8.1\mingw\include; C:\QtSDK\Desktop\Qt\4.8.1\mingw\lib;

Setting up a Stellarium project in QTCreator

Ok then, launch QTCreator. open CMakeList.txt at the project's root (File/Open File or Project...). As it turns, QTCreator recognize this file "to be the descriptor file of the whole Stellarium project.

The Cmakelists.txt you should use

You can select a build location, to keep your source code clean. You'll also be asked to select a project compiler : Select the default one (MinGW Generator (Mingw as a GCC for Windows targets). Launch the project creation ("Run CMake"). If there are errors here, make sure you didn't forgot any step described above. Verify the different paths (bin folders must contain exe and dll files, include header files, and lib .lib, or .a files. Some error can appear, but if nothing turns red, its OK.

Some error can appears during the process

You now have to say QTCreator that your runtime environment is the project's root. To do this, go under the Projects tab (on the left side of the Window), and got to the runtime parameters tab. As a folder repertory, put the folder where you unzipped the Stellarium sources.

Settings for the Stellarium runtime

After this, you should be able to build the project (Build/Build project "Stellarium") You'll see in the "Compile Output" the process details. There are lot of warnings you shouldn't be afraid of. You can launch your project (Build/Run). Now is the time when you are very happy to see your own Stellarium compilation running !

About debugging : The most annoying thing about this is that I wasn't able to find a way to use the debugger with Stellarium. Anyways, there are plenty of tools in Stellarium that allow you to write messages or TextBoxes to debug in an "old school" way. If you know a way to use a debugger, I'm really interested ...

Distribute your work

So, you made a very nice static plugin and want to distribute it to your friends or even the rest of the world ? Nothing easier. First you must have launched QTCreator as an administrator. Then, under the Projects tab, in the Compilation parameters, add an argument to the existing compilation step (mingw32-make.exe) , "-install". This will install your freshly compiled Stellarium under the program files folder. Next thing to do is to download inno setup, in order to package the whole thing. So open Inno Setup, and Open a New Script File. Use the stellarium.iss script (you can find it at the root folder of the sources). This is an auto generated file (at the CMake step), but in my case, this file has a little problem. Two lines are corrupted and need to be changed manually (don't worry, it's not really hard as it's just a problem with two files paths. You'll have at the end a very nice installer file easy to share.

The quadcopter : the flight controller shield

For our new quadcopter frame(article coming soon 😉 ), we decided to create a completely new Arduino shield, using new sensors and trying to avoid having lots of wires floating around.

We bought the 9 DOF stick sensor from sparkfun and the BMP085 barometer (used for altitude hold). When on the  old shield we had the 3 sensors (ADXL345, L3G4200D, HMC588L) on different boards and linked to the shield by  wires, we now have a single breakout board, directly soldered on the shield, which is a much better looking solution. It also avoids long steps of soldering, plugging mistakes etc... The EM406 breakout board is also directly soldered on the shield. We added two 7x2 connectors, in order to plug the RC receiver, SRF02 sonar sensor and possibly 2 servos in order to control a 2 axis gimball 🙂 The schematic looks like this:

The shield schematic

Another novelty of this shield is the connections with LEDs flexible strip. In addition to the aesthetic side, it will also be useful to distinguish the front from the back of the quadcopter, signal the end of calibration, blink during altitude hold mode etc.. These LEDs strip are not directly plugged to the Arduino, since they require 12V input and could be a bit too much power consuming to be fed from the Arduino. So they are controlled by a NPN BC517 transistor of which the base is connected to a digital output  like so:

How to control the LED strip with the Arduino

The last difference with our previous quadcopter is the change from a L3G4200D gyro in SPI mode to a ITG3200 in I²C mode. We did this partly to free all the SPI connections of the Arduino (10-13) because we needed available ports for the LEDs and for the future gimball, and because our L3G4200D was  pretty often giving completely false readings without any reason. We couldn't find the cause of this problem but we found a few people having the same problem  when we googled it... That pushed us to buy this stick sensor.

The final PCB looks like this:

The shield PCB

The holes and the contour were drilled with Benoit's CNC router and after soldering all the parts, the final results looks like this:

The Arduino shield with theEM406 breakout board, the 9 DOF stick IMU, and the BMP085 barometer

We have tried this shield with our old prototype frame and everything works fine, the flight is really stable.We use the LEDs to show the end of calibration and of course to show the front of the aircraft which is a big help when flying.

So as I said in the beginning of this article we are currently building a brand new frame entirely made of carbon fiber, with new motors, new ESCs and new propellers. We hope that we can finish the construction within the month to come (if we receive our order made at Hobbyking 2 weeks ago 🙂 ) and we will of course post pictures on the website! Stay tuned 😉