一、主要参考的内容

px4的开发者手册

https://dev.px4.io/zh/setup/dev_env_linux.html

其中有的shell指令

权限设置

警告:永远不要使用sudo来修复权限问题,否则会带来更多的权限问题,需要重装系统来解决。

把用户添加到用户组 "dialout":

 
sudo usermod -a -G dialout $USER

然后注销后,重新登录,因为重新登录后所做的改变才会有效。

安装

更新包列表,安装下面编译PX4的依赖包。PX4主要支持的系列:

提示:安装Ninja Build System可以比make更快进行编译。如果安装了它就会自动选择使用它进行编译。

 
sudo add-apt-repository ppa:george-edison55/cmake-3.x -y
sudo apt-get update
# 必备软件
sudo apt-get install python-argparse git-core wget zip \
python-empy qtcreator cmake build-essential genromfs -y
# 仿真工具
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jre
sudo apt-get install ant protobuf-compiler libeigen3-dev libopencv-dev openjdk-8-jdk openjdk-8-jre

树莓派

树莓派开发者应该从下面地址下载树莓派Linux工具链。安装脚本会自动安装交叉编译工具链。如果想要用原生树莓派工具链在树莓派上直接编译,参见这里

 
git clone https://github.com/pixhawk/rpi_toolchain.git
cd rpi_toolchain
./install_cross.sh

在工具链安装过程中需要输入密码。

如果不想把工具链安装在默认位置/opt/rpi_toolchain,可以执行./install_cross.sh <PATH>向安装脚本传入其它地址。安装脚本会自动配置需要的环境变量。

最后,运行以下命令更新环境变量:

source ~/.profile

Raspberry Pi 2 开发板

以下命令编译生成Raspbian(posix_pi2_release)版本的固件。

cd Firmware
make posix_rpi2_release # for cross-compiler build

"mainapp"可执行文件位于目录build_posix_rpi2_release/src/firmware/posix下。 将其复制到RPi(用你的RPi的IP或主机名替换YOUR_PI,关于如何访问你的RPi,查看介绍)

然后使用以下命令设置你的RPi的IP(或主机名):

export AUTOPILOT_HOST=192.168.X.X

并上传:

cd Firmware
make posix_rpi_cross upload # for cross-compiler build

然后,通过ssh连接并运行它(以root权限):

sudo ./px4 px4.config

二、自己的添加和总结

make posix_rpi_cross后出现的问题:

-- CMAKE_MODULE_PATH: /home/myfly2/src/myFirmware/Firmware/cmake
-- Build Type: RelWithDebInfo
-- PX4 VERSION: v1.6.5--g4ccbeb4
-- CONFIG: posix-rpi-cross
-- CMAKE_INSTALL_PREFIX: /usr
-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
-- The ASM compiler identification is unknown
-- Found assembler: arm-linux-gnueabihf-gcc
CMake Error at CMakeLists.txt: (project):
The CMAKE_CXX_COMPILER: arm-linux-gnueabihf-g++ is not a full path and was not found in the PATH. Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH. CMake Error at CMakeLists.txt: (project):
The CMAKE_C_COMPILER: arm-linux-gnueabihf-gcc is not a full path and was not found in the PATH. Tell CMake where to find the compiler by setting either the environment
variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
the compiler, or to the compiler name if it is in the PATH. CMake Error at CMakeLists.txt: (project):
The CMAKE_ASM_COMPILER: arm-linux-gnueabihf-gcc is not a full path and was not found in the PATH. Tell CMake where to find the compiler by setting either the environment
variable "ASM" or the CMake cache entry CMAKE_ASM_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH. -- Warning: Did not find file Compiler/-ASM
-- Configuring incomplete, errors occurred!
See also "/home/myfly2/src/myFirmware/Firmware/build_posix_rpi_cross/CMakeFiles/CMakeOutput.log".
See also "/home/myfly2/src/myFirmware/Firmware/build_posix_rpi_cross/CMakeFiles/CMakeError.log".
/bin/sh: : cd: can't cd to /home/myfly2/src/myFirmware/Firmware/build_posix_rpi_cross
Makefile:: recipe for target 'posix_rpi_cross' failed
make: *** [posix_rpi_cross] Error

解决办法:

修改~/.profile,增加环境:

export RPI_TOOLCHAIN_DIR=/opt/rpi_toolchain/gcc-linaro-arm-linux-gnueabihf-raspbian
export PATH=$RPI_TOOLCHAIN_DIR/bin:$PATH
export AUTOPILOT_HOST=192.168.1.105

然后:

source ~/.profile

继续出现问题2:

-- CMAKE_MODULE_PATH: /home/myfly2/src/myFirmware/Firmware/cmake
-- Build Type: RelWithDebInfo
-- PX4 VERSION: v1.6.5--g4ccbeb4
-- CONFIG: posix-rpi-cross
-- CMAKE_INSTALL_PREFIX: /usr
-- The CXX compiler identification is GNU 4.8.
-- The C compiler identification is GNU 4.8.
-- The ASM compiler identification is GNU
-- Found assembler: /opt/rpi_toolchain/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
-- Check for working CXX compiler: /opt/rpi_toolchain/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++
-- Check for working CXX compiler: /opt/rpi_toolchain/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working C compiler: /opt/rpi_toolchain/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc
-- Check for working C compiler: /opt/rpi_toolchain/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.12")
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake: (message):
couldn't find python module jinja2: for debian systems try: sudo apt-get install python-jinja2 or for all other OSs/debian: sudo -H pip install jinja2 (missing: PY_JINJA2)
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake: (_FPHSA_FAILURE_MESSAGE)
cmake/common/px4_base.cmake: (find_package_handle_standard_args)
CMakeLists.txt: (px4_find_python_module) -- Configuring incomplete, errors occurred!
See also "/home/myfly2/src/myFirmware/Firmware/build_posix_rpi_cross/CMakeFiles/CMakeOutput.log".
/bin/sh: : cd: can't cd to /home/myfly2/src/myFirmware/Firmware/build_posix_rpi_cross
Makefile:: recipe for target 'posix_rpi_cross' failed
make: *** [posix_rpi_cross] Error

