Ubuntu中Clion编译CMakeLists.txt报错

本文介绍了在使用Clion进行ROS开发时遇到的CMakeLists.txt编译错误,原因是Clion没有加载ROS的环境。解决方法是找到Clion的安装路径,并通过./clion.sh启动,确保在运行前正确设置了ROS的工作空间和环境。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在使用Clion进行ROS开发时编译CMakeLists.txt出现以下报错

CMake Error at CMakeLists.txt:65 (message):

find_package(catkin) failed. catkin was neither found in the workspace norin the CMAKE_PREFIX_PATH.One reason may be that no ROS setup.sh was sourced before.
 

原因:Clion软件在以快捷方式打开后并没有加载catkin的一些环境。因此Clion是找不到上面报错的代码中包含的运行包的。

解决方法:

查找clion所在的安装位置

locate clion.sh

若出现报错:Command 'locate' not found, but can be installed with:

则输入

sudo apt install mlocate

再次输入

locate clion.sh

可以得到clion的路径

我的路径如下

进入该路径

cd /snap/clion/184/bin

之后再运行Clion即可

./clion.sh

/root/.cache/JetBrains/RemoteDev/dist/4301d48e0f61a_CLion-252.23309.24/bin/cmake/linux/x64/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/root/.cache/JetBrains/RemoteDev/dist/4301d48e0f61a_CLion-252.23309.24/bin/ninja/linux/x64/ninja -DVP_SDK_PLATFORM=VP_SDK_PLATFORM_LINUX -G Ninja -S /home/dong/vp_cloud -B /home/dong/vp_cloud -- Current build platform is [Linux] use host -- vp_context_1.0.0.12 Module Config: -- VP_SDK_OS_TYPE:VP_SDK_OS_VEEPAI -- VP_SDK_PLATFORM:VP_SDK_PLATFORM_LINUX -- VP_POWER_TYPE:VP_POWER_TYPE_LOW -- VP_NETWORK_MODE:VP_NETWORK_MODE_MOBILE -- VP_SOC_BRAND:VP_SOC_BRAND_JZ -- VP_SOC_MODEL:VP_SOC_MODEL_JZ_T41ZM -- VP_NIC_BRAND:VP_NIC_BRAND_HZ -- VP_NIC_MODEL:VP_NIC_MODEL_HZ_780E -- VP_DEVICE_TYPE:VP_DEVICE_TYPE_BW6 -- VP_MOBILE_DEVICE_TYPE:VP_MOBILE_DEVICE_TYPE_QG5 -- Current build Veepai OS -- Current build nic mode wifi:OFF mobile:ON wire:OFF -- vp_printf_1.0.0.4 Module Config: -- VP_PRINTF_ENABLE:0x01 -- VP_PRINTF_LEVEL:VP_PRINTF_LEVEL_ALL -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Checking for one of the modules 'libavformat' CMake Error at /root/.cache/JetBrains/RemoteDev/dist/4301d48e0f61a_CLion-252.23309.24/bin/cmake/linux/x64/share/cmake-4.0/Modules/FindPkgConfig.cmake:934 (message): None of the required 'libavformat' found Call Stack (most recent call first): .dependencies/vp_cmake_1.0.0.8/vp_cmake/src/CMakeLists.txt:256 (pkg_search_module) .dependencies/vp_platform_1.0.0.19/vp_platform/CMakeLists.txt:16 (add_pkg_library) -- vp_platform not found libavformat -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Checking for one of the modules 'libavcodec' CMake Error at /root/.cache/JetBrains/RemoteDev/dist/4301d48e0f61a_CLion-252.23309.24/bin/cmake/linux/x64/share/cmake-4.0/Modules/FindPkgConfig.cmake:934 (message): None of the required 'libavcodec' found Call Stack (most recent call first): .dependencies/vp_cmake_1.0.0.8/vp_cmake/src/CMakeLists.txt:256 (pkg_search_module) .dependencies/vp_platform_1.0.0.19/vp_platform/CMakeLists.txt:17 (add_pkg_library) -- vp_platform not found libavcodec -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Checking for one of the modules 'libswresample' CMake Error at /root/.cache/JetBrains/RemoteDev/dist/4301d48e0f61a_CLion-252.23309.24/bin/cmake/linux/x64/share/cmake-4.0/Modules/FindPkgConfig.cmake:934 (message): None of the required 'libswresample' found Call Stack (most recent call first): .dependencies/vp_cmake_1.0.0.8/vp_cmake/src/CMakeLists.txt:256 (pkg_search_module) .dependencies/vp_platform_1.0.0.19/vp_platform/CMakeLists.txt:18 (add_pkg_library) -- vp_platform not found libswresample -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Checking for one of the modules 'libavfilter' CMake Error at /root/.cache/JetBrains/RemoteDev/dist/4301d48e0f61a_CLion-252.23309.24/bin/cmake/linux/x64/share/cmake-4.0/Modules/FindPkgConfig.cmake:934 (message): None of the required 'libavfilter' found Call Stack (most recent call first): .dependencies/vp_cmake_1.0.0.8/vp_cmake/src/CMakeLists.txt:256 (pkg_search_module) .dependencies/vp_platform_1.0.0.19/vp_platform/CMakeLists.txt:19 (add_pkg_library) -- vp_platform not found libavfilter -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Checking for one of the modules 'libpostproc' CMake Error at /root/.cache/JetBrains/RemoteDev/dist/4301d48e0f61a_CLion-252.23309.24/bin/cmake/linux/x64/share/cmake-4.0/Modules/FindPkgConfig.cmake:934 (message): None of the required 'libpostproc' found Call Stack (most recent call first): .dependencies/vp_cmake_1.0.0.8/vp_cmake/src/CMakeLists.txt:256 (pkg_search_module) .dependencies/vp_platform_1.0.0.19/vp_platform/CMakeLists.txt:20 (add_pkg_library) -- vp_platform not found libpostproc -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Checking for one of the modules 'libswscale' CMake Error at /root/.cache/JetBrains/RemoteDev/dist/4301d48e0f61a_CLion-252.23309.24/bin/cmake/linux/x64/share/cmake-4.0/Modules/FindPkgConfig.cmake:934 (message): None of the required 'libswscale' found Call Stack (most recent call first): .dependencies/vp_cmake_1.0.0.8/vp_cmake/src/CMakeLists.txt:256 (pkg_search_module) .dependencies/vp_platform_1.0.0.19/vp_platform/CMakeLists.txt:21 (add_pkg_library) -- vp_platform not found libswscale -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Checking for one of the modules 'libavutil' CMake Error at /root/.cache/JetBrains/RemoteDev/dist/4301d48e0f61a_CLion-252.23309.24/bin/cmake/linux/x64/share/cmake-4.0/Modules/FindPkgConfig.cmake:934 (message): None of the required 'libavutil' found Call Stack (most recent call first): .dependencies/vp_cmake_1.0.0.8/vp_cmake/src/CMakeLists.txt:256 (pkg_search_module) .dependencies/vp_platform_1.0.0.19/vp_platform/CMakeLists.txt:22 (add_pkg_library) -- vp_platform not found libavutil platform_dir:LINUX -- vp_crypto_1.1.0.0 Module Config: -- VP_SSL_MBEDTLS:0x01 -- VP_SSL_WOLFSSL:0x00 -- VP_SSL_LIBRARY:0x01 -- Configuring incomplete, errors occurred! [无法重新加载]
06-22
<think>首先,用户的问题是:“我想查找在Linux系统中CLion软件的可执行文件位置 请问CLion在Linux上的可执行文件路径”。这是一个关于CLion在Linux系统中可执行文件路径的查询。 根据系统级指令,我需要: - 所有行内数学表达式使用 $...$ 格式。 - 独立公式使用 $$...$$ 格式并单独成段。 - LaTeX语法正确。 - 使用中文回答。 - 生成相关问题。 - 回答中引用的段落末尾自然地添加引用标识,例如 [^1]。 用户可见层指令: - 回答结构清晰,帮助用户逐步解决问题。 - 尽量保证回答真实可靠。 - 参考站内引用:提供了四个引用,我需要从中提取相关信息。 分析引用内容: - 引用[1]: 描述了如何创建一个名为clion的可执行文件来启动clion.sh脚本。具体步骤包括:创建文件 /usr/bin/clion,写入命令执行脚本,并设置可执行权限。路径是 /home/xxx/software/clion-2022.2/bin/clion.sh。 - 引用[2]: 讨论使用ClionUbuntu上进行交叉编译和远程编译,但没有直接提供可执行文件路径。 - 引用[3]: 关于用ClionCMakeLists将cpp文件变成可执行文件,提到CLion插件,但不直接相关。 - 引用[4]: CLion配置工程使用外部Linux编译编译,给出CMakeLists代码,但不直接提供可执行文件路径。 用户的问题是关于CLion可执行文件的位置。引用[1] 直接相关,因为它描述了如何创建可执行文件指向脚本的位置。 典型的CLion安装路径: - CLion通常安装在用户的主目录下,例如 ~/software/clion-<version>/bin/clion.sh。 - 或者,在系统路径如 /usr/bin 或 /usr/local/bin 创建符号链接或脚本。 从引用[1] 中:"sh /home/xxx/software/clion-2022.2/bin/clion.sh",这表明可执行脚本的默认位置在安装目录的 bin 文件夹下。 因此,回答应该基于此: - CLion的可执行文件通常是 clion.sh 脚本,位于安装目录的 bin 文件夹中。 - 用户可能通过创建符号链接或脚本在系统路径中访问它。 步骤清晰的回答: 1. 确认CLion的默认安装位置。 2. 解释如何找到或创建可执行路径。 3. 提供示例路径。 4. 生成相关问题。 确保回答真实可靠:CLion在Linux上通常作为脚本运行,路径在安装目录的 bin 下。 最终回答结构: - 开头直接回答问题。 - 逐步解释。 - 添加引用标识。 - 生成相关问题。 生成相关问题: - 基于用户查询,如如何安装CLion、如何配置路径、如何启动等。 相关问题示例: 1. 如何安装CLion在Linux系统? 2. 如何在系统路径中添加CLion可执行文件? 3. CLion启动脚本有什么作用? 4. 如何更新CLion版本? 5. CLion的配置文件位置在哪里? 使用中文回答。</think>### CLion在Linux上的可执行文件路径 在Linux系统中,CLion的可执行文件通常是一个Shell脚本(`clion.sh`),位于CLion安装目录的`bin`文件夹下。默认安装路径取决于您的安装方式(例如,通过下载压缩包解压或使用安装脚本)。以下是逐步说明如何查找或确认该路径: 1. **默认安装路径**: - 如果您通过下载JetBrains官方压缩包安装CLion,路径通常为 `~/software/clion-<version>/bin/clion.sh`。其中: - `~` 表示用户主目录(如 `/home/yourusername`)。 - `<version>` 是CLion的版本号(如 `clion-2022.2`)。 - 例如,常见路径为 `/home/yourusername/software/clion-2022.2/bin/clion.sh`。您可以使用终端命令查找: ```bash find ~/software -name "clion.sh" 2>/dev/null ``` 如果找不到,尝试搜索整个系统: ```bash sudo find / -name "clion.sh" 2>/dev/null ``` 2. **系统路径中的可执行文件**: - 为了方便启动,用户通常会在系统路径(如 `/usr/bin` 或 `/usr/local/bin`)创建一个符号链接或可执行脚本指向 `clion.sh`。例如: - 创建一个名为 `clion` 的文件在 `/usr/bin`: ```bash sudo vim /usr/bin/clion ``` - 在文件中写入启动脚本的路径(假设您的安装路径是 `/home/yourusername/software/clion-2022.2/bin/clion.sh`): ```bash #!/bin/sh sh /home/yourusername/software/clion-2022.2/bin/clion.sh ``` - 设置可执行权限: ```bash sudo chmod +x /usr/bin/clion ``` 之后,您可以直接在终端输入 `clion` 启动CLion [^1]。 3. **验证路径**: - 运行CLion后,您可以通过CLion的“Help”菜单 > “About”查看安装路径。 - 或者在终端使用 `which clion` 命令检查是否在系统路径中(如果已创建链接)。 **注意**: CLion本身不是编译后的二进制文件,而是一个Java应用程序,由 `clion.sh` 脚本启动。该脚本负责设置环境变量和JVM参数。如果找不到路径,可能是未正确安装或路径被移动。建议参考官方安装文档 [^1][^2]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值