ros / ros-overlay

Gentoo Overlay for ROS packages
33 stars 30 forks source link

image_view does not build, cant find GTK2 on Gentoo Prefix #607

Open awesomebytes opened 6 years ago

awesomebytes commented 6 years ago

If using

-DGTK2_GDKCONFIG_INCLUDE_DIR=/tmp/gentoo/usr/lib64/gtk-2.0/include 
-DGTK2_GLIBCONFIG_INCLUDE_DIR=/tmp/gentoo/usr/lib64/glib-2.0/include

It finds it...

The first warning:

-- Some or all of the gtk libraries were not found. (missing: GTK2_GDKCONFIG_INCLUDE_DIR GTK2_GLIBCONFIG_INCLUDE_DIR)

And then I get:

[ 58%] Building CXX object image_view/CMakeFiles/image_view_exe.dir/src/nodes/image_view.cpp.o
/home/rosuser/catkin_ws/src/image_view/src/nodelets/image_nodelet.cpp:46:10: fatal error: gtk/gtk.h: No such file or directory   
 #include <gtk/gtk.h>
          ^~~~~~~~~~~
compilation terminated.
make[2]: *** [image_view/CMakeFiles/image_view.dir/build.make:63: image_view/CMakeFiles/image_view.dir/src/nodelets/image_nodelet.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/home/rosuser/catkin_ws/src/image_view/src/nodelets/disparity_nodelet.cpp:42:10: fatal error: gtk/gtk.h: No such file or directory
 #include <gtk/gtk.h>
          ^~~~~~~~~~~
compilation terminated.
make[2]: *** [image_view/CMakeFiles/image_view.dir/build.make:76: image_view/CMakeFiles/image_view.dir/src/nodelets/disparity_nodelet.cpp.o] Error 1
/home/rosuser/catkin_ws/src/image_view/src/nodes/stereo_view.cpp:53:10: fatal error: gtk/gtk.h: No such file or directory
 #include <gtk/gtk.h>
          ^~~~~~~~~~~

@allenh1 this lib64 thing may be familiar to you?

allenh1 commented 6 years ago

@awesomebytes It appears to be using the wrong (well, on Gentoo at least) include directory. I'll patch it up right away.

awesomebytes commented 5 years ago

Hello, I'm the phantom from the past, and here I come again with the same error haha:

-- Some or all of the gtk libraries were not found. (missing: GTK2_GDKCONFIG_INCLUDE_DIR GTK2_GLIBCONFIG_INCLUDE_DIR) 

...

/home/user/gentoo/var/tmp/portage/ros-kinetic/image_view-1.12.23/work/image_view-1.12.23/src/nodelets/disparity_nodelet.cpp:42:10: fatal error: gtk/gtk.h: No such file or directory
 #include <gtk/gtk.h>
          ^~~~~~~~~~~

But it's there (as the last time):

$ find /tmp/gentoo/ -name "gtk.h"
/tmp/gentoo/usr/include/gtk-3.0/gtk/gtk.h
/tmp/gentoo/usr/include/gtk-2.0/gtk/gtk.h
allenh1 commented 5 years ago

@awesomebytes the issue here is that normal distros don't install gtk this way.

I'd try patching the CMakeLists.txt file to add

set(GTK2_GDKCONFIG_INCLUDE_DIR ${EPREFIX%/}/usr/include/gtk-2.0)
awesomebytes commented 5 years ago

Made a patch: https://gist.github.com/awesomebytes/8371eaefc0513fd538e08b14748cc814

Workarounding locally with:

mkdir -p $EPREFIX/etc/portage/patches/ros-kinetic/image_view
cd  $EPREFIX/etc/portage/patches/ros-kinetic/image_view
wget https://gist.githubusercontent.com/awesomebytes/8371eaefc0513fd538e08b14748cc814/raw/d46e3be3205570709ed573cd1e568025153c0b0f/0001-force-to-find-gtk.patch

And it builds. I'll need to have a different patch for x86 tho as it's not lib64 but just lib there...

allenh1 commented 5 years ago

@awesomebytes that's definitely true!

I'd do something like that suggested here.

include(CheckTypeSize)
check_type_size(long LONG_SIZE)
awesomebytes commented 5 years ago

So... After that I do an If-else with 4 and 8 as values to either do one thing or the other? Hmmm ok, but it looks pretty ugly. Wouldn't it be better to check some uname -m thing? I think CMake has some variables with it already ready to use.