ROS catkin_make: rebuild package(s) - cmake

I found out that I incorrectly named a dependency "std_msgs" as "std_msg".
So I fixed!, but wait, catkin still thinks that lawnbot_description is wants "std_msg" as a dependency even though I fixed the dependency:
<?xml version="1.0"?>
<package format="2">
<name>lawnbot_description</name>
<version>0.0.0</version>
<description>The lawnbot_description package</description>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_export_depend>roscpp</build_export_depend>
<build_export_depend>rospy</build_export_depend>
<build_export_depend>std_msgs</build_export_depend>
<exec_depend>roscpp</exec_depend>
<exec_depend>rospy</exec_depend>
<exec_depend>std_msgs</exec_depend>
Error output when doing catkin_make --force-cmake:
Base path: /home/josiah/PycharmProjects/lawnbot_ws
Source space: /home/josiah/PycharmProjects/lawnbot_ws/src
Build space: /home/josiah/PycharmProjects/lawnbot_ws/build
Devel space: /home/josiah/PycharmProjects/lawnbot_ws/devel
Install space: /home/josiah/PycharmProjects/lawnbot_ws/install
####
#### Running command: "make cmake_check_build_system" in
"/home/josiah/PycharmProjects/lawnbot_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/josiah/PycharmProjects/lawnbot_ws/devel
-- Using CMAKE_PREFIX_PATH: /opt/ros/kinetic
-- This workspace overlays: /opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/josiah/PycharmProjects/lawnbot_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.6
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 8 packages in topological order:
-- ~~ - turtlebot3 (metapackage)
-- ~~ - turtlebot3_bringup
-- ~~ - turtlebot3_slam
-- ~~ - lawnbot_description
-- ~~ - lawnbot_gazebo
-- ~~ - turtlebot3_navigation
-- ~~ - turtlebot3_teleop
-- ~~ - turtlebot3_description
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin metapackage: 'turtlebot3'
-- ==> add_subdirectory(turtlebot3/turtlebot3)
-- +++ processing catkin package: 'turtlebot3_bringup'
-- ==> add_subdirectory(turtlebot3/turtlebot3_bringup)
-- +++ processing catkin package: 'turtlebot3_slam'
-- ==> add_subdirectory(turtlebot3/turtlebot3_slam)
-- +++ processing catkin package: 'lawnbot_description'
-- ==> add_subdirectory(lawnbot_description)
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:76 (find_package):
Could not find a package configuration file provided by "std_msg" with any
of the following names:
std_msgConfig.cmake
std_msg-config.cmake
Add the installation prefix of "std_msg" to CMAKE_PREFIX_PATH or set
"std_msg_DIR" to a directory containing one of the above files. If
"std_msg" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
lawnbot_description/CMakeLists.txt:10 (find_package)
-- Could not find the required component 'std_msg'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "std_msg" with any
of the following names:
std_msgConfig.cmake
std_msg-config.cmake
Add the installation prefix of "std_msg" to CMAKE_PREFIX_PATH or set
"std_msg_DIR" to a directory containing one of the above files. If
"std_msg" provides a separate development package or SDK, be sure it has
been installed.
Call Stack (most recent call first):
lawnbot_description/CMakeLists.txt:10 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/josiah/PycharmProjects/lawnbot_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/josiah/PycharmProjects/lawnbot_ws/build/CMakeFiles/CMakeError.log".
Makefile:290: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
It still thinks that the lawnbot_description package wants "std_msg". Why is this so hard? It cant be this complicated to modify package information and update it.
I have found that there is a package called : catkin_tools clean, but why should I have to download an extra package to simply update my workspace?
I have tried:
-catkin_make
-catkin_make --force-cmake
- I have seen solutions that involve deleting entire build/devel directories which horrifies me. That seems like a ton of work just to add an 's' to the end of a name
I am worried that catkin clean lawnbot_description will just delete the entire package. Is this my best option?
Local lawnbot_description cmake file:
cmake_minimum_required(VERSION 2.8.3)
project(lawnbot_description)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msg # I am not supposed to edit this right??? I tried editing and it still does not work
)

I found that editing the CMakeLists fixes the problem. However it is annoying that I need to change the package.xml and the CMakeLists to indicate a change in dependencies.
I thought that if I fix the package.xml the CMakeLists would be updated.
So future reference, edit the CMakeLists in your package to reflect changes made to the package. catkin_make will not do this for you it seems.
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msg
)
Should be:
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
)
Along with updating the package.xml

Related

Could NOT find LibSystemd (missing: SYSTEMD_UNIT_DIR) seen while using cmake

