craigcabrey / luminance

A Philips Hue client for Linux written in Python and GTK+.
https://craigcabrey.github.io/luminance/
GNU General Public License v2.0
155 stars 25 forks source link

Hard to compile under Ubuntu 16.04 #14

Open mariohock opened 8 years ago

mariohock commented 8 years ago

The code is hard to compile under Ubuntu 16.04.

First of all, there is the dependency to GTK 3.20. Ubuntu ships with 3.18.1. Since it was stated that "earlier versions may work" I wanted to give it a try and changed the requirements in the configure file.

After installing some further dependencies (gsettings-desktop-schemas-dev, libgtk-3-dev, python-gobject-dev), I'm faced with another problem:

""" $ ./configure [...] checking for python3 script directory... File "", line 6 import sysconfig ^ IndentationError: expected an indented block [...] ./configure: line 2646: GLIB_GSETTINGS: command not found """

Any hints how to make it run under Ubuntu 16.04?

craigcabrey commented 8 years ago

Looks like this is a problem from autotools. Can you upload the configure script to a pastebin and link it here?

mariohock commented 8 years ago

http://pastebin.com/3N1rzkqM

craigcabrey commented 8 years ago

Lines 2538-2550 clearly show the problem. I'm just not sure why the configure script would be generated like that on Ubuntu. I'm spinning up a 16.04 VM to see if it's reproducible.

craigcabrey commented 8 years ago

I was not able to reproduce this problem on Ubuntu 16.04. Can you tell me precisely what you changed in configure.ac?

Here are my changes:

diff --git a/configure.ac b/configure.ac
index 8315111..7e6ccca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11,9 +11,9 @@ AM_PATH_PYTHON([3.5])

 GLIB_GSETTINGS

-DESKTOP_SCHEMAS_REQUIRED_VERSION=3.20.0
-GTK_REQUIRED_VERSION=3.20.0
-PYGOBJECT_REQUIRED_VERSION=3.20.1
+DESKTOP_SCHEMAS_REQUIRED_VERSION=3.18.0
+GTK_REQUIRED_VERSION=3.18.0
+PYGOBJECT_REQUIRED_VERSION=3.20.0

 PKG_CHECK_MODULES([GSETTINGS_DESKTOP_SCHEMAS], [gsettings-desktop-schemas >= $DESKTOP_SCHEMAS_REQUIRED_VERSION])
 PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= $GTK_REQUIRED_VERSION])
mariohock commented 8 years ago

Interesting. These were my changes, too. However, rerunning autogen.sh results in a completely different configure script. It has to be because of the missing dependencies that I installed after running autogen.sh. (Since I identified the missing dependencies, based on the error messages of the configure script.)

Now, it compiles!

I had to change the required GTK version in data/ui/*.ui to avoid errors like: """ builder.add_from_resource(get_resource_path('ui/about.ui')) GLib.Error: gtk-builder-error-quark: .:5:1 Required gtk+ version 3.20, current version is 3.18 (7) """ Note: One has to change the ui-files before compiling!

However, saving the files with glade 3.18 throws an error on some files, so I'm not quite sure if it will work...

I managed to come to the "setup" screen, but the autodetection of the bridge didn't work. I have to get back to it later, in order to check the bridge (pressing the setup button, etc.)

craigcabrey commented 8 years ago

Ah, yes, you'll have to change the XML to the correct GTK version as well. Don't forget to re-run make after modifying them.

I setup the repository such that you can run the application without installing it, from the repository root run ./bin/luminance after ./configure && make. You should see "Using local data" appear in the terminal (definitely let me know if that's not the case).

As for the bridge, I added a few dependencies that I forgot to list on the README (I have now, though) so that might be it.

craigcabrey commented 8 years ago

@mariohock let me know when you get it working. If you don't see anything out of the ordinary ui-wise, I'll bump the GTK requirement down to 3.18.

mariohock commented 8 years ago

Yes! I could get it to run. Thank you very much for your help.

Unecpectedly the hue bridge uses a link local IPv4 address (169.254.X.X), I always tried its "regular" address that I got from the Wifi router but didn't get any ARP replys.

I found out the link local address by manually running "python3 -m netdisco". Though, automatic discovery didn't work in luminance..

By the way, as far as I know, I have a second generation Hue bridge (the "square" one).

p.s. The "burger-like" menu button opens only an empty "bubble" (terminal output: "(luminance:8502): Gtk-WARNING **: Child name 'main' not found in GtkStack").

Otherwise the UI seems functional. Do you have a list of features that I should check?

craigcabrey commented 8 years ago

I think I know why it didn't discover your bridge. Can you go to this link and tell me if there's anything? Other then []. That's Philip's automatic discovery system. I use that then fallback to local scanning.

I'm aware that the burger menu doesn't do anything at the moment. That'll come last. As for features, at this point just make sure that all lights appear as expected, you can turn them on/off, change color, brightness, rename them, etc.

The application will be a little laggy since I haven't moved the operations off to a separate thread yet, so that's to be expected.

Thanks for checking this out.

mariohock commented 8 years ago

Only "[]" at this link. I use my hue system only locally, I don't have any hue account, or something like that.

Yes, all lights appear as expected, I can turn them on/off, change color, brightness; didn't try to rename them, though. The Firmware update button for the bridge doesn't seem to work, though.

Also, there are no timers or fading settings, but I guess that's no UI bug, but just not implemented (yet).

craigcabrey commented 8 years ago

772e9f1 should fix your discovery problem.

To test it, backup your username (or don't it doesn't matter too much) and clear it out:

gsettings set com.craigcabrey.luminance username ''

or, if you're running it from the repository directly:

gsettings --schemadir data set com.craigcabrey.luminance username ''

leitao commented 7 years ago

I just got upstream (d4b03836cbfe57b3f6d40298d96be9631e3aea35), which contains 772e9f1eb3ae02085b4e090cbf7ec2183641777e and it is still failing in the same way on Debian testing.

I found that this problem is caused if you do not have the package libglib2.0-dev. Install it before 'autogening' the package.

PanderMusubi commented 5 years ago

See also https://github.com/craigcabrey/luminance/issues/30