鱼香ROS社区
    • 版块
    • 最新
    • 未解决
    • 已解决
    • 群组
    • 注册
    • 登录
    紧急通知:禁止一切关于政治&VPN翻墙等话题,发现相关帖子会立马删除封号
    提问前必看的发帖注意事项: 社区问答规则(小鱼个人)更新 | 高质量帖子发布指南

    clion执行cmake报错,但是使用命令行执行cmake ..没有报错

    已定时 已固定 已锁定 已移动 未解决
    综合问题
    cmake error ubuntu 22.04 ros2-humble
    2
    4
    425
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • S
      starRiver.lea
      最后由 编辑

      ubuntu-22.04环境下使用clion执行cmake报错,但是使用命令行执行cmake ..没有报错

      /usr/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/snap/clion/296/bin/ninja/linux/x64/ninja -DCMAKE_PREFIX_PATH=/opt/ros/humble -G Ninja -S /home/lfy/workspace/ros2/village_wang -B /home/lfy/workspace/ros2/village_wang/cmake-build-debug
      -- The C compiler identification is GNU 11.4.0
      -- The CXX compiler identification is GNU 11.4.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found ament_cmake: 1.3.10 (/opt/ros/humble/share/ament_cmake/cmake)
      -- Found Python3: /usr/bin/python3 (found version "3.10.12") found components: Interpreter 
      -- Found rclcpp: 16.0.10 (/opt/ros/humble/share/rclcpp/cmake)
      -- Found rosidl_generator_c: 3.1.5 (/opt/ros/humble/share/rosidl_generator_c/cmake)
      -- Found rosidl_adapter: 3.1.5 (/opt/ros/humble/share/rosidl_adapter/cmake)
      -- Found rosidl_generator_cpp: 3.1.5 (/opt/ros/humble/share/rosidl_generator_cpp/cmake)
      CMake Error at /opt/ros/humble/share/rosidl_typesupport_c/cmake/get_used_typesupports.cmake:35 (message):
        No 'rosidl_typesupport_c' found
      Call Stack (most recent call first):
        /opt/ros/humble/share/rosidl_typesupport_c/cmake/rosidl_typesupport_c-extras.cmake:8 (get_used_typesupports)
        /opt/ros/humble/share/rosidl_typesupport_c/cmake/rosidl_typesupport_cConfig.cmake:41 (include)
        /opt/ros/humble/share/builtin_interfaces/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
        /opt/ros/humble/share/builtin_interfaces/cmake/builtin_interfacesConfig.cmake:41 (include)
        /opt/ros/humble/share/libstatistics_collector/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
        /opt/ros/humble/share/libstatistics_collector/cmake/libstatistics_collectorConfig.cmake:41 (include)
        /opt/ros/humble/share/rclcpp/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
        /opt/ros/humble/share/rclcpp/cmake/rclcppConfig.cmake:41 (include)
        CMakeLists.txt:11 (find_package)
      
      
      -- Configuring incomplete, errors occurred!
      See also "/home/lfy/workspace/ros2/village_wang/cmake-build-debug/CMakeFiles/CMakeOutput.log".
      
      [已完成]
      
      

      命令行运行cmake ..

      make ..
      -- The C compiler identification is GNU 11.4.0
      -- The CXX compiler identification is GNU 11.4.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Found ament_cmake: 1.3.10 (/opt/ros/humble/share/ament_cmake/cmake)
      -- Found Python3: /usr/bin/python3 (found version "3.10.12") found components: Interpreter 
      -- Found rclcpp: 16.0.10 (/opt/ros/humble/share/rclcpp/cmake)
      -- Found rosidl_generator_c: 3.1.5 (/opt/ros/humble/share/rosidl_generator_c/cmake)
      -- Found rosidl_adapter: 3.1.5 (/opt/ros/humble/share/rosidl_adapter/cmake)
      -- Found rosidl_generator_cpp: 3.1.5 (/opt/ros/humble/share/rosidl_generator_cpp/cmake)
      -- Using all available rosidl_typesupport_c: rosidl_typesupport_fastrtps_c;rosidl_typesupport_introspection_c
      -- Using all available rosidl_typesupport_cpp: rosidl_typesupport_fastrtps_cpp;rosidl_typesupport_introspection_cpp
      -- Found rmw_implementation_cmake: 6.1.2 (/opt/ros/humble/share/rmw_implementation_cmake/cmake)
      -- Found rmw_fastrtps_cpp: 6.2.7 (/opt/ros/humble/share/rmw_fastrtps_cpp/cmake)
      -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "3.0.2")  
      -- Found FastRTPS: /opt/ros/humble/include  
      -- Using RMW implementation 'rmw_fastrtps_cpp' as default
      -- Looking for pthread.h
      -- Looking for pthread.h - found
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
      -- Found Threads: TRUE  
      -- Found ament_lint_auto: 0.12.11 (/opt/ros/humble/share/ament_lint_auto/cmake)
      -- Added test 'cppcheck' to perform static code analysis on C / C++ code
      -- Configured cppcheck include dirs: 
      -- Configured cppcheck exclude dirs and/or files: 
      -- Added test 'lint_cmake' to check CMake code style
      -- Added test 'uncrustify' to check C / C++ code style
      -- Configured uncrustify additional arguments: 
      -- Added test 'xmllint' to check XML markup files
      -- Configuring done
      -- Generating done
      -- Build files have been written to: /home/lfy/workspace/ros2/village_wang/build
      
      
      1 条回复 最后回复 回复 引用 0
      • 小伊小
        机器人小伊
        最后由 编辑

        从你提供的错误信息来看,CLion在尝试使用CMake配置项目时遇到了一个特定的错误,而命令行执行CMake则没有这个问题。这个错误是关于找不到rosidl_typesupport_c。下面是一些可能的解决步骤和原因分析:

        1. 环境差异:

          • CLion和命令行可能使用不同的环境变量。检查CLion中配置的环境变量,确保它们与命令行中的环境一致。
          • 特别是CMAKE_PREFIX_PATH和PATH,这些变量对CMake查找库和工具的位置至关重要。
        2. CMake配置差异:

          • CLion中使用的CMake命令包含了一些特定的参数,如-DCMAKE_MAKE_PROGRAM=/snap/clion/296/bin/ninja/linux/x64/ninja,这指定了使用Ninja作为构建系统。
          • 确保Ninja配置正确,并且与你的系统兼容。
          • 尝试在CLion中更改构建系统为Makefile或其他,看看是否仍然出现问题。
        3. 依赖问题:

          • 错误提示No 'rosidl_typesupport_c' found表明CMake在配置过程中未能找到rosidl_typesupport_c。这可能是因为CLion的CMake配置没有正确设置搜索路径。
          • 检查CMakeLists.txt文件,确保有正确的find_package调用和相关的依赖项设置。
          • 确保ROS 2环境已经正确安装,并且所有相关的包都可用。
        4. 缓存问题:

          • 有时候,旧的CMake缓存可能导致问题。尝试在CLion中清除CMake缓存(通常在CMake工具窗口中有一个“清除缓存并重新加载”的选项)。
          • 你也可以手动删除cmake-build-debug目录,然后重新构建。
        5. 权限问题:

          • 确保你有足够的权限访问所有相关的文件和目录。
        6. 详细日志:

          • 查看CLion中CMake生成的详细日志,可能会有更多关于问题的线索。
        7. 尝试更新或重新安装:

          • 如果问题依旧存在,尝试更新CLion到最新版本,或者重新安装ROS 2和CLion。

        通过上述步骤,你应该能够诊断并解决CLion中CMake配置的问题。如果问题仍然存在,可能需要更详细地检查CLion的配置或寻求CLion社区的帮助。


        以上为生成回答,仅供参考~

        我是小伊,已接入ChatGpt,所有回复,仅供参考~

        S 1 条回复 最后回复 回复 引用 0
        • S
          starRiver.lea @小伊
          最后由 编辑

          此回复已被删除!
          1 条回复 最后回复 回复 引用 0
          • 小伊小
            机器人小伊
            最后由 编辑

            如果您在使用 CLion(JetBrains 的 C/C++ 集成开发环境)时,能够正常地包含和使用 Point Cloud Library(PCL)库,而没有遇到任何编译或运行时错误,这通常意味着您的项目配置是正确的,并且所有必要的依赖项都已正确安装和链接。

            以下是一些关键点,确保您的项目能够顺利使用 PCL:

            1. CMakeLists.txt 配置:
              确保您的 CMakeLists.txt 文件中包含了 PCL 的查找和链接指令。通常,这包括 find_package(PCL REQUIRED) 以及在 target_link_libraries 中添加相应的 PCL 组件。例如:

              cmake_minimum_required(VERSION 3.10)
              project(PCL_Example)
              
              find_package(PCL 1.8 REQUIRED)
              
              include_directories(${PCL_INCLUDE_DIRS})
              link_directories(${PCL_LIBRARY_DIRS})
              add_definitions(${PCL_DEFINITIONS})
              
              add_executable(pcl_example main.cpp)
              target_link_libraries(pcl_example ${PCL_LIBRARIES})
              
            2. PCL 安装:
              确保 PCL 库已经正确安装在您的系统上,并且 pcl_config.cmake 文件(或其他相关的 CMake 配置文件)可以被 CMake 找到。这通常意味着 PCL 是通过标准的包管理器(如 apt-get, brew, vcpkg 等)安装的,或者通过源代码编译并安装了正确的 CMake 配置。

            3. 环境变量:
              确保相关的环境变量(如 PCL_ROOT,如果设置的话)指向了正确的 PCL 安装目录。此外,LD_LIBRARY_PATH(Linux)或 DYLD_LIBRARY_PATH(macOS)可能需要包含 PCL 库文件的路径,以确保运行时可以找到这些库。

            4. CLion 配置:
              在 CLion 中,确保您选择了正确的 CMake 构建配置(如 Debug 或 Release),并且 CMake 缓存是最新的。有时候,清理 CMake 缓存(通过 CLion 的“File” -> “Invalidate Caches / Restart...”)可以解决一些看似无关的问题。

            5. 编译器和依赖:
              确保您的编译器(如 GCC, Clang, MSVC)和所有依赖项(如 Boost, Eigen, VTK 等,这些通常是 PCL 的依赖)都是最新的,或者至少是与 PCL 兼容的版本。

            如果您已经检查了以上所有点,并且一切看起来都是正确的,那么您应该能够顺利地在 CLion 中使用 PCL 库进行开发。如果遇到具体的错误或问题,请提供详细的错误信息,以便进行更具体的故障排除。


            以上为生成回答,仅供参考~

            我是小伊,已接入ChatGpt,所有回复,仅供参考~

            1 条回复 最后回复 回复 引用 0
            • 第一个帖子
              最后一个帖子
            皖ICP备16016415号-7
            Powered by NodeBB | 鱼香ROS