CMake complains about "No package 'systemd' found" though I have installed systemd on docker container of Ubuntu 20.04. Why cmake is not able to detect the installed pkg
root#e8208b70072e:/opt/dev/sysrepo/build# cmake ..
-- ietf-yang-library revision: 2019-01-04
-- Sysrepo repository: /etc/sysrepo
-- Startup data path: /etc/sysrepo/data
-- Notification path: /etc/sysrepo/data/notif
-- YANG module path: /etc/sysrepo/yang
-- SR plugins path: /usr/local/lib/sysrepo/plugins
-- SRPD plugins path: /usr/local/lib/sysrepo-plugind/plugins
Package systemd was not found in the pkg-config search path.
Perhaps you should add the directory containing `systemd.pc'
to the PKG_CONFIG_PATH environment variable
No package 'systemd' found
-- Could NOT find LibSystemd (missing: SYSTEMD_UNIT_DIR)
CMake Warning at CMakeLists.txt:349 (message):
Disabling sysrepo-plugind systemd support because libsystemd was not found.
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/dev/sysrepo/build
Installed files can be seen below
root#e8208b70072e:/opt/dev# find / -name *libsystemd*
/var/lib/dpkg/info/libsystemd0:amd64.md5sums
/var/lib/dpkg/info/libsystemd0:amd64.shlibs
/var/lib/dpkg/info/libsystemd0:amd64.symbols
/var/lib/dpkg/info/libsystemd0:amd64.list
/var/lib/dpkg/info/libsystemd0:amd64.triggers
/var/lib/dpkg/info/libsystemd-dev:amd64.md5sums
/var/lib/dpkg/info/libsystemd-dev:amd64.list
/usr/share/doc/libsystemd0
/usr/share/doc/libsystemd-dev
/usr/lib/x86_64-linux-gnu/libsystemd.so.0
/usr/lib/x86_64-linux-gnu/libsystemd.so.0.28.0
/usr/lib/x86_64-linux-gnu/libsystemd.so
/usr/lib/x86_64-linux-gnu/pkgconfig/libsystemd.pc

Cmake when building LLVM

Trying to build llvm project LLVM Project with CMake, it gives me an error that I can't solve by my own.
For doing this, I am using an Ubuntu Virtual Machine (version 18.04) and I am trying to build the project with "ninja".
I have tried to build this with the following commands (which the LLVM Builder Guide says to use, https://llvm.org/docs/GettingStarted.html)
git clone https://github.com/llvm/llvm-project.git
cd llvm-project/
mkdir build && cd build
cmake -DLLVM_ENABLE_PROJECTS='all' -DCMAKE_BUILD_TYPE=Release -G 'Ninja' ../llvm
At the last command, I use the first flag to download all the projects and the second because I do not need the Debug tools.
The last command gives me the following error several times with different targets:
CMake Error at /usr/share/cmake-3.10/Modules/ExternalProject.cmake:2759 (get_property):
get_property could not find TARGET llgo. Perhaps it has not yet been
created.
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/ExternalProject.cmake:3032 (_ep_add_configure_command)
/home/enrique/Escritorio/llvm-project/llgo/CMakeLists.txt:200 (externalproject_add)
/home/enrique/Escritorio/llvm-project/llgo/CMakeLists.txt:219 (add_libgo_variant)
And this library error:
-- LLD version: 10.0.0
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find LibEdit (missing: libedit_INCLUDE_DIRS libedit_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/home/enrique/Escritorio/llvm-project/lldb/cmake/modules/FindLibEdit.cmake:54 (find_package_handle_standard_args)
/home/enrique/Escritorio/llvm-project/lldb/cmake/modules/LLDBConfig.cmake:104 (find_package)
/home/enrique/Escritorio/llvm-project/lldb/CMakeLists.txt:21 (include)
-- Configuring incomplete, errors occurred!
See also "/home/enrique/Escritorio/llvm-project/build/CMakeFiles/CMakeOutput.log".
See also "/home/enrique/Escritorio/llvm-project/build/CMakeFiles/CMakeError.log".
I had the same issue, tried uninstalling the golang compiler (because I don't need llvm support for go); to no avail. I'm not an LLVM expert so this might not be the canonical solution but here's how I solved it:
I replaced
-DLLVM_ENABLE_PROJECTS='all'
by
-DLLVM_ENABLE_PROJECTS="proj1;proj2;proj3"
where I built the list "proj1;proj2;proj3" by grepping project is enabled$ in cmake output and removed the llgo project. I got a list like:
-- clang project is enabled
-- clang-tools-extra project is enabled
-- compiler-rt project is enabled
-- debuginfo-tests project is enabled
-- libclc project is enabled
-- libcxx project is enabled
-- libcxxabi project is enabled
-- libunwind project is enabled
-- lld project is enabled
-- lldb project is enabled
-- llgo project is enabled
-- openmp project is enabled
-- parallel-libs project is enabled
-- polly project is enabled
-- pstl project is enabled
and then built the following list with some vim macros/whatever you master (note: no llgo in there):
clang;clang-tools-extra;compiler-rt;debuginfo-tests;libclc;libcxx;libcxxabi;libunwind;lld;lldb;openmp;parallel-libs;polly;pstl
Then compiling llvm succeeded \o/

cmake error with catkin_make, ROS installation

I have created a workspace as catkin_ws. Then, catkin_make was run successful.
After I type catkin_create_pkg ros_basics_tutorials std_msgs rospy roscpp and then the all folders and files created in ros_basics_tutorials folder.
However After this command, I type cd catkin_ws
and then catkin_make
Below error is shown Cmake Error, Could NOT find cpp (missing: cpp_DIR), cmake_check_build_system' failed
Base path: /home/selcuk/catkin_ws
Source space: /home/selcuk/catkin_ws/src
Build space: /home/selcuk/catkin_ws/build
Devel space: /home/selcuk/catkin_ws/devel
Install space: /home/selcuk/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/selcuk/catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/selcuk/catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/selcuk/catkin_ws/devel;/opt/ros/melodic
-- This workspace overlays: /home/selcuk/catkin_ws/devel;/opt/ros/melodic
-- Using PYTHON_EXECUTABLE: /home/selcuk/python/anaconda2/bin/python2
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/selcuk/catkin_ws/build/test_results
CMake Error: Target gtest has dependency information when it shouldn't.
Your cache is probably stale. Please remove the entry
gtest_LIB_DEPENDS
from the cache.
CMake Error: Target gtest_main has dependency information when it shouldn't.
Your cache is probably stale. Please remove the entry
gtest_main_LIB_DEPENDS
from the cache.
CMake Error: Target gmock has dependency information when it shouldn't.
Your cache is probably stale. Please remove the entry
gmock_LIB_DEPENDS
from the cache.
CMake Error: Target gmock_main has dependency information when it shouldn't.
Your cache is probably stale. Please remove the entry
gmock_main_LIB_DEPENDS
from the cache.
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.14
-- BUILD_SHARED_LIBS is on
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~ traversing 2 packages in topological order:
-- ~~ - ros_basics_tutorials
-- ~~ - naoqi_driver
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'ros_basics_tutorials'
-- ==> add_subdirectory(ros_basics_tutorials)
-- Could NOT find cpp (missing: cpp_DIR)
-- Could not find the required component 'cpp'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "cpp" with any of
the following names:
cppConfig.cmake
cpp-config.cmake
Add the installation prefix of "cpp" to CMAKE_PREFIX_PATH or set "cpp_DIR"
to a directory containing one of the above files. If "cpp" provides a
separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
ros_basics_tutorials/CMakeLists.txt:10 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/selcuk/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/selcuk/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:320: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed
I couldn't solve? How can solve it?
The error was due to anathor project folder which i canceled under the catkin_ws. I deleted it and complied again. The error solved.

Catkin cannot find gtest

Since yesterday none of my packages containing tests build. Catkin complains it cannot find gtest when using catkin_add_gtests(), since GTEST_FOUND is FALSE. You can see this in the error msg below, with the custom output I added to my CMakeLists. Up to yesterday, GTEST_FOUND was TRUE when catkin_add_gtests() was called.
This is the error I always get. In this case I'm trying to build a mockup package on a clean catkin workspace:
Errors << silly_pkg:cmake /home/paco/catkin_ws2/logs/silly_pkg/build.cmake.002.log
Not searching for unused variables given on the command line.
Re-run cmake no build system arguments
-- Using CATKIN_DEVEL_PREFIX: /home/paco/catkin_ws2/devel/.private/silly_pkg
-- Using CMAKE_PREFIX_PATH: /home/paco/catkin_ws2/devel;/opt/ros/kinetic
-- This workspace overlays: /home/paco/catkin_ws2/devel;/opt/ros/kinetic
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/paco/catkin_ws2/build/silly_pkg/test_results
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.7.11
-- GTEST_FOUND: FALSE
CMake Warning at /opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake:149 (message):
skipping gtest 'test_silly_pkg' in project 'silly_pkg' because gtest was
not found
Call Stack (most recent call first):
/opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake:79 (_catkin_add_executable_with_google_test)
/opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake:28 (_catkin_add_google_test)
CMakeLists.txt:28 (catkin_add_gtest)
CMake Error at /home/paco/catkin_ws2/src/silly_pkg/CMakeLists.txt:33 (target_link_libraries):
Cannot specify link libraries for target "test_silly_pkg" which is not
built by this project.
-- Configuring incomplete, errors occurred!
See also "/home/paco/catkin_ws2/build/silly_pkg/CMakeFiles/CMakeOutput.log".
See also "/home/paco/catkin_ws2/build/silly_pkg/CMakeFiles/CMakeError.log".
cd /home/paco/catkin_ws2/build/silly_pkg; catkin build --get-env silly_pkg | catkin env -si /usr/bin/cmake /home/paco/catkin_ws2/src/silly_pkg --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/paco/catkin_ws2/devel/.private/silly_pkg -DCMAKE_INSTALL_PREFIX=/home/paco/catkin_ws2/install; cd -
I am using catkin 0.7.11, libgtest-dev 1.7.0 and cmake 3.5.1. I use ROS Kinetic with Ubuntu 16.04. The only thing I did yesterday was reinstalling ROS Kinetic, but the package versions are exactly the same. Did anybody have this problem? Do you have any ideas on what could be happening?
EDIT 3/09/18:
By comparing with a functional catkin+gtest workspace in a different computer, I found out that the main difference is in the results of /opt/ros/kinetic/share/catkin/cmake/test/gtest.cmake. In the functional workspace, line 292 evaluates to TRUE (gtest/gmock is not a target) while in my workspace it evaluates to FALSE. This is because in my workspace running find_package(GMock QUIET) (line 287) sets gmock and gtest as imported targets, which does not happen in the other computer. Why is this different?
Thanks TikO for your help!
Since you wrote that cmake does not find the libraries and that you have reinstalled Kinetic, I assume that you have a freshly installed machine or wiped out gtest libraries by accident.
If you install libgtest-dev, you only get the sources which you need to build and install like this:
sudo apt-get install libgtest-dev
mkdir /tmp/gtest_build && cd /tmp/gtest_build
cmake /usr/src/gtest
make
#copy or symlink libgtest.a and ligtest_main.a to /usr/lib folder
sudo cp *.a /usr/lib
After this routine, you should be able to build again without cmake complaining.
Optional
If you have limited rights on your machine and you are not allowed to install the libraries in that way, just copy them into some home folder like
mkdir ~/lib && cp *.a ~/lib
But be aware of the fact, that you have to call catkin in the following way:
LIBRARY_PATH=~/lib GTEST_ROOT=~/lib catkin_make
LIBRARY_PATH tells the linker where to find the libraries, while GTEST_ROOT gives cmake the location hints for it's checks.
Reference: https://github.com/tik0/gtest_ros_example
SOLUTION FOUND
gmock and gtest were being set to imported target because the suggested manual compilation of libgtest had created a FindGMock.cmake file inside /usr/share/cmake-3.5/Modules. This file was being called by the find(GMock QUIET)
in catkin_add_gtests(), therefore setting the imported target. Just deleting FindGMock.cmake solved the issue.

CMake can not find cm256cc, although it is installed in the root

Please take a look at the code below. Kindly tell me what I am doing wrong. Where do I need to install the cm256cc ?
I installed cm256cc via git clone in the root folder. Also git cloned sdrdaemon in the root. Any help is greatly appreciated.
root#beaglebone:~# ls
Desktop cm256cc sdrdaemon
root#beaglebone:~# cd sdrdaemon/
root#beaglebone:~/sdrdaemon# cd build/
root#beaglebone:~/sdrdaemon/build# cmake ..
-- Architecture: armv7l
-- Use g++ NEON SIMD instructions
-- Boost version: 1.55.0
-- checking for module 'libcm256cc'
-- package 'libcm256cc' not found
-- CM256cc not found
-- Could NOT find CM256CC (missing: CM256CC_LIBRARIES CM256CC_INCLUDE_DIR)
-- checking for module 'libairspy'
-- package 'libairspy' not found
-- libairspy not found
-- checking for module 'libbladerf'
-- package 'libbladerf' not found
-- libbladerf not found
-- checking for module 'libhackrf'
-- package 'libhackrf' not found
-- libhackrf not found
-- Found librtlsdr: /usr/include, /usr/lib/arm-linux-gnueabihf/librtlsdr.so
-- Found libusb: /usr/include/libusb-1.0, /usr/lib/arm-linux-gnueabihf/libusb-1.0.so
-- Found libnanomsg: /usr/include, /usr/lib/arm-linux-gnueabihf/libnanomsg.so
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CM256CC_INCLUDE_DIR (ADVANCED)
used as include directory in directory /root/sdrdaemon
used as include directory in directory /root/sdrdaemon
used as include directory in directory /root/sdrdaemon
used as include directory in directory /root/sdrdaemon
used as include directory in directory /root/sdrdaemon
-- Configuring incomplete, errors occurred!
See also "/root/sdrdaemon/build/CMakeFiles/CMakeOutput.log".
See also "/root/sdrdaemon/build/CMakeFiles/CMakeError.log".