Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export header in devel/include #832

Closed
ClementLeBihan opened this issue Oct 4, 2021 · 12 comments
Closed

Export header in devel/include #832

ClementLeBihan opened this issue Oct 4, 2021 · 12 comments

Comments

@ClementLeBihan
Copy link

ClementLeBihan commented Oct 4, 2021

Hi,

I'm trying to use jsk_rviz_plugins objects in an other package, but headers are not found.

To reproduce the error, pull jsk_visualization repo in an empty catkin workspace, launch catkin_make and checkout in devel/include/jsk_rviz_plugins, there is no bounding_box_display_common.h for example.

If I want to use these header from an other package (#include <jsk_rviz_plugins/bounding_box_display_common.h>), what should I do in jsk_rviz_plugins CMakeLists to export headers ?

Thank you for your help,

Best,
Clément

@k-okada
Copy link
Member

k-okada commented Oct 5, 2021

@ClementLeBihan

can you try

$ git diff
diff --git a/jsk_rviz_plugins/CMakeLists.txt b/jsk_rviz_plugins/CMakeLists.txt
index cd771db..6d502c4 100644
--- a/jsk_rviz_plugins/CMakeLists.txt
+++ b/jsk_rviz_plugins/CMakeLists.txt
@@ -49,7 +49,7 @@ catkin_package(
     DEPENDS rviz
     CATKIN_DEPENDS jsk_hark_msgs jsk_footstep_msgs
     jsk_recognition_utils cv_bridge people_msgs image_geometry
-    INCLUDE_DIRS # TODO include
+    INCLUDE_DIRS src
     LIBRARIES ${PROJECT_NAME}
 )
 

???

@ClementLeBihan
Copy link
Author

ClementLeBihan commented Oct 5, 2021

Hi @k-okada and thanks for your answer !

I tryied but it doesn't work. Did it worked on your side ?

Best,
Clément

@k-okada
Copy link
Member

k-okada commented Oct 5, 2021 via email

@ClementLeBihan
Copy link
Author

ClementLeBihan commented Oct 5, 2021

You don't necessary need to create a package, just execute this :

cd catkin_ws/src/
git clone https://github.com/jsk-ros-pkg/jsk_visualization.git
cd ../
catkin_make

Then checkout in devel/include/jsk_rviz_plugins, you won't see bounding_box_display_common.h for example ...

@k-okada
Copy link
Member

k-okada commented Oct 5, 2021 via email

@ClementLeBihan
Copy link
Author

Here is an example with a test package :

catkin_create_pkg test roscpp jsk_rviz_plugins
nano src/test/src/test_node.cpp

Use this hello world code :

#include <jsk_rviz_plugins/bounding_box_display_common.h>

#include <iostream>
#include <iomanip>
#include <cstdlib>
 
int main(int argc, char *argv[])
{
	std::cout << "Hello world ! " << std::endl;
	return 0;
}

and uncomment add_executable(${PROJECT_NAME}_node src/test_node.cpp) in CMakeLists.

When catkin_make is executed, you'll have fatal error: jsk_rviz_plugins/bounding_box_display_common.h: No such file or directory

@knorth55
Copy link
Member

knorth55 commented Oct 5, 2021

it seems devel does not work well with src/*.h style + catkin_package INCLUDE_DIRS, but install probably works.
https://github.com/jsk-ros-pkg/jsk_visualization/blob/master/jsk_rviz_plugins/CMakeLists.txt#L237-L240

How about building the workspace with install like catkin config --install? or using released jsk_rviz_plugins?

$ ls /opt/ros/melodic/include/jsk_rviz_plugins/bounding_box_* -alF
-rw-r--r-- 1 root root  3480 10月 17  2020 /opt/ros/melodic/include/jsk_rviz_plugins/bounding_box_array_display.h
-rw-r--r-- 1 root root  3432 10月 17  2020 /opt/ros/melodic/include/jsk_rviz_plugins/bounding_box_display.h
-rw-r--r-- 1 root root 15849 10月 17  2020 /opt/ros/melodic/include/jsk_rviz_plugins/bounding_box_display_common.h

Anyway, we should make jsk_rviz_plugins/include/jsk_rviz_plugins/ directory and move all the headers to solve this issue if you still want to use devel workspace.

@ClementLeBihan
Copy link
Author

Yes I know release package put the header in include directory, but I wanted to make it works by using source package in catkin workspace.

Does'nt seems to work with catkin config --install neither.

@knorth55
Copy link
Member

knorth55 commented Oct 5, 2021

sudo apt update
sudo apt install python-catkin-tools
mkdir test_ws/src -p
cd test_ws/src
git clone https://github.com/jsk-ros-pkg/jsk_rviz_plugins.git
cd ../
catkin config --install
catkin build
# source not devel but install
source install/setup.bash

it works for me.

[knorth55][melodic-p50][/tmp/test_ws/install/include/jsk_rviz_plugins]
$ ls -alF bounding*
-rw-r--r-- 1 knorth55 knorth55  3480 10月  5 23:35 bounding_box_array_display.h
-rw-r--r-- 1 knorth55 knorth55  3432 10月  5 23:35 bounding_box_display.h
-rw-r--r-- 1 knorth55 knorth55 15849 10月  5 23:35 bounding_box_display_common.h

@k-okada
Copy link
Member

k-okada commented Oct 6, 2021

@ClementLeBihan please check if #833 solves your problem.

Does'nt seems to work with catkin config --install neither.

please put error code when you have problem. Is it something like

[test:make] In file included from /tmp/hoge/install/include/jsk_rviz_plugins/bounding_box_display_common.h:42:0,
[test:make]                  from /tmp/hoge/src/test/src/test_node.cpp:1:
[test:make] /opt/ros/melodic/include/rviz/properties/color_property.h:32:10: fatal error: QColor: No such file or directory
[test:make]  #include <QColor>
[test:make]           ^~~~~~~~

???
in this case, you need to add

  find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED)
  include(${QT_USE_FILE})

or

  find_package(Qt5Widgets REQUIRED)

on your CMakeLists.txt of your test package.
#833 does not need to child package to set something like this, but not sure if this is right design....

@ClementLeBihan
Copy link
Author

Yes it solves my problem :)

Thank you for your quick support !

Best,
Clément

@knorth55
Copy link
Member

knorth55 commented Oct 6, 2021

oh, i just checked the header file in install and didn't check the qt build.
#833 looks quite interesting such as -fPIC flag...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants