Pushing to Tidbyte with Github Actions (and how to resolve the libwebp.so.6: cannot open shared object file error)
Click here to skip to the working file.
We track the step goal of our pets using a Fi Collar worn by each of them. A Github Action pulls the step data from Fi’s API and then renders an image to our Tidbyt, displaying the information (and other things) in our living room.
The result looks something like what you see above (depending on how they’re doing with their step goal).
Here’s the workflow file:
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
jobs:
render_webp:
runs-on: ubuntu-latest
steps:
- name: Check out current repo
uses: actions/checkout@v2
- name: Install Dependencies
run: sudo apt-get install libwebp-dev -y
- name: Download pixlet
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'tidbyt/pixlet'
version: 'tags/v0.17.12'
file: 'pixlet_0.17.12_linux_amd64.tar.gz'
- name: Unarchive pixlet
run: tar xzvf pixlet_0.17.12_linux_amd64.tar.gz && chmod +x pixlet
- name: Render webp Image
run: ./pixlet render winter_steps.star
- name: Push webp Image
run: |
./pixlet push \
--api-token "$" \
--installation-id wintersteps \
"$" \
winter_steps.webp \
--background
Nothing too crazy.
Anyway, I noticed today that the github action was failing - I was getting email alerts, and the steps weren’t updating. Looking through the workflow logs, Tidbyt’s pixlet
binary was having some issues:
Run ./pixlet render winter_steps.star
./pixlet: error while loading shared libraries: libwebp.so.6: cannot open shared object file: No such file or directory
Weird. Just a few lines up, I install the libwebp-dev package that’s been working up until recently.
sudo apt-get install libwebp-dev -y
I modified the workflow to install apt-file
, update its inventory, and then searched for where libwebp-dev was putting it’s .so
files.
# [...]
- name: Install apt-file
run: sudo apt-get install apt-file -y
- name: Where does it put it
run: sudo apt-file update && sudo apt-file list libwebp-dev
# [...]
The output looks like:
Fetched 124 MB in 24s (5079 kB/s)
Run sudo apt-file update && sudo apt-file list libwebp-dev
Get:1 https://packages.microsoft.com/ubuntu/22.04/prod jammy InRelease [10.5 kB]
# [...]
Reading package lists...
libwebp-dev: /usr/include/webp/decode.h
libwebp-dev: /usr/include/webp/demux.h
libwebp-dev: /usr/include/webp/encode.h
# [...]
libwebp-dev: /usr/lib/x86_64-linux-gnu/libwebp.so
libwebp-dev: /usr/lib/x86_64-linux-gnu/libwebpdemux.so
libwebp-dev: /usr/lib/x86_64-linux-gnu/libwebpmux.so
# [...]
Sure enough, it’s in a new location, under a different name. A package update must have changed the default filename, or the latest ubuntu-latest
maybe have relocated the library path away from where pixlet
was expecting it. Either way, this is not the libwebp.so.6
we expected.
So what’s the fix?
pixlet
is looking for libwebp.so.6
- let’s give it libwebp.so.6
.
- name: Put libwebp where it's expected
run: sudo ln /usr/lib/x86_64-linux-gnu/libwebp.so /usr/lib/x86_64-linux-gnu/libwebp.so.6
And let’s make sure it’s looking in the right directory for these lib files.
- name: Render webp Image
run: ./pixlet render winter_steps.star
env:
LD_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu
And now we’re done! Here’s the full github action for anyone interested. Hope it helps someone.
Github Action with Fixes
on:
workflow_dispatch:
schedule:
- cron: '0 * * * *'
jobs:
render_webp:
runs-on: ubuntu-latest
steps:
- name: Check out current repo
uses: actions/checkout@v2
- name: Install Dependencies
run: sudo apt-get install libwebp-dev -y
# We added this!
- name: Put libwebp where it's expected
run: sudo ln /usr/lib/x86_64-linux-gnu/libwebp.so /usr/lib/x86_64-linux-gnu/libwebp.so.6
- name: Download pixlet
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: 'tidbyt/pixlet'
version: 'tags/v0.17.12'
file: 'pixlet_0.17.12_linux_amd64.tar.gz'
- name: Unarchive pixlet
run: tar xzvf pixlet_0.17.12_linux_amd64.tar.gz && chmod +x pixlet
- name: Render webp Image
run: ./pixlet render winter_steps.star
# We added the `env` field here
env:
LD_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu
- name: Push webp Images
run: |
--api-token "$" \
--installation-id wintersteps \
"$" \
winter_steps.webp \
--background
Comments