[Marble-devel] HOWTO (in progress) - build a libmarble application on windows with Qt Creator, MinGW, CMake

Sylvain Paré sylvain.pare at gmail.com
Thu May 27 15:05:49 CEST 2010


Hi Dennis,

my answers in line


 On 21.05.2010 17:48, Sylvain Paré wrote:
>
> So here the trick : "mingw32-make *release*" !
> the release build does not return error when we launch it!
>
>  Both debug and release builds work for me, none of them too reliable
> though. Sometimes crashing right at start, sometimes later, sometimes never.
>

I mean for my project, not for marble. I confirm again today!
I think it come from the fact you don't use the same version of Qt
here is my .pro file :
############################
QT += network
QT += xmlpatterns
CONFIG += warn_on \
          thread \
          qt \
          debug
CONFIG += console

TEMPLATE = app
TARGET = EasyRun
DESTDIR = bin
DEPENDPATH += . \
    src
INCLUDEPATH += . \
    src
OBJECTS_DIR = temp/
MOC_DIR = temp/
UI_HEADERS_DIR = temp/
UI_SOURCES_DIR = temp/

win32 {
    INCLUDEPATH += $$quote(C:/Program Files/marble/include/marble)
    LIBS += $$quote(C:/Program Files/marble/libmarblewidget.dll)
}
unix {
    LIBS += -L/usr/local/lib \
    -lmarblewidget
}

# Input
HEADERS += ...
SOURCES += ...
RESOURCES += ...
FORMS += ...
############################
So when I build my app with debug mode I have "Microsoft Visual C++ Runtime
Library" "runtime error"
which is not the case in release mode.
(...a moment pass...)
Ok I took a look at the differences between Makefile.Debug and
MakeFile.Release
and the meaning point is that in debug qmake asks to link against
-lQtXmlPatterns*d*4 -lQtGui*d*4 -lQtNetwork*d*4 -lQtCore*d*4 and not
-lQtXmlPatterns4 -lQtGui4 -lQtNetwork4 -lQtCore4
So that is it! Changing those libs works!
I am wondering if it is not Qt's guys that have build those debugging
libraries for VS instead of mingw...
Some Qt's guys hanging here?


>> The marble widget in my app is just a black rectangle where right and
> >> left clicks work as usual ( contextual menu etc)
> >> Like with the standalone marble application => NO map! instead of
> >> being blue it is black...
> >> I think it is normal as it does not work in marble itself.
> >> So again : ANYONE having a clue??
> >>
> > Did you set a valid map theme on the MarbleWidget in your application?
> >
> Another thing: I think (correct me if I'm wrong) that in Windows plugins
> and data directories are searched relative to the application directory.
> If you use it in your own application, make sure to copy those two
> directories from the marble install over: If you have C:\MyApp\foo.exe,
> make sure to copy the data and plugins directories from the Marble
> install directory to C:\MyApp\
>

Ok you score! I needed to copy marble\data\ to MyApp\
( now it is not a big black rectangle but as in marble a big blue marble )
But tiles go to C:\Documents and Settings\Administrateur\Application
Data\.marble\data\maps\earth
and not to C:\Program Files\Marble (and this both for Marble 0.8.0 or
MarbleSVN)

To elaborate on this as well: You need a release build of Marble
> (otherwise QtDesigner complains) and you need to copy
> libmarblewidget.dll (the release version, not the one ending with a 'd')
> to a path that QtDesigner will know. To be on the safe side, copy it
> next to designer.exe in the Qt bin folder. Also copy the data and
> plugins directories there (see above). Once that is done, QtDesigner
> will show the three Marble plugins.
>
> If it still is not working, check the Help => Plugins dialog in
> QtDesigner. For each failing plugin, it will show an error description.
> If it complains about mixed debug and release build, correct that
> setting in CMakeCache.txt (CMAKE_BUILD_TYPE). If it complains about a
> missing module and doesn't tell you which one it misses, use  Dependency
> Walker [1]: Open the Marble designer plugin in it to see which dependent
> dlls are resolved and which not. Ignore wer.dll and ieshims.dll on
> Windows XP. Copy the ones not resolved to the Qt bin folder. That was
> only libmarblewidget.dll here. Adding the Marble directory to your PATH
> variable should work as well.
>

you are right Qt Designer complains about mixing debug and release plugin.
I set CMAKE_BUILD_TYPE to "Release" and it resolved the missing download of
openstreetmap tiles! :p
(a "-DCMAKE_BUILD_TYPE=Release" should be better)
But now Qt Designer complains about unfindable plugin (in fact it is looking
for libmarblewidget.dll )
To solve this you can put libmarblewidget.dll and data\ directory near
qtdesigner.exe ( or copy only data\ and add marble in your system path)

Anyway step two, building a libmarblewidget application passed!
> Here is the way (i will not put it on the techbase untill I don't see
> openstreetmap map in my app):
>
> Probably none of the plugins are loaded. Check the settings menu, any
> plugins listed there? If the qnam networking plugin is not loaded, OSM
> downloads don't happen and the map appears just blue (tile downloading
> always fails).
>

So, now step two, building a libmarblewidget App, is passed!
I will sum it up on the techbase too. I still have one issue : I have tiles
in cache so my App shows me openstreetmap in marblewidget
but the widget don't want to download more tiles.. I had to copy plugin\
directory near myapp.exe to enable the download.
It is quite a PITA all those relative path (what wonderful it is to be on
GNU/Linux..)
So if someone knows how to solve this missing download with a proper way..

Next step is making qtdesigner working.
oups already done :p (see above)
So we need to make an howto on the techbase too.

I will let you know here when I will release those howto.
CU

Sylvain (aka GarthPS)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/marble-devel/attachments/20100527/fd90aa4b/attachment.htm 


More information about the Marble-devel mailing list