Installing Bitfocus Companion on OpenWRT

Posted

Out of curiosity, I wanted to see if the Bitfocus Companion application could work alongside an OpenWRT installation on my Orange Pi R1 Plus. The TL;DR though is that, it’s a lot of work to get it working on OpenWRT; though it should run fine on a Debian or Ubuntu based image.

Docker

The prebuilt Docker image is built for x86 systems, so you would get an issue when trying to execute it on an ARM-based system.

Perhaps I should learn how to do multi-arch Docker builds, or remember how to cross-compile.

Otherwise…


The Plan

In order to get Companion working, we will need clone the GitHub repository, then run the package install script - which will compile some native code.

Oh boy, native code.
Definitely should cross compile this on another system…

Installing the packages

opkg update

# Git wasn't installed
opkg install git git-http

# Node.js and yarn weren't installed
opkg install node node-npm
npm i -g yarn

# Python3 wasn't installed
opkg install python3-light python3-pip

# Build toolchains weren't installed
opkg install make
opkg install gcc pkg-config

# Also set `cc` to run `gcc`
ln -s /usr/bin/gcc /usr/bin/cc


# CMake doesn't exist in the OpenWRT package list
# We could compile it, OR just install it from pip
python3 -m pip install cmake

Development Headers, Libraries, Ugh.

pthread

I ran into an issue where the pthread library wasn’t being found, but someone posted a workaround

“Pthread primitives are part of the core libc.so library. To satisfy -lpthread, create an empty AR archive somewhere in the library search path.”

e.g. ar -rc /usr/lib/libpthread.a

dl

I ran into a similar issue with the dl library, where it couldn’t be located.
Unfortunately the previous workaround didn’t work - and I was left stumped on how to get it working; ultimately ending my compilation journey

[100%] Linking C executable list_cpu_features
/usr/bin/ld: cannot find -ldl
collect2: error: ld returned 1 exit status

More posts

Vaxis ATOM 500 SDI

First impressions and hands-on test

Posted

Reducing Crime by Reducing The Attack Surface

A commentary of NSW's COVID-19 RAT testing service blunder

Posted