这个问题少了jinja2:

sudo apt-get install python-jinja2  

ubuntu配置px4编译环境的更多相关文章

  1. Ubuntu配置Android编译环境

    1.Ubuntu安装 VMware安装ubuntu之后,安装Vmware tools: 1.安装完ubuntu后,VMware Workstation菜单:虚拟机-->安装 Vmware Too ...

  2. 【转】ubuntu下安装eclipse以及配置python编译环境

    原文网址:http://blog.csdn.net/wangpengwei2/article/details/17580589 一.安装eclipse 1.从http://www.eclipse.or ...

  3. 为 Sublime Text 3059 配置 PHP 编译环境

    关于  Sublime Text 3059 的安装及汉化 请参看 http://www.xiumu.org/note/sublime-text-3.shtml 为 sublime Text 配置 PH ...

  4. 应用 EditPlus 配置 Java 编译环境

    此文全文摘抄自: http://jingyan.baidu.com/album/37bce2be3ceef61002f3a208.html?picindex=7,谢啦 应用成功: EditPlus(文 ...

  5. Sublime Text3 配置Python3编译环境

    Sublime Text3 配置Python编译环境 进入Sublime Text3 ,然后选择菜单:工具(T)==>编译系统(U)==>新编译系统... 把上面的代码换成如下代码: &q ...

  6. Ubuntu 配置 Android 开发 环境

    . 果断换Ubuntu了, Ubuntu的截图效果不好, 不能设置阴影 ... 作者 : 万境绝尘 转载请注明出处 : http://blog.csdn.net/shulianghan/article ...

  7. 在Ubuntu安装go编译环境

    在Ubuntu安装go编译环境 好记性不如烂笔头,所以趁热打铁记录下golang编译环境的安装过程. 首先下载一些依赖包: sudo apt-get install bison ed gawk gcc ...

  8. Editplus配置java编译环境

    EditPlus配置java编译环境 第一步:检测自己是否已经有jdk 1.win+r,输入cmd,打开控制台 2.控制台下输入javac出现类似的画面,代表jdk已经成功安装 第二步:打开Editp ...

  9. Linux下配置Objective-C编译环境

    Ubuntu环境下Objective-C编译环境配置参考这里. CentOS环境下Objective-C编译环境配置参考这里. 还在继续探索中.

随机推荐

  1. PCB下元器件重叠放置--Altium Designer

    这里指的是同层元件重叠,即在大的器件下放置小的器件:虽然程序设计规则默认同层元件重叠是错误的,但是在实际设计中,同层元件重叠却经常使用. 以Altium Designer9.0为例:不过好像规则里并没 ...

  2. Android中实现Activity的启动拦截之----实现360卫士的安装应用界面

    第一.摘要 今天不是周末,但是我已经放假了,所以就开始我们的技术探索之旅,今天我们来讲一下Android中最期待的技术,就是拦截Activity的启动,其实我在去年的时候,就像实现这个技术了,但是因为 ...

  3. <三剑客> 老大:awk命令用法

    awk是一种编程语言,用于在linux/unix下对文本和数据进行处理.数据可以来自标准输入(stdin).一 个或多个文件,或其它命令的输出.它支持用户自定义函数和动态正则表达式等先进功能,是lin ...

  4. Java学习之多态---类成员变化

    类成员 一.成员变量 编译时:变量(f)所属类(Fu)中是否有成员变量,有:编译成功,没有:编译失败 运行时:变量(f)所属类(Fu)中是否有成员变量,运行该类(Fu)中的成员变量 class Fu ...

  5. selenium,webdriver爬取斗鱼主播信息 实操

    from selenium import webdriver import time from bs4 import BeautifulSoup class douyuSelenium(): #初始化 ...

  6. Java空对象模式

    在“空对象”模式中,空对象将替换NULL对象实例的检查.而不是检查一个空值,Null对象反映一个无关的关系(即什么也不做). 这种Null对象还可以用于在数据不可用时提供默认行为. 在空对象模式(Nu ...

  7. struct和class的相同点与不同点

    struct是c语言中常用来定义结构体时使用的 class是c++中用来定义类时所使用的 相同 struct(结构体)和class(类)内均可有不同个数.不同类型的数据 定义时 都必须在前面加上str ...

  8. JS原型与原型链终极详解 (转载)

    这篇文章需要认认真真仔仔细细的看才能看懂 一. 普通对象与函数对象  JavaScript 中,万物皆对象!但对象也是有区别的.分为普通对象和函数对象,Object ,Function 是JS自带的函 ...

  9. Debug your ASP.NET Application while Hosted on IIS

    转摘:http://www.codeproject.com/Articles/37182/Debug-your-ASP-NET-Application-while-Hosted-on-IIS This ...

  10. document.location window.location

    document.location 和 window.location 取url的值的时候可以通用,但是 document是window的属性,所以不能直接用document.location =ur ...