So I’ve officially given up on figuring out how to get the right libraries installed for GTG so that I can test out its geolocalization features. But, if you’ve seen my previous posts, you know it’s been a painful process since I just can’t seem to get the right libraries installed to get things working. But I’m going to go out on a limb and guess that this might not be entirely my fault because, from what I can tell, it seems like this particular feature is a rather old project? So maybe it’s not surprising that the necessary libraries are a bit out of synch from the latest downloads that come bundled with Debian/Gnome/GTG. (Update: this bug report seems to confirm that this might be the case after all.)

So, with that sentiment, I’m moving on and am now going to try and install the libraries directly to see if I can get localization working separately from GTG. I’ve been advised that I need GeoClue2 to get location information, Champlain in GIR to show locations on a map, and GTK3 in GIR to show a map on a window. So I’m going to break it down and tackle the problem piece-wise.

First step: get GeoClue2 working.

  • Building the source: After digging around, I came across this, which looked a lot more promising. I also found this experimental deb release here, which is useful for those who don’t want to deal with sources.
    [Note: I also came across this repo as well. But this is specifically for geocoding and is something different than GeoClue2.] So I pulled the source. To avoid getting the same install errors I did, first installed the gtk-doc package:

    git clone git://
    sudo yum install glib-devel gtk-doc json-glib-devel 
    sudo yum install intltool itstool libxml2-devel libtool libsoup-devel
    sudo yum install gobject-introspection-devel

    Now you should have all the pre-reqs for running GeoClue2:

    ./ --prefix=/usr
    ./configure --prefix=/usr
    sudo make install

    A couple of things to note here. First, if you don’t use the --prefix=/usr flags, then the dbus files get put in /usr/local/share instead of /usr/share. Second, you have to use root credentials to do the install because you’re installing dubs services.

  • Now that everything compiles nicely, you can try out the demo by going to the demo folder and running ./where-am-i. You may get an error message like this:
    CRITICAL **: Failed to connect to GeoClue2 service: 
    Error calling StartServiceByName for org.freedesktop.GeoClue2: 
    Launch helper exited with unknown return code 253

    If you do, it’s because you didn’t use the --prefix=/usr flag I mentioned before. So go back, do a make clean and repeat the build process.
    If you’re sure you did add the flags, then it’s possible that the install still went incorrectly. On my Fedora machine, it added the /usr prefix in front of a /etc install, which led to things being installed under /etc instead of /usr/etc. You can change the script, or just hack it for now (like I did) and move the necessary files:

    sudo mv /usr/etc/system.d/org.freedesktop.GeoClue2.* /etc/dbus-1/system.d/

    Now you should be able to run the GeoClue2 demo:

    cd demo

    And you’ll see output that looks like this:

    Latitude: 40.440601
    Longitude: -79.995903
    Accuracy (in meters): 15000.000000
    Description: Pittsburgh, Pennsylvania, United States
  • Note if you want to get things installed on Ubuntu, I had to first install these packages:
    sudo apt-get install intltool itstool libxml2-utils 
    sudo apt-get install libgeocode-glib-dev libjson-glib-dev libsoup2.4-dev
    sudo apt-get install libgirepository1.0-dev

    The rest of the install process (including the --prefix=/usr flags I mentioned before) is the same.
    For ‘fun’, I also tried this process on a Debian machine and ended up having a much harder time getting things to just work. So I decided to ditch that and just stick with Fedora (or Ubuntu) for now.

This article has 1 comments

  1. Zeeshan Ali Reply

    Thanks for writing this article. Just wanted to point out that you need not copy any files if you pass ‘–sysconfdir=/etc’ to the configure script of geoclue.

Leave a Comment

Your email address will not be published. Required fields are marked *