cmauri / eviacam

webcam based mouse emulator
GNU General Public License v3.0
145 stars 38 forks source link

GTK-3 support ? #14

Open kyrios123 opened 6 years ago

kyrios123 commented 6 years ago

Hello,

Is there any plan for supporting gtk-3 ? We are considering retiring wxWidgets gtk-2 build and eviacam is one of the only blocker.

Thank you !

cmauri commented 6 years ago

Hi! Solus distro? Who is the maintainer of the package? Did you try building eViacam against wxWidgets gtk-3 build?

Thanks!

kyrios123 commented 6 years ago

yes I did, that's why I made this request

cmauri commented 6 years ago

Added support for gtk+-3 in commit 6cd6ea9e51eb7ad128b885e682217e413e4b6bde

kyrios123 commented 6 years ago

I confirm it builds successfully with the patch. I will do some testing during the coming days.

kyrios123 commented 6 years ago

Hello,

I get the following error when launching the patched version (of course I did replace gtk2 libs with gtk3 libs and I used a gtk3 build of wxwidgets)

(eviacam:3978): Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Trace/breakpoint trap
cmauri commented 6 years ago

Hello,

I tried the following on a clean chrooted ubuntu artful installation:

$ dpkg -l | grep -E "gtk|opencv|wx" (no results)

$ sudo apt-get install libopencv-dev (this command installs around 350 packages)

$ dpkg -l | grep -E "gtk"

ii  gtk-update-icon-cache           3.22.24-0ubuntu1                  amd64       
ii  libgtk-3-0:amd64                3.22.24-0ubuntu1                  amd64 
ii  libgtk-3-bin                    3.22.24-0ubuntu1                  amd64  
ii  libgtk-3-common                 3.22.24-0ubuntu1                  all 

libopencv installs libgtk-3.0 because some modules have dependencies on it. I only had to manually install libgtk-3-dev $ sudo apt-get install libgtk-3-dev

To install wxWidgets I used the latest stable tarball for linux. I configured it to use gtk-3 and compiled manually:

./configure --with-gtk=3
make
sudo make install
sudo ldconfig

Finally, I managed to build (from commit a598ace5a8637a8b69bbea19acf21bb05eff5853) and run eviacam without issues. These are the steps I followed:

./autogen.sh
./configure --prefix=/usr/local
make
sudo make install
eviacam

However, when installing wxWidgets from ubuntu repository, i.e.: $ sudo apt-get install libwxgtk3.0-dev eviacam build fails with:

In file included from /usr/include/gtk-3.0/gdk/gdkapplaunchcontext.h:30:0,
                 from /usr/include/gtk-3.0/gdk/gdk.h:32,
                 from /usr/include/gtk-3.0/gdk/gdkx.h:28,
                 from wxappbar.cpp:46:
/usr/include/gtk-3.0/gdk/gdktypes.h:143:39: error: conflicting declaration 'typedef struct _GdkWindow GdkWindow'
 typedef struct _GdkWindow             GdkWindow;
                                       ^~~~~~~~~
In file included from /usr/include/wx-3.0/wx/wxprec.h:12:0,
                 from wxappbar.cpp:24:
/usr/include/wx-3.0/wx/defs.h:3466:33: note: previous declaration as 'typedef struct _GdkDrawable GdkWindow'
     typedef struct _GdkDrawable GdkWindow;
                                 ^~~~~~~~~

Checking the wxWidgets version shipped with artful:

$ wx-config --selected-config 
gtk2-unicode-3.0

it is clear that has been built against gtk-2. In fact, there is an open bug in ubuntu launchpad about this: https://bugs.launchpad.net/ubuntu/+source/wxwidgets3.0/+bug/1394031

Furthermore, when running the eviacam version shipped with artful I also get:

Gtk-ERROR **: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Trace/breakpoint trap

In summary, @kyrios123 make sure that both libopencv and wxWidgets are build against gtk-3 and that no other libraries add dependencies to gtk-2.

It seems also that recent versions of debian (strech) and ubuntu (artful) provide wxWidgets built against gtk-2 and libopencv against gtk-3 and thus, software that need both libraries will probably crash with the same error.

