Self-built reference package error: CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):

Error content:

CMake Error at /opt/ros/melodic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
  Could not find a package configuration file provided by "common" with any
  of the following names:

    commonConfig.cmake
    common-config.cmake

  Add the installation prefix of "common" to CMAKE_PREFIX_PATH or set
  "common_DIR" to a directory containing one of the above files.  If "common"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  lidar_location/CMakeLists.txt:37 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/wsk/8359_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/wsk/8359_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

Error screenshot

        Detailed description: The common package is a self-built package, which stores common files, and other executable files need to access the package and run the header files in the package. The content of the error report is that this package cannot be found. If the reader cannot find other ROS SDK packages, you can directly use the command to download it. The command is as follows, which does not belong to the situation described in this question.

sudo apt-get install ros-melodic-sdk名称

        The principle of the solution is that ros runs each package out of order, so when running other packages, it does not run the common package first, so this type of error is reported. The solution is to execute in order, run the common package first, and then run other packages.

Method 1: very stupid

Delete other packages, keep only the common self-built package, run it once, and restore other packages. Re-catkin_make, solved.

Method 2: Solve the root cause

Add one to the package.xml file of other packages

<depend>common</depend>

Add common to the CMakeLists.txt file

find_package(catkin REQUIRED COMPONENTS

common

)

Solved after the above.

Guess you like

Origin blog.csdn.net/yiweiduguo/article/details/123178728