The following are the dependencies needed to build Geoclue2. But If Geoclue2 is already included in your distro/OS, you should be able to use the package manager's command to install all build depedndancies.
gio (>= 2.44.0)
Fedora:
shell
sudo dnf builddep geoclue2
Debian and Ubuntu:
shell
sudo apt build-dep geoclue-2.0
Fedora:
shell
sudo dnf install ModemManager-devel
sudo dnf install avahi-devel
sudo dnf install avahi-glib-devel
sudo dnf install libnotify-devel
Debian and Ubuntu:
shell
sudo apt install modemmanager-dev
sudo apt install libavahi-client-dev
sudo apt install libavahi-glib-dev
sudo apt install libnotify-dev
Ensure you have a geoclue
user on your system. If it already exists, you may
need to modify /etc/passwd
file to make it a login user account by replacing
/sbin/nologin
with /bin/bash
(or the path to your preferred shell).
Build and install geoclue.
shell
meson --prefix=/usr --sysconfdir /etc -Ddbus-srv-user=geoclue build
# you may need to pass --libdir=/usr/lib64 on some systems (eg. Fedora)
ninja -C build
sudo ninja -C build install
shell
sudo su geoclue # Starts a new shell as `geoclue` user
G_MESSAGES_DEBUG=Geoclue /usr/libexec/geoclue
If you get the following error, make sure geoclue
process is not already
running:
```
Failed to acquire name 'org.freedesktop.GeoClue2' on system bus or lost it ```
shell
/usr/libexec/geoclue-2.0/demos/where-am-i
It will give your current location.