This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Problem with searchPlacemarks

Tags: None
(comma "," separated)
rainbowgoblin
Registered Member
Posts
21
Karma
0

Problem with searchPlacemarks

Fri Apr 26, 2013 2:51 am
I'm using MarbleWidget in software I'm developing that runs on Mac OSX, Windows, and Linux. I'm currently working on a Mac, and going through the Marble tutorials that are relevant. I've gotten to the search tutorial (http://techbase.kde.org/Projects/Marble/Runners/Search) and I've run into a snag: no search results are found. I've copied and pasted the code from the tutorial exactly as is into a source file, compiled it successfully, and then when nothing seemed to be happening, I added a line to check the size of the searchResult QVector (its size is 0).

I suspect this is related to an oddity that I noticed earlier, in the GeoDataPlacemark tutorial (http://techbase.kde.org/Projects/Marble/Runners/DisplayGeoDataPlacemark). In that tutorial's screenshot, many names of places appear (Europe, and multiple large European cities). When I compile the tutorial (exactly as is), I have the placemark for Bucharest that's added in the code, but no other names appear.

Is this specifically a Mac OSX issue? If so, is there a workaround that I can use so that I can still distribute my software to Mac users? The marble binary that was installed when I installed the library seems to work (both displays names of places and allows searching).
rainbowgoblin
Registered Member
Posts
21
Karma
0

Re: Problem with searchPlacemarks

Sun Apr 28, 2013 3:05 am
Just an update... I've checked this out on a Linux system, and it really does seem to be a Mac issue. Or perhaps an issue with my Marble installation?
User avatar
Earthwings
KDE Developer
Posts
172
Karma
1
OS

Re: Problem with searchPlacemarks

Sun Apr 28, 2013 7:21 am
Yes, I tested it as well on Linux and it works fine here.

Can you give some details on your installation on Mac? Are you using the packages from marble.kde.org and compile against them or do you use a self-compiled one?
rainbowgoblin
Registered Member
Posts
21
Karma
0

Re: Problem with searchPlacemarks

Sun Apr 28, 2013 8:35 am
I compiled it myself, mostly following the instructions here: https://code.google.com/p/tonatiuh/wiki ... rbleForMac

I had to use install_name_tool to tell libmarblewidget.15.dylib that it had been moved to /usr/local/lib/marble after compilation, and then to fix the plugins that were linked to it.

I've been wondering if this could be a plugin-related issue. When I first compiled the library I wrote a simple test program with a MarbleWidget as a central widget, and had to use QApplication::removeLibraryPath and QApplication::addLibraryPath to make sure that the plugins could be loaded. It was compiling, but I'd errors like this:

Code: Select all
Ignoring to load the following file since it doesn't look like a valid Marble plugin: "/usr/local/Marble.app/Contents/MacOS/resources/plugins/libAprsPlugin.so"
Reason: "Cannot load library /usr/local/Marble.app/Contents/MacOS/resources/plugins/libAprsPlugin.so: (dlopen(/usr/local/Marble.app/Contents/MacOS/resources/plugins/libAprsPlugin.so, 5): Library not loaded: @executable_path/lib/libmarblewidget.15.dylib
  Referenced from: /usr/local/Marble.app/Contents/MacOS/resources/plugins/libAprsPlugin.so
  Reason: image not found)"


I don't get this error when I run any of the tutorials, which I assumed was because the plugins weren't loading. Also, I tried adding the app.removeLibraryPath/app.addlibraryPath lines, and the Search tutorial code still didn't produce any search results.
User avatar
Earthwings
KDE Developer
Posts
172
Karma
1
OS
rainbowgoblin wrote:I compiled it myself, mostly following the instructions here: https://code.google.com/p/tonatiuh/wiki ... rbleForMac

I just looked over that page and see some serious flaws in the guide:
  • We have moved from svn to git long ago and the SVN branch KDE/4.5 is very much outdated (about three years old). Guess you didn't use it.
  • It suggests to install everything manually by copying files to /usr/local. This is likely causing the problems you're experiencing

Instead just let cmake handle the installation by running
Code: Select all
make install
It takes care to copy files at their correct location and makes sure to also copy the data files etc. which are needed by Marble at runtime. If that alone does not solve your problem, can you give our compile guide over at http://marble.kde.org/sources.php a try?

rainbowgoblin wrote:I had to use install_name_tool to tell libmarblewidget.15.dylib that it had been moved to /usr/local/lib/marble after compilation, and then to fix the plugins that were linked to it.

I've been wondering if this could be a plugin-related issue. When I first compiled the library I wrote a simple test program with a MarbleWidget as a central widget, and had to use QApplication::removeLibraryPath and QApplication::addLibraryPath to make sure that the plugins could be loaded. It was compiling, but I'd errors like this:

Code: Select all
Ignoring to load the following file since it doesn't look like a valid Marble plugin: "/usr/local/Marble.app/Contents/MacOS/resources/plugins/libAprsPlugin.so"
Reason: "Cannot load library /usr/local/Marble.app/Contents/MacOS/resources/plugins/libAprsPlugin.so: (dlopen(/usr/local/Marble.app/Contents/MacOS/resources/plugins/libAprsPlugin.so, 5): Library not loaded: @executable_path/lib/libmarblewidget.15.dylib
  Referenced from: /usr/local/Marble.app/Contents/MacOS/resources/plugins/libAprsPlugin.so
  Reason: image not found)"


