jimjibone / goopenzwave

Go bindings for the openzwave library.
MIT License
13 stars 6 forks source link

Use system OZW installation #22

Closed jimjibone closed 5 years ago

jimjibone commented 6 years ago

As suggested in #21, switch to a system installation of OZW.

Original reason to bundle OZW as a submodule was to use a fixed version with goopenzwave, however this is not necessary as recent releases of OZW have shown to be backwards compatible.

Using an up-to-date system installation of OZW would be preferable as this library will benefit from the improvements and it can share configuration, etc. with other OZW based software such as the open-zwave-control-panel.

ghost commented 6 years ago

Hi, I tried using the standard OZW installation and had success by changing goopenzwave_linux.go as follows: `package goopenzwave

// #cgo LDFLAGS: -lopenzwave // #cgo CFLAGS: -I/usr/include/openzwave -I/usr/local/include // #cgo CPPFLAGS: -I/usr/include/openzwave -I/usr/local/include import "C" ` Some notes:

jimjibone commented 6 years ago

Thanks for the info! No problem about not doing a PR. I'll take a look at this and make it at least compatible with linux and macos. Things get more complicated with Windows... and actually might be easier by keeping the submodule.

What version of OpenZwave were you using by the way? Installation via the package manager or manual installation from source?

jimjibone commented 6 years ago

Here's my initial version using pkg-config, tested on macos: https://github.com/jimjibone/goopenzwave/tree/22-use-system-ozw-installation

ghost commented 6 years ago

The package manager version was used. Both libopenzwave and header files are needed. Ubuntu:

libopenzwave1.5/bionic,now 1.5+ds-5 amd64 [installed,automatic] API to use a Z-Wave controller libopenzwave1.5-dev/bionic,now 1.5+ds-5 amd64 [installed] header files for the openzwave library

Raspbian:

libopenzwave1.5/stable,now 1.5+ds-4 armhf [installed] API to use a Z-Wave controller libopenzwave1.5-dev/stable,now 1.5+ds-4 armhf [installed] header files for the openzwave library

jimjibone commented 6 years ago

Ahh right ok. Shame that the packages don't contain pkg-config files...

I'll try out the package manager version with my Pi.

Unfortunately homebrew on macos ships an old version of the library -- looks like it's mostly due to people running into the same build issues that we've seen before, asking open-zwave for the fix, not getting any response and then the PRs being closed after a load of hard work...

I'd like to switch to the package manager version completely.

jimjibone commented 6 years ago

Ok, just tested out the apt version of openzwave on Raspbian Jessie (v1.5) and it looks like it has installed a fairly old version of the device XML files! Some of my devices have not been correctly recognised annoyingly.

So I think for now I'm going to have to recommend an installation from source, unfortunately. At least that way you get an up-to-date device database, pkg-config files and latest set of features. Hopefully that doesn't include the latest set of bugs too...