安装mysql cmake your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found

本文介绍了解决CMake配置过程中遇到的CXX编译器未找到的问题,提供了具体的解决步骤,包括安装必要的编译器和依赖库,并清理缓存重新编译。

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

 CMake Error: your CXX compiler: “CMAKE_CXX_COMPILER-NOTFOUND” was not found. Please set CMAKE_CXX_COMPILER to a valid compiler path or name.

解决方法:

yum install gcc-c++

Mysql5.6下的依赖要先安装:

yum  -y install ncurses-devel

yum -y install ncurses

yum -y install openssl-devel
yum  -y install    tcp_wrappers-devel 
yum  -y install    bison-devel

yum  -y install    bison
yum  -y install gcc-c++
yum -y install cmake

 

然后删除CMakeCache.txt,重新执行编译命令即可

ubuntu@ubuntu:~/PX4_Firmware$ make px4_sitl_default gazebo [0/724] git submodule Tools/sitl_gazebo [6/724] Performing configure step for 'sitl_gazebo' -- install-prefix: /usr/local -- The C compiler identification is GNU 7.5.0 -- The CXX compiler identification is GNU 7.5.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test COMPILER_SUPPORTS_CXX17 -- Performing Test COMPILER_SUPPORTS_CXX17 - Success -- Performing Test COMPILER_SUPPORTS_CXX14 -- Performing Test COMPILER_SUPPORTS_CXX14 - Success -- Performing Test COMPILER_SUPPORTS_CXX11 -- Performing Test COMPILER_SUPPORTS_CXX11 - Success -- Performing Test COMPILER_SUPPORTS_CXX0X -- Performing Test COMPILER_SUPPORTS_CXX0X - Success -- Using C++17 compiler -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE -- Found Boost: /usr/include (found suitable version "1.65.1", minimum required is "1.58") found components: system thread filesystem chrono date_time atomic CMake Error at CMakeLists.txt:32 (find_package): By not providing "Findgazebo.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "gazebo", but CMake did not find one. Could not find a package configuration file provided by "gazebo
03-17
<think>好的,我需要帮助用户解决在编译PX4 Firmware的SITL Gazebo模拟时遇到的CMake找不到gazebo包的问题。首先,我要回忆一下之前处理类似问题的经验,并参考用户提供的引用内容。 用户提到错误是CMake找不到gazebo的包配置,这通常意味着相关的开发包没有正确安装。根据引用中的信息,用户可能缺少一些依赖包,比如gstreamer-base-1.0,或者需要升级系统包。此外,引用[3]提到了编译错误,可能是因为内存不足,但当前的问题是关于包配置找不到,所以暂时先不考虑内存问题。 首先,我应该检查用户是否安装了Gazebo的开发包。在Ubuntu中,Gazebo的包通常分为运行时和开发版。用户可能需要安装libgazebo-dev或者类似的开发包。例如,安装命令可能是sudo apt-get install libgazebo-dev。另外,用户可能还需要确保Gazebo的版本与PX4兼容,版本过低可能导致问题。 接下来,检查CMake的查找路径是否正确。有时候,Gazebo的.pc文件可能不在标准路径中,需要设置PKG_CONFIG_PATH环境变量。例如,如果Gazebo安装在/usr/lib/x86_64-linux-gnu/gazebo-X.X,用户需要导出这个路径。 另外,用户可能需要安装其他依赖项,比如protobuf和gazebo插件相关的库。引用中提到的gstreamer-base-1.0问题可以通过安装对应的开发包解决,例如libgstreamer-plugins-base1.0-dev。 如果用户之前升级过系统包(如引用[2]中的sudo apt-get upgrade),可能需要重新运行PX4的构建脚本,或者清理之前的编译结果(make clean)。 最后,建议用户查看PX4官方文档,确保所有依赖项都已正确安装,并检查Gazebo的版本是否符合要求。如果问题依旧,可能需要手动指定Gazebo的路径或寻求社区支持。 总结步骤:安装Gazebo开发包,设置环境变量,安装其他依赖,清理并重新编译。同时,参考用户提供的引用中的解决方法,如升级包和处理依赖问题。</think>在解决编译PX4 SITL Gazebo模拟时出现的“CMake找不到gazebo包”问题时,可按照以下步骤排查和修复: --- ### **1. 安装缺失的Gazebo开发包** CMake需要Gazebo的**开发库文件**(如头文件和链接库)才能正确编译。在Ubuntu中需安装以下包: ```bash sudo apt-get install libgazebo-dev gazebo ``` - `libgazebo-dev`:提供Gazebo的C++开发接口 - `gazebo`:确保Gazebo本体已安装[^1] --- ### **2. 配置Gazebo环境变量** 若安装后仍报错,需手动指定Gazebo的`pkg-config`路径: ```bash export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH ``` - 该路径可能因系统版本不同而变化,例如Gazebo 11的路径为`/usr/lib/x86_64-linux-gnu/gazebo-11/pkgconfig`[^2] --- ### **3. 安装其他依赖项** PX4依赖的额外库可能未完全安装: ```bash sudo apt-get install protobuf-compiler libprotobuf-dev libjansson-dev ``` - `protobuf`:用于Gazebo与PX4的通信协议 - `libjansson-dev`:JSON解析库 --- ### **4. 清理并重新编译** 确保所有依赖安装后,清理旧编译文件并重新构建: ```bash cd ~/Firmware make clean # 清理历史编译文件 make px4_sitl_default gazebo # 重新编译 ``` --- ### **5. 验证Gazebo版本兼容性** - 检查PX4官方文档支持的Gazebo版本(如Gazebo 9/11) - 若版本不匹配,需卸载后安装指定版本: ```bash sudo apt-get remove gazebo* libgazebo* sudo apt-get install gazebo11 libgazebo11-dev # 示例:安装Gazebo 11 ``` --- ### **补充说明** - 若编译时出现`gstreamer-base-1.0`缺失错误,需安装: ```bash sudo apt-get install libgstreamer-plugins-base1.0-dev ``` - 若内存不足导致编译失败(如引用[3]),可尝试增加交换空间或使用`make -j2`限制线程数[^3] ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值