I don't get this error when I run any of the tutorials, which I assumed was because the plugins weren't loading. Also, I tried adding the app.removeLibraryPath/app.addlibraryPath lines, and the Search tutorial code still didn't produce any search results.

This sounds indeed like problems that 'make install' will take care of.

Another useful trick to look into plugin loading is running marble with a parameter
Code: Select all
--debug-info
It will give details about where it tries to load plugins.
rainbowgoblin
Registered Member
Posts
21
Karma
0

Re: Problem with searchPlacemarks

Mon Apr 29, 2013 8:33 am
Yes, I definitely followed the instructions to check out Marble from git on the KDE website.

Looking back at what I did, it looks like I had to make a few adjustments to the cmake instructions here: http://techbase.kde.org/Projects/Marble/MacCompiling

I had to edit CMakeLists.txt to compile for x86_64 (I'm running OS 10.7, and the Qt libraries seem to be 64-bit only, so linking failed with the file as it was). I commented out the line:
Code: Select all
SET( CMAKE_OSX_ARCHITECTURES i386 ) #Comment out if universal binary

and added:
Code: Select all
SET( CMAKE_OSX_ARCHITECTURES x86_64 )


However, while running make install creates a working version of the Marble.app bundle, THAT'S NOT MY PROBLEM, it doesn't install the library in a sensible location. This is why I followed the instructions on that rather outdated Google Code page: it explained which headers I needed to copy to, e.g., /usr/local/include/marble, and that libmarblewidget*.dylib needed to be copied to, e.g., /usr/local/lib, and the plugins to... somewhere useful. However, I had to also change the id of libmarblewidget with:

Code: Select all
sudo install_name_tool -id /usr/local/lib/libmarblewidget.dylib /usr/local/lib/libmarblewidget.dylib


But that said, things seem to be running now. When I compile the tutorials I mentioned earlier, I can find several results for Karlsruhe and names of places appear on the map.

Sorry for making this excessively long, I figured this might help someone else to get the library working on OSX.
User avatar
Earthwings
KDE Developer
Posts
172
Karma
1
OS

Re: Problem with searchPlacemarks

Tue Apr 30, 2013 8:48 pm
Great to hear it works now, thanks for getting back and looking into it. Is it possible to choose a sensible default for CMAKE_OSX_ARCHITECTURES? Or offer a cmake option so that users can override it at least without touching cmake files? Would be lovely if you could come up with a patch, we don't have too many developers with mac systems unfortunately.

There's also some work in https://git.reviewboard.kde.org/r/105315 which might be interesting here, also for plugin loading.
rainbowgoblin
Registered Member
Posts
21
Karma
0

Re: Problem with searchPlacemarks

Fri May 03, 2013 2:33 am
That patch was surprisingly helpful. I applied it, but it turns out that it still hard-codes the plugin location, just to a different spot. But it pointed me to the part of the code where the plugin location is set (I'll post this as a solution to my other question once I've sorted it out completely).

I tried passing the architecture as a command line flag to cmake, and it didn't seem to work. However, I (accidentally) tried just commenting out all of the SET( CMAKE_OSX_ARCHITECTURES...) lines from CMakeLists.txt, and things compiled just fine, so maybe that's the solution.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], lockheed, mesutakcan, Sogou [Bot]