Has anyone attempted to build a version of qt-openzwave/ozwdaemon that can be run directly on a raspberry pi without docker? If not I’ll use this topic to document my attempts at doing so. Currently the main sticking point I am running in to is that raspbian (I guess it is Raspberry Pi OS now) only includes Qt-5.11 packages and qt-openzwave requires Qt-5.12. It sounds like building Qt on the Pi is kind of a pain and takes a long time so my plan was to try to learn how to cross compile for the Pi from my laptop. If anyone knows of an easier way I would love to hear it, otherwise I’ll post about my progress here.
If you handy with managing apt - You can get the required QT versions from Sid or bullseye from Debian. The containers are currently running bullseye though as sid was a bit unstable in terms of new versions/releases of QT breaking. If you manage to figure out how to do this, please share you instructions on the qt-openzwave issue tracker. The other alternative is Ubuntu Focal (the stock distro has a recent enough version of QT)
Otherwise - yes, compiling QT on a rPi is going to take you 8-14 hours depending on which rPi you have, and more often than not, native compiles will fail. (out of memory etc).
So I think I have gotten to the point where I can install the Qt5.12 dependencies I would need to build QtMqtt and qt-openzwave on my raspberry pi but it is going to be updating a lot of stuff and I am a little concerned my system is going to be hosed if I go through with it, especially since all I have to test on is my “production” homeassistant install. FWIW here is where I have gotten so far:
Update /etc/apt/sources.list
Add:
# Bullseye
deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
Add file /etc/apt/apt.conf.d/buster
with contents:
APT::Default-Release "buster";
Install dependencies from buster repo
sudo apt-get install rapidjson-dev git cmake make pkgconf bash python wget joe mc libunwind-dev libcurl4-openssl-dev g++
Install from bullseye repo
sudo apt-get -t bullseye install gcc-8-base libgcc-8-dev qt5-default libqt5websockets5-dev qtbase5-private-dev libqt5remoteobjects5-dev libqt5remoteobjects5-bin
List of what is going to be changed:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
dh-python libfl2 libpython3.7-dev python3.7 python3.7-dev python3.7-minimal python3.7-venv
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
adwaita-icon-theme at-spi2-core binutils binutils-arm-linux-gnueabihf binutils-common cpp-8 g++-8 gcc-10-base gcc-8 gcc-9-base gir1.2-gst-plugins-base-1.0
gir1.2-gstreamer-1.0 gir1.2-gudev-1.0 gtk-update-icon-cache hardlink hicolor-icon-theme libapt-pkg6.0 libasan5 libatk-bridge2.0-0 libatk1.0-0 libatk1.0-data
libatomic1 libatspi2.0-0 libavahi-client3 libavahi-common-data libavahi-common3 libbinutils libblkid-dev libblkid1 libc-bin libc-dev-bin libc-l10n libc6
libc6-dbg libc6-dev libcc1-0 libcolord2 libcrypt-dev libcrypt1 libctf-nobfd0 libctf0 libcups2 libdouble-conversion3 libegl-dev libegl1 libepoxy0
libevdev-dev libevdev2 libffi-dev libffi7 libgcc-s1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgfortran5 libgirepository-1.0-1 libgl-dev libgl1
libgles-dev libgles1 libgles2 libglib2.0-0 libglib2.0-bin libglib2.0-dev libglib2.0-dev-bin libglvnd0 libglx-dev libglx0 libgnutls-dane0 libgnutls-openssl27
libgnutls30 libgomp1 libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0
libgudev-1.0-dev libhogweed5 libicu67 libinput-bin libinput-dev libinput10 libisl22 libjson-glib-1.0-0 libjson-glib-1.0-common liblcms2-2 libllvm10
libmount-dev libmount1 libmtdev-dev libmtdev1 libnettle7 libnih-dbus1 libnih1 libp11-kit0 libpcre16-3 libpcre2-16-0 libpcre2-32-0 libpcre2-8-0 libpcre2-dev
libpcre2-posix2 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpthread-stubs0-dev libpython3-dev libpython3-stdlib libpython3.7 libpython3.7-dev
libpython3.7-minimal libpython3.7-stdlib libpython3.8 libpython3.8-dev libpython3.8-minimal libpython3.8-stdlib libqt5concurrent5 libqt5core5a libqt5dbus5
libqt5gui5 libqt5network5 libqt5opengl5 libqt5opengl5-dev libqt5printsupport5 libqt5remoteobjects5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5test5
libqt5websockets5 libqt5widgets5 libqt5xml5 libreadline8 librest-0.7-0 libselinux1 libselinux1-dev libsepol1 libsepol1-dev libsoup-gnome2.4-1
libstdc++-8-dev libstdc++6 libtasn1-6 libubsan1 libuuid1 libvulkan-dev libvulkan1 libwacom-bin libwacom-common libwacom-dev libwacom2 libx11-6 libx11-dev
libx11-xcb1 libxau-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-util0 libxcb-xinerama0 libxcb-xinput0
libxcb-xkb1 libxcb1 libxcb1-dev libxcomposite1 libxdmcp-dev libxext-dev libxkbcommon-dev libxkbcommon-x11-0 libxkbcommon0 libz3-4 locales manpages-dev
mesa-vulkan-drivers python3 python3-apt python3-cffi-backend python3-crypto python3-dbus python3-dev python3-distutils python3-gi python3-gst-1.0
python3-lib2to3 python3-minimal python3-venv python3.7 python3.7-dev python3.7-minimal python3.7-venv python3.8 python3.8-dev python3.8-minimal
python3.8-venv qt5-gtk-platformtheme qt5-qmake qt5-qmake-bin qtbase5-dev qtbase5-dev-tools qtchooser qttranslations5-l10n uuid-dev x11proto-core-dev
x11proto-dev x11proto-xext-dev xorg-sgml-doctools xtrans-dev
Suggested packages:
binutils-doc gcc-8-locales gcc-8-doc glibc-doc colord cups-common libevdev-doc libgirepository1.0-dev libglib2.0-doc dns-root-data gnutls-bin
libvisual-0.4-plugins gvfs liblcms2-utils qt5-image-formats-plugins qtwayland5 libstdc++-8-doc libx11-doc libxcb-doc libxext-doc python3-doc python3-tk
python3-apt-dbg python-apt-doc python-dbus-doc python3-dbus-dbg python3.7-doc binfmt-support python3.8-doc default-libmysqlclient-dev firebird-dev libpq-dev
unixodbc-dev
Recommended packages:
apt uuid-runtime
The following packages will be REMOVED:
libgcc1 libpcre2-posix0
The following NEW packages will be installed:
adwaita-icon-theme at-spi2-core gcc-10-base gcc-9-base gir1.2-gudev-1.0 gtk-update-icon-cache hicolor-icon-theme libapt-pkg6.0 libatk-bridge2.0-0
libatk1.0-0 libatk1.0-data libatspi2.0-0 libavahi-client3 libblkid-dev libcolord2 libcrypt-dev libcrypt1 libctf-nobfd0 libctf0 libcups2
libdouble-conversion3 libegl-dev libepoxy0 libevdev-dev libevdev2 libffi7 libgcc-s1 libgl-dev libgles-dev libgles1 libgles2 libglib2.0-bin libglib2.0-dev
libglib2.0-dev-bin libglx-dev libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-dev libhogweed5 libicu67 libinput-bin libinput-dev libinput10 libisl22
libjson-glib-1.0-0 libjson-glib-1.0-common liblcms2-2 libllvm10 libmount-dev libmtdev-dev libmtdev1 libnettle7 libpcre16-3 libpcre2-16-0 libpcre2-32-0
libpcre2-dev libpcre2-posix2 libpcre3-dev libpcre32-3 libpcrecpp0v5 libpthread-stubs0-dev libpython3.8 libpython3.8-dev libpython3.8-minimal
libpython3.8-stdlib libqt5concurrent5 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5opengl5 libqt5opengl5-dev libqt5printsupport5
libqt5remoteobjects5 libqt5remoteobjects5-bin libqt5remoteobjects5-dev libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5test5 libqt5websockets5
libqt5websockets5-dev libqt5widgets5 libqt5xml5 libreadline8 librest-0.7-0 libselinux1-dev libsepol1-dev libsoup-gnome2.4-1 libvulkan-dev libvulkan1
libwacom-bin libwacom-common libwacom-dev libwacom2 libx11-dev libxau-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0
libxcb-util0 libxcb-xinerama0 libxcb-xinput0 libxcb-xkb1 libxcb1-dev libxdmcp-dev libxext-dev libxkbcommon-dev libxkbcommon-x11-0 libz3-4
mesa-vulkan-drivers python3.8 python3.8-dev python3.8-minimal python3.8-venv qt5-default qt5-gtk-platformtheme qt5-qmake qt5-qmake-bin qtbase5-dev
qtbase5-dev-tools qtbase5-private-dev qtchooser qttranslations5-l10n uuid-dev x11proto-core-dev x11proto-dev x11proto-xext-dev xorg-sgml-doctools xtrans-dev
The following packages will be upgraded:
binutils binutils-arm-linux-gnueabihf binutils-common cpp-8 g++-8 gcc-8 gcc-8-base gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 hardlink libasan5
libatomic1 libavahi-common-data libavahi-common3 libbinutils libblkid1 libc-bin libc-dev-bin libc-l10n libc6 libc6-dbg libc6-dev libcc1-0 libegl1 libffi-dev
libgcc-8-dev libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgfortran5 libgirepository-1.0-1 libgl1 libglib2.0-0 libglvnd0 libglx0 libgnutls-dane0
libgnutls-openssl27 libgnutls30 libgomp1 libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libgudev-1.0-0 libmount1 libnih-dbus1 libnih1
libp11-kit0 libpcre2-8-0 libpython3-dev libpython3-stdlib libpython3.7 libpython3.7-dev libpython3.7-minimal libpython3.7-stdlib libselinux1 libsepol1
libstdc++-8-dev libstdc++6 libtasn1-6 libubsan1 libuuid1 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxkbcommon0 locales manpages-dev python3 python3-apt
python3-cffi-backend python3-crypto python3-dbus python3-dev python3-distutils python3-gi python3-gst-1.0 python3-lib2to3 python3-minimal python3-venv
python3.7 python3.7-dev python3.7-minimal python3.7-venv
83 upgraded, 133 newly installed, 2 to remove and 554 not upgraded.
Need to get 157 MB/159 MB of archives.
After this operation, 295 MB of additional disk space will be used.
Definitely something I’d try to use distributed compiling on multiple rPi for.
Good luck.
So I just went ahead and installed the dependencies from the bullseye repo and it was kind of a disaster in the sense that the upgrade to python3.8 pretty much wiped out my homeassistant virtual environment, but on the plus side I guess I will be doing the python3.8 upgrade I have been putting off now. For anyone else going down this road learn from my mistakes and backup your install, and it would probably be helpful to save pip freeze output as well. Also you probably don’t want to start this process at 10pm. It seems like I was finally able to get my homeassistant back to running though so it seems like it was at least a partial success. I’ll have to try building the openzwave stuff tomorrow and see how that goes.
So I have been able to get HA running by just calling the “hass” command from a shell but it seems I can not start it with systemd anymore.
53 Jun 23 01:02:09 house systemd[7851]: [email protected]: Failed to determine user credentials: No such process
54 Jun 23 01:02:09 house systemd[7851]: [email protected]: Failed at step USER spawning /srv/homeassistant/bin/hass: No such process
55 Jun 23 01:02:09 house systemd[1]: [email protected]: Main process exited, code=exited, status=217/USER
56 Jun 23 01:02:09 house systemd[1]: [email protected]: Failed with result 'exit-code'.
I suspect some of the packages I updated may have broken systemd so I think I am going to try updating that from the bullseye repo and see if that helps.
Just curious, what’s the reason for avoiding Docker? Otherwise, have you considered other options that might not be as troublesome?
Ubuntu 20.04 has an installer for Raspberry Pis and it ships with QT 5.12.8. Would there be anything preventing you from using it instead? Hopefully HA is compatible. ozwdaemon was actually using 20.04 as the container image base for a few seconds, but it’s currently not compatible with some systems so it was changed to Bullseye.
What about other container technologies like LXC or systemd-nspawn, instead of Docker?
I have to imagine running Docker adds some amount of overhead and as someone with too much time on their hands the added convenience doesn’t seem worth it in this instance. I’m mostly just curious at this point, I have been looking at getting some new hardware to run HA on so all of this will probably end up being a purely academic exercise. But I thought there might be other Luddites like me that want to run software “the old fashioned way” and perhaps they might find something of value from my trials and tribulations.
Best of luck! I totally understand the itch to solve a challenge.
I updated systemd with:
sudo apt-get upgrade -t bullseye systemd
It updated a whole bunch of other dependencies but as far as I can tell it didn’t break anything and I can start homeassistant with systemd again so I would consider that a success. I think I might be ready to try building openzwave next.
My first attempt to build qtmqtt failed with:
error: /usr/lib/gcc/arm-linux-gnueabihf/9/libatomic.so: No such file or directory
It appears I was able to fix that by installing libgcc-9-dev:
sudo apt-get install -t bullseye libgcc-9-dev
I thought that had been installed as a dependency of one of the other build packages from the Docker file but perhaps not?
I’m building open-zwave now but I am a little concerned that if I install it that it might mess up the 1.4 version home-assistant is currently using. Does anyone know if I can have both installed at the same time? I have home-assistant core installed in a virtualenv but I’m not sure where it has open-zwave installed.
Based on my find / -name libopenzwave*
on my rPi3 that I had running my core install on, it looks like the openzwave lib gets placed in /srv/homeassistant/lib/python3.7/site-packages/
YMMV with different venv directories.
It looks like I had libopenzwave.so.1.6 in /usr/local/lib, I’m guessing that was from my first attempt without QT 5.12. But I also saw libopenzwave in the site-packages for the home-assistant install so I am reasonably sure I should be safe in that regard. Thank you for the tip with the “find” command.
Some notes for myself/anyone playing along at home:
For qtmqtt and openzwave run the make install part with “sudo”.
This is probably obvious to most people but in the Docker file the line that says
COPY . /opt/qt-openzwave/
Should be accomplished with something like:
cd /opt
sudo git clone https://github.com/OpenZWave/qt-openzwave.git
Pretty much all the commands for building qt-openzwave likely need to be run with “sudo”.
I’m assuming for the qt-openzwave build I can leave out the breakpad stuff so I just ran:
/usr/lib/qt5/bin/qmake -r CONFIG+=release "BUILDNUMBER=0"
So far during my first attempt at building qt-openzwave the pi became pretty much unresponsive so I’m going to wait to proceed until I know I’ll have time to deal with the downtime, but I am cautiously optimistic since I have made it this far.
I tried building again but this time used:
make -j3
Hoping that might leave one of the pi cores available to keep home-assistant responsive while the build was going on. After about 7 hours of running it appears the build is getting stuck after printing:
compiling source/qtozwmanager.cpp
Also home-assistant still became unresponsive during that time (it looks like after about 2-3 hours based on when the darksky temperature sensor flatlined). I’m guessing I’ll have to see if I can turn up some logging for the build or something to see if I can figure out why the it seems to be getting stuck.
Likely running out for memory and the Pi is then swapping to disk (bad mojo if you’re using an SDcard).
Try a tweak, zram.
Building it on the Pi is going to be painful. Have you considered cross-compiling it?:
https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/
For now I’m avoiding the pain by jumping to zwave2mqtt. There’s nothing pleasant about having to choose between nodejs or docker on an appliance but frankly I’ll take the non-root-daemon option for now.
(@Fishwaldo why qt-mqtt? Unless you’re particularly attached to C++ it seems rather heavyweight given the use-case.)
Or grab the latest linux/arm docker image (see https://hub.docker.com/r/openzwave/ozwdaemon/tags) and extract it from that:
# latest linux/arm version from https://hub.docker.com/r/openzwave/ozwdaemon/tags
OZW=openzwave/ozwdaemon:latest@sha256:f51ed08d35d45280b3f5dccfc982d7914c27a548ca4453548b5713c6ab8ec9e8
OZW_CONT=$(docker create $OZW)
docker export $OZW_CONT > ozwdaemon.f51ed08d.tar
You’ll need raspbian 10 (buster) for glibc 2.28. I might just have a go at this now…
Well that was easy. Only needed /opt/qt
and /usr/local/bin/ozwdaemon
(maybe).
$ ozwdaemon --version
ozwdaemon 0.1.170
Documented a bit of it here: https://markferry.net/HomeAutomation.OzwDaemon
Complete lib deps:
pi@pixie3:~/.local/lib $ ldd `which ozwdaemon`
linux-vdso.so.1 (0x7ed2b000)
/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v7l.so (0x76ead000)
libopenzwave.so.1.6 => /usr/local/lib/libopenzwave.so.1.6 (0x76d08000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x76cf5000)
libresolv.so.2 => /lib/arm-linux-gnueabihf/libresolv.so.2 (0x76cd1000)
libqt-openzwave.so.1 => /opt/qt/5.12.9/lib/libqt-openzwave.so.1 (0x76be3000)
libqt-openzwavedatabase.so.1 => /opt/qt/5.12.9/lib/libqt-openzwavedatabase.so.1 (0x76bcc000)
libunwind.so.8 => /usr/lib/arm-linux-gnueabihf/libunwind.so.8 (0x76b8b000)
libcurl.so.4 => /usr/lib/arm-linux-gnueabihf/libcurl.so.4 (0x76b07000)
libQt5RemoteObjects.so.5 => /opt/qt/5.12.9/lib/libQt5RemoteObjects.so.5 (0x76ac2000)
libQt5WebSockets.so.5 => /opt/qt/5.12.9/lib/libQt5WebSockets.so.5 (0x76aab000)
libQt5Mqtt.so.5 => /opt/qt/5.12.9/lib/libQt5Mqtt.so.5 (0x76a91000)
libQt5Network.so.5 => /opt/qt/5.12.9/lib/libQt5Network.so.5 (0x769d3000)
libQt5Core.so.5 => /opt/qt/5.12.9/lib/libQt5Core.so.5 (0x766ae000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x76684000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x7653d000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x764bb000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x7648e000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x76340000)
/lib/ld-linux-armhf.so.3 (0x76f64000)
liblzma.so.5 => /lib/arm-linux-gnueabihf/liblzma.so.5 (0x7630f000)
libnghttp2.so.14 => /usr/lib/arm-linux-gnueabihf/libnghttp2.so.14 (0x762e0000)
libidn2.so.0 => /usr/lib/arm-linux-gnueabihf/libidn2.so.0 (0x762b4000)
librtmp.so.1 => /usr/lib/arm-linux-gnueabihf/librtmp.so.1 (0x7628b000)
libssh2.so.1 => /usr/lib/arm-linux-gnueabihf/libssh2.so.1 (0x76255000)
libpsl.so.5 => /usr/lib/arm-linux-gnueabihf/libpsl.so.5 (0x76235000)
libssl.so.1.1 => /usr/lib/arm-linux-gnueabihf/libssl.so.1.1 (0x761b6000)
libcrypto.so.1.1 => /usr/lib/arm-linux-gnueabihf/libcrypto.so.1.1 (0x75f9d000)
libgssapi_krb5.so.2 => /usr/lib/arm-linux-gnueabihf/libgssapi_krb5.so.2 (0x75f53000)
libkrb5.so.3 => /usr/lib/arm-linux-gnueabihf/libkrb5.so.3 (0x75e98000)
libk5crypto.so.3 => /usr/lib/arm-linux-gnueabihf/libk5crypto.so.3 (0x75e58000)
libcom_err.so.2 => /lib/arm-linux-gnueabihf/libcom_err.so.2 (0x75e45000)
libldap_r-2.4.so.2 => /usr/lib/arm-linux-gnueabihf/libldap_r-2.4.so.2 (0x75df0000)
liblber-2.4.so.2 => /usr/lib/arm-linux-gnueabihf/liblber-2.4.so.2 (0x75dd4000)
libz.so.1 => /lib/arm-linux-gnueabihf/libz.so.1 (0x75da9000)
libicui18n.so.63 => /usr/lib/arm-linux-gnueabihf/libicui18n.so.63 (0x75b5b000)
libicuuc.so.63 => /usr/lib/arm-linux-gnueabihf/libicuuc.so.63 (0x759d5000)
libicudata.so.63 => /usr/lib/arm-linux-gnueabihf/libicudata.so.63 (0x73fd7000)
libgthread-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libgthread-2.0.so.0 (0x73fc5000)
libglib-2.0.so.0 => /usr/lib/arm-linux-gnueabihf/libglib-2.0.so.0 (0x73eb5000)
libunistring.so.2 => /usr/lib/arm-linux-gnueabihf/libunistring.so.2 (0x73d39000)
libgnutls.so.30 => /usr/lib/arm-linux-gnueabihf/libgnutls.so.30 (0x73b96000)
libhogweed.so.4 => /usr/lib/arm-linux-gnueabihf/libhogweed.so.4 (0x73b57000)
libnettle.so.6 => /usr/lib/arm-linux-gnueabihf/libnettle.so.6 (0x73b13000)
libgmp.so.10 => /usr/lib/arm-linux-gnueabihf/libgmp.so.10 (0x73a9a000)
libgcrypt.so.20 => /lib/arm-linux-gnueabihf/libgcrypt.so.20 (0x739c0000)
libkrb5support.so.0 => /usr/lib/arm-linux-gnueabihf/libkrb5support.so.0 (0x739a6000)
libkeyutils.so.1 => /lib/arm-linux-gnueabihf/libkeyutils.so.1 (0x73992000)
libsasl2.so.2 => /usr/lib/arm-linux-gnueabihf/libsasl2.so.2 (0x7396b000)
libpcre.so.3 => /lib/arm-linux-gnueabihf/libpcre.so.3 (0x738f4000)
libp11-kit.so.0 => /usr/lib/arm-linux-gnueabihf/libp11-kit.so.0 (0x737ef000)
libtasn1.so.6 => /usr/lib/arm-linux-gnueabihf/libtasn1.so.6 (0x737cf000)
libgpg-error.so.0 => /lib/arm-linux-gnueabihf/libgpg-error.so.0 (0x737a5000)
libffi.so.6 => /usr/lib/arm-linux-gnueabihf/libffi.so.6 (0x7378d000)