Introduction
I was recently made aware of a bug in GPSd that will result in the time/date jumping backwards 1024 weeks, from October 16, 2021 to Sunday March 3, 2002 for versions 3.20, 3.21, and 3.22. GPSd version 3.22 is currently scheduled to ship with Debian Bullseye, which will be a problem. I use GPSd for my timekeeping interfaces between the source GPS and NTP/Chrony. GPSd version 3.17 is present in the current Raspberry Pi OS (Raspbian) images (based off Debian 9 – Stretch) as well.
Fortunately, it isn’t hard to update to your desired version!
Updating GPSd
The overview for updating GPSd is as follows:
- Download the desired release with wget (look for >3.23)
- Uncompress the archive
- Use scons to build the new binaries
- Use scons to install the new binaries
So with that out of the way, let’s get started. (The full install script is at the bottom if you just want to jump ahead to that).
You must first ensure you have the required packages to actually build GPSd from source:
sudo apt update sudo apt install -y scons libncurses-dev python-dev pps-tools git-core asciidoctor python3-matplotlib build-essential manpages-dev pkg-config python3-distutils
Next, we will download the desired version of GPSd. In this case, we will be updating GPSd to version 3.23.1. A full list of the releases can be found here.
wget http://download.savannah.gnu.org/releases/gpsd/gpsd-3.23.1.tar.gz
Extract the files from the .tar.gz archive, and change to the created folder:
tar -xzf gpsd-3.23.1.tar.gz cd gpsd-3.23.1/
Now we can build the binaries, which will take a few minutes to run:
sudo scons # some sources say to do a config=force for scons, I found this wasn't necessary # if you want to use this force argument, below is the required command # sudo scons --config=force
Last up is to actually install the binaries:
sudo scons install
And with that, you should now have an updated GPSd running version 3.23.1! I rebooted for good measure with sudo reboot.
If you’re interested in a full script to do all this, check this out:
sudo apt update sudo apt install -y scons libncurses-dev python-dev pps-tools git-core asciidoctor python3-matplotlib build-essential manpages-dev pkg-config python3-distutils wget http://download.savannah.gnu.org/releases/gpsd/gpsd-3.23.1.tar.gz tar -xzf gpsd-3.23.1.tar.gz cd gpsd-3.23.1 sudo scons sudo scons install gpsd -V
Verifying you have the update for GPSd
gpsd -V
References/Sources
- The always helpful and informative satsignal.eu – https://www.satsignal.eu/raspberry-pi/UpdatingGPSD.html
- Official GPSd docs – https://gpsd.gitlab.io/gpsd/building.html
7 replies on “How to update GPSd by building from source”
You will also need to add python3-distutils to your apt install list, if it’s not already installed, or you’ll get an error as follows:
ModuleNotFoundError: No module named ‘distutils.util’:
File “…/gpsd-3.23.1/SConstruct”, line 69:
Updated! Thanks!
You saved the day my friend.
Glad I could help!
Thanks for this article. I find GPSD extremely confusing. The official website is a mess.
There seems to be a conflict between installing it as a service and hotplugging. According to the build manual, the preferred way is hotplugging.
How then does [email protected] and possible /etc/default/gpsd get installed.?I run scons install, but these files are not installed
GPSD is definitely confusion. In general it “just works” but it is quite unclear how it actually works. Being able to set flags and some initial bits to configure the GPS would be great but that is not their philosophy. I don’t know how [email protected] or /etc/default/gpsd get installed, sorry.
Running `scons udev-install` was the missing step here for me 🙂
`scons install` puts the binaries in the appropriate spot; and `scons udev-install` actually added the hotplug udev rules and the systemd services as well.
I was chasing the issue of my custom written gpsd systemd service saying “/dev/ttyACM0: device activation failed, freeing device.” on boot. The missing piece was the udev rules to notify the gpsd socket when the usb device became available. ie: `gpsd:CLIENT: <= control(7): +/dev/ttyACM0`
`scons udev-install` configured udev rules and systemd for me – I'd be great if this tutorial could mention that as well.
Thanks!