catkin
catkin copied to clipboard
switch from `cmi` to `cmi --install` results in <dependency>_DIR to still refer to devel-space instead of install-space
When running catkin_make using the --install switch after changing a packages CMakeLists.txt on a already built workspace, dependencies's _DIR variables will still be pointing to the devel-space
Steps to reproduce:
- Set up a clean workspace for the ros_comm packages:
rosinstall_generator ros_comm kinetic --deps --wet-only --tar > test.rosinstall wstool init -j8 src test.rosinstall
- Build without --install switch:
./src/catkin/bin/catkin_make_isolated
- Modify src/ros_comm_msgs/rosgraph_msgs/CMakeLists.txt (e.g. add a message call)
- Build with install-switch:
./src/catkin/bin/catkin_make_isolated --install
The second build will fail when trying to build rosgraph_msgs. The reason is that the install-space
When running catkin_make using the --install ...
I assume you mean catkin_make_isolated
here?
I am assuming the second build doesn't run cmake
for the rosgraph_msgs
package. Can you confirm that in the output? Can you please try to also pass --force-cmake
on the invocation with --install
and comment if that fixes the problem.
You're right, I call catkin_make_isolated. The second run does not invoke the std_msgs cmake again, only for rosgraph_msgs. Calling it with --force-cmake though did not fix the problem, I still get the same error message.
Modify src/ros_comm_msgs/rosgraph_msgs/CMakeLists.txt (e.g. add a message call)
Can you please describe exactly what you do in this step.
I changed it to:
cmake_minimum_required(VERSION 2.8.3)
project(rosgraph_msgs)
find_package(catkin REQUIRED COMPONENTS message_generation std_msgs)
message(foo)
add_message_files(DIRECTORY msg
FILES
Clock.msg
Log.msg
TopicStatistics.msg)
generate_messages(DEPENDENCIES std_msgs)
catkin_package(CATKIN_DEPENDS message_runtime std_msgs)
Ok, the added message()
call already implies a CMake reconfigure invocation. So the same problem happens without the change when invoking catkin_make_isolated --force-cmake --install
for the second build.
What happens is that on the first run CMake find std_msgs
in .../devel_isolated/std_msgs/share/std_msgs/cmake
. On the second build it won't search for it again since the CMake cache still contains that location. That is why it fails.
The build tool would need to detect the switch between not using --install
and using --install
and then go through the CMake cache and remove potentially problematic entries. While that would be possible I am not sure if it will be implemented in the future.
Therefore I can only recommend that you have to remove your CMake cache files when switching to --install
(or more extremely remove the build and devel space completely). Sorry for not having a better answer for you.
Okay, the bug is not too annoying anyway, at least now I know its reason.
As a point of comparison, catkin build
will detect when you move from --no-install
to --install
(or vice versa) and refuse to build, suggesting you clean your build and devel space before continuing.