kyrios123 commented 6 years ago

Thanks for this very useful feedback! Indeed, I see our opencv currently uses gtk-2 libraries.

kyrios123 commented 6 years ago

We are currently testing the gtk3 vs gtk2 builds and the following issue has been reported: Takes forever getting the webcam via v4l

JoshStrobl commented 6 years ago

When launching from the Terminal, it starts my webcam, turns it back off, and then provides an index error. It cycles through 9 indexes until it gets to my webcam (the only video device I have), then starts the OpenCL runtime.

VIDEOIO ERROR: V4L: index 1 is not correct!
VIDEOIO ERROR: V4L: index 2 is not correct!
VIDEOIO ERROR: V4L: index 3 is not correct!
VIDEOIO ERROR: V4L: index 4 is not correct!
VIDEOIO ERROR: V4L: index 5 is not correct!
VIDEOIO ERROR: V4L: index 6 is not correct!
VIDEOIO ERROR: V4L: index 7 is not correct!
VIDEOIO ERROR: V4L: index 8 is not correct!
VIDEOIO ERROR: V4L: index 9 is not correct!
[ INFO:1] Initialize OpenCL runtime...
cmauri commented 6 years ago

Try applying the following patch. It basically disables multiple camera detection: patch.diff.gz

JoshStrobl commented 6 years ago

@cmauri Applied patch, did a local build, same behavior as my previous comment. Here's an strace if it's any help. Webcam is a Logitech HD Pro Webcam C920.

eviacam_strace.txt (~2.6MB)

cmauri commented 6 years ago

output.txt @JoshStrobl also applied the patch and, for me, this only opens the camera once. Here is the output of eviacam when running with the debug flag enabled:

./eviacam --debug

Could you please run also in debug mode and attach the output?

Remember that you should clone the devel branch and apply the patch on top of it.

Clement-TS commented 5 years ago

I there, I have this same issue using eviacam on a Ubuntu 18.04 desktop (was working on 16.04):

(eviacam:23589): Gtk-ERROR **: 16:01:44.053: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Trace/breakpoint trap

Is this fixed within the devel branch? Are there .deb available with any fix on that? Thank you

kyrios123 commented 5 years ago

@Clement-TS yes look at the detailed explanation here. TL;DR make sure that wxWidgets and openCV are built against the same version of GTK+ than eviacam

cmauri commented 5 years ago

Revisiting this issue in May 2019, it seems that since Debian 10 and Ubuntu 18.10 this issue should have been fixed. Package libwxgtk3.0-gtk3-0v5 was added to the distro and the eviacam dependencies were fixed.

However, for previous Debian and Ubuntu releases, and other distributions based on such older versions (for instance, Linux Mint 19) ship with a broken eviacam package. In this case, you might find useful the installation script written by @Cat5TV and the Episode 607 of his Category5 Technology TV.

Daniel78ar commented 5 years ago

Good afternoon. Well, in my case, I solve the issue with the next steps. Install viacam from synaptic. First download wxwidgets 3.1.2 from wxwidgetx.org and unzip and install with sudo ./configure in a console (konsole or tilix) make and make install. After this download the viacam from the source from https://eviacam.crea-si.com/index_es.php (codigo fuente/source code 2.1.1 or new). Install in synaptics the next files gtk2-dev libopencv-dev because the dependencies requeriments from evince. After this Unzip the file in the personal folder that you need to indicate the eviacam folder, and when installing it do the following: sudo ./configure and then make -i and make install -i, to ignore the errors. This is because the versions of wxwidgets and eviacam are updated when you install the files from compilation process. The next thing is to go to https://packages.ubuntu.com/eoan/eviacam, download the file en deb format and install with gdebi gtk or in a console (gdebi *.deb or eviacam) and install the file. This solve the issue. I test the program eviacam and works in ubuntu 18.04!

wibcode commented 3 years ago

Good evening, after installing I get the following error: eviacam: /usr/local/lib/libwx_gtk3u_core-3.0.so.0: version `WXU_3.0.5 'not found (required by eviacam)

how could i solve it, thanks