getting wiringpi to work under ubuntu 20.10 on a raspberry pi 4b w/4gb


Over the years, one of the software tools I came to depend on was gpio from the project WiringPi. There were others to be sure, but I like using WiringPi. I came to take it for granted, so much so, that when its author, Gordon Henderson, decided to deprecate WiringPi and stop supporting it, I was more than a bit shocked. I read Gordon’s reasons for exiting, and I agree with his reasons. I’m not here to hash over those reasons as it’s now been over a year since that happened.

In the mean time I installed Ubuntu 20.10 for the Raspberry Pi 4B on my RPi 4B’s and went about the business of making sure the core set of tools that I use on Raspbian were also available on Ubuntu 20.10. As it turns out, WiringPi is available, but it won’t work.

The reason is that the version available via apt is version 2.50. The version at a minimum should be 2.54 or greater, which was a special release that Gordon provided for the 4B right after he officially stopped supporting WiringPi in general.

So I contacted Gordon, who advised me to look on Github for a copy of his code. I found that, cloned it, and tried to build and install it. It built but failed to link due to a symbol defined multiply times error. That was due to a structure definition in a header file that showed up twice in two object files. I fixed that by turning the explicit structure definition into a typedef. When I tried again, it built and linked and deployed the shared library. After that, gpio ran just fine as shown above.

The link to my fork with the one fix is here: https://github.com/wbeebe/WiringPi

I picked up a branch in the fork. I will probably delete that, as all I care about right now is the mainline code. If I do anything it will be to clean up the warnings I see as the code builds (and there are a fair number now) as well as reducing dependence on the pre-processor. Reducing dependency on the pre-processor means replacing #defines with const constants, allowing the compiler to do its job and treat C/C++ as a strongly typed language.

raspberry pi 4 status report for 10 april 2020 – running pretty good these days

If there’s one thing I’ve been critical of with regards to the Raspberry Pi 4, it’s been the fact it runs hotter than any prior Raspberry Pi. I run my Pi 4s in a Flirc case (https://flirc.tv/more/raspberry-pi-4-case) in order to keep them as cool as possible during operation. Yet as good as the Flirc case is, the Pi 4 with the Raspbian initial release still easily hit the mid-50°Cs (or hotter) with just regular usage. Recently I’ve noticed that the Pi 4, with the latest version of Buster (including all patches) and the firmware, is running a good 10°C cooler, around the mid-40°C or cooler. When I now put my hand on the case it’s barely warm, not the hot little brick when I first put the Raspberry Pi 4 in the case.

In addition to running cooler, Raspbian Buster appears to be using a lot less memory resources than before, such as when having many open tabs in Chromium. More often than not I could see on htop where swap was being hit with a regular load of Chromium, multiple open tabs on the Terminal with multiple editing sessions, and regular builds with any of Go, C++, Rust, Python 3 or Julia running. I’ve now had the Pi 4 up for five days with continuous use and I haven’t hit swap yet.

And speaking of Julia, I installed version 1.4.0 and then installed all the supporting packages I normally need. One of those packages is Winston, and it has problems. Winston under Julia 1.4.0 is dependent on more packages than ever these days, so much so that any Julia script I’ve written won’t run because not all the current Winston dependencies are met. As a consequence I’ve dropped back to running the prior release, Julia 1.3.1. My scripts still run, and for the time being I’m not updating any of its packages.