Playing with plugin development

Asked by Ross on 2012-10-31

Hi, I would like to play with plugin development, but I have some errors in building the project. I've tried to build the ExamplePainter plugin under Windows 7. The compiling phase ends correctly. But when I launch "make" a get the following error

E:\MinGW\mingw32\bin\ld.exe: cannot find -lstelMain
collect2: ld returned 1 exit status
migw32-make[2]: *** [src/libExamplePainter.dll] Error 1

I've tried to put the libstelMain.dll in this path (E:\MinGW\mingw32\lib). Now it compiles (the linker creates the libExamplePainter.dll) but I get a warning:

cannot find entry symbol "nable-runtime-pseudo-reloc; defaulting to 6fd41000"

and Stellarium crashes on start up.

What am I doing wrong? Where do I have to put the libstelMain.dll?
Thank you

Question information

English Edit question
Stellarium Edit question
No assignee Edit question
Solved by:
Bogdan Marinov
Last query:
Last reply:
Alexander Wolf (alexwolf) said : #1

Do you used instruction for building from ours wiki?

Ross (rosario-ing) said : #2

Yes, but I noticed that there are two wikis about plugin buildings.
This one:
and this one: I followed the first wiki for my tests.

I did the compilation under Linux too, and it worked there, without any warning. But under Windows, the linking did not work. The wiki talked about the STELROOT environment variable, but it seems that it is totally ignored. I also had to copy all the *.hpp files from the "core" folder of the stellarium sources in order to build the project correctly.


Alexander Wolf (alexwolf) said : #3

If your plugin builds fine under Linux then you need check development environment under Windows, like value for PATH.

Do you develop static or dynamic plugin?

Bogdan Marinov (daggerstab) said : #4

ExamplePainter is deliberately dynamic-only, as far as I can remember. I also don't know if it has been adapted for the changes to the painting classes.


STELROOT should be set and Stellarium should be built before you run CMake for the plug-in.

Did you get Stellarium's source from Bazaar or from the source package?

I'll try to build the example plug-ins this afternoon and see if there are any problems. They haven't been maintained for quite some time.

Ross (rosario-ing) said : #5

Thank you all. Yes, ExamplePainter should be a dynamic plugin. STELROOT was set before running CMake. I got Stellarium source from the source package (0.11.4, not the 0.11.4a). STELROOT refers to the parent directory containing the package (i.e. to the "stellarium" folder, not to the "src" inside it).

The PATH variable is set correctly, in fact the compiling and the linking executables (cmake and make) are found automatically and work fine.

For CMake I used:
cmake -G "MSYS Makefiles" ..\.. (as said in the instruction)

No errors and no warnings are shown.
For the linking phase I launched simply: "make".

It seems that the STELROOT is ignored or not set appropriately. And why is the error message (see my first message) searching for a "stelMain" library? No "stelMain.dll" library is made during the compilation of Stellarium. Instead, there is a "libstelMain.dll", not a "stelMain.dll"...

Perhaps the linker (ld.exe) is searching for a library that does not exist in Stellarium package...

Alexander Wolf (alexwolf) said : #6

You need use for CMake:
 cmake -G "MSYS Makefiles" ../..

Ross (rosario-ing) said : #7

Thanks, Alexander, in fact for the cmake phase I have no error (I tried ..\.. and also ../.. with no difference in the output). The problem is during the linking (ld.exe) phase. The ld.exe is searching for a phantom "stelMain" library... The error (better: the warning) shows up only at this point. And Stellarium crashes at start up. If I delete the "libExamplePainter.dll" from the "modules" folder, Stellarium works fine.

Ross (rosario-ing) said : #8

Hi Bogdan, any news from your test?

Launchpad Janitor (janitor) said : #9

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Ross (rosario-ing) said : #10

So, I didn't have any reply?

Alexander Wolf (alexwolf) said : #11

I looking at ExamplePainter plugin and get bad news - this plugin is out-of-date and can't run with trunk's code because it not compatible with new rendering engine. This plugin may be run only within 0.11.x core.

You need's example for drawing for new rendering engine or just example of dynamic plugin?

Ross (rosario-ing) said : #12

Well, both.

But my test was focused just to make it work under 0.11.x core and I've got the error above. I understand that you were able to make it run under the 0.11.x, so I did something wrong, but I don't know what...! :-)

I'd be happy to make the plugin work under the 0.11.x, not under the new rendering engine.... (eventually, in the future I might be interested!)

Alexander Wolf (alexwolf) said : #13

I'm gets executable plugin without problems, but I use Linux.

Bogdan Marinov (daggerstab) said : #14

I've got it.

There's a problem with linking plug-in .dlls on Windows due to wrong linker parameters. This caused the "cannot find entry symbol" warning. I'm not sure what is the more general reason, whether newer versions of ld has become more choosy about correct parameters, or something else.

I'll commit the fix shortly. (As soon as I get a non-anonymous checkout through my slow Internet connection. :( )

Best Bogdan Marinov (daggerstab) said : #15


SourceForge upgraded the repositories and changed their URLs. The links in the documentation page lead to the old repository and won't show the latest changes. So use these:

As for why your setup can't find Stellarium's main library, it's probably something with paths and directory structure. The CMake scripts expect the build to be in STELROOT/builds/msys.

Ross (rosario-ing) said : #16

Thank you, now it compiles fine and I get a working plugin! Great, Bogdan!

Ross (rosario-ing) said : #17

Thanks Bogdan Marinov, that solved my question.