PX4在变编译的时候总会碰到很多问题。有些问题根据提示就可以解决,有些问题却有点麻烦。
1 找不到python jinja2模块
CMake Error at /usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
couldn't find python module jinja2:
for debian systems try:
sudo apt-get install python-jinja2
or for all other OSs/debian:
pip install jinja2
(missing: PY_JINJA2)
Call Stack (most recent call first):
/usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)
cmake/common/px4_base.cmake:1295 (find_package_handle_standard_args)
CMakeLists.txt:276 (px4_find_python_module)
-- Configuring incomplete, errors occurred!
解决方案:缺什么安什么
Windows系统下:
pip install jinja2
Linux系统下:
sudo apt-get install python-jinja2
2 Windows下出现rsync error错误
The source and destination cannot both be remote
rsync error: syntax or usage error (code 1) at /usr/src/rsync/rsync-3.0.8/main.c(1148) [receiver=3.0.8]
make[3]: *** [nuttx_copy_px4fmu-v2.stamp] Error 1
make[2]: *** [CMakeFiles/nuttx_copy_px4fmu-v2.dir/all] Error 2
make[2]: *** Waiting for unfilished jobs....
The source and destination cannot both be remote
rsync error: syntax or usage error (code 1) at /usr/src/rsync/rsync-3.0.8/main.c(1148) [receiver=3.0.8]
make[3]: *** [src/modules/px4iofirmware/nuttx_copy_px4fmu-v2.stamp] Error 1
make[2]: *** [src/modules/px4iofirmware/nuttx_copy_px4fmu-v2.dir/all] Error 2
make[1]: *** [all] Error 2
make[1]: *** [px4fmu-v2_default] Error 2
解决方案:cmake nuttx rsync 仅使用相对路径进行复制
对Firmware/cmake/nuttx/px4_impl_nuttx.cmake文件进行更改,点击 传送门
3 内存溢出
collect2.exe:error:ld returned 1 exit status
make[3]: *** [src/firmware/nuttx/firmware_muttx] Error 1
make[2]: *** [src/firmware/nuttx/CMakeFiles/firmware_muttx.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [px4fmu-v2_default] Error 2
解决方案:移除不是必要的模块. 配置在这里. 为了移除一个模块, 可以直接注释掉它:
对于FMUv2(Pixhawk1)或者FMUv3(Pixhawk 2)硬件,找到Firmware/cmake/configs/nuttx_px4fmu-v2_default.cmake
修改为:
#drivers/trone
在最新版本中可能没有上述模块,可以把下面几个模块注释掉
drivers/differential_pressure/ms4525
drivers/differential_pressure/ms5525
drivers/differential_pressure/sdp3x
drivers/distance_sensor/sf0x
drivers/distance_sensor/sf1xx
drivers/distance_sensor/srf02
这几个都是压力传感器距离传感器的驱动模块,只要你没有用掉去掉后就无妨。
4 gcc 版本
这里也有内存溢出的问题,GCC版本出错的图片找不到了,需要将将arm-none-eabi-gcc 换成4.9.4或
5.4.3 。在windows环境下需要把安装包解压后的文件替换掉px4\toolchain下面的目录。如果在Linux环境下,则参考
点击打开链接
大部分内容参考自点击打开链接