Ubuntu Configuration PX4 Compilation environment

Source: Internet
Author: User
Tags posix

First, the main reference content

PX4 Developer's Manual

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

Some of these shell instructions

Permission settings

Warning: Never use sudo to fix permissions problems, otherwise it will bring more permissions problems, need to reload the system to solve.

Add user to User group "dialout":

-a -G dialout $USER

Then log off and sign in again, because the changes you made after logging in will not be valid.

Installation

Update the package list, and install the following dependency package that compiles PX4. PX4 Main Supported series:

    • NUTTX based Hardware:pixhawk, Pixfalcon, Pixracer, Crazyflie, Intel? Aero Ready to Fly Drone
    • Qualcomm Snapdragon Flight Hardware
    • linux-based hardware:raspberry Pi 2/3, Parrot Bebop
    • Host Simulation:jmavsim sitl and Gazebo SITL

Tip: Installing the Ninja build system can be compiled faster than make. If it is installed, it is automatically selected to be compiled with it.

sudo add-apt-repository ppa:george-edison55/cmake-3.x -ysudo 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/ppasudo apt-get updatesudo apt-get install openjdk-8-jresudo apt-get install ant protobuf-compiler libeigen3-dev libopencv-dev openjdk-8-jdk openjdk-8-jre 
Raspberry Pi

Raspberry Pi Developers should download the Raspberry Pi Linux toolchain from the address below. The installation script automatically installs the cross-compilation toolchain. If you want to compile directly on the Raspberry Pi using the native Raspberry Pi toolchain, see here.

clone https://github.com/pixhawk/rpi_toolchain.gitcd rpi_toolchain./install_cross.sh

You need to enter a password during the tool chain installation.

If you do not want to install the toolchain in the default location /opt/rpi_toolchain , you can ./install_cross.sh <PATH> pass the installation script to another address. The installation script automatically configures the required environment variables.

Finally, run the following command to update the environment variables:

source ~/.profile

Raspberry Pi 2 Development Board

The following command compiles the firmware that generates the Raspbian (posix_pi2_release) version.

cd Firmwaremake posix_rpi2_release # for cross-compiler build

The "Mainapp" executable file is located under directory Build_posix_rpi2_release/src/firmware/posix. Copy it to RPI (replace YOUR_PI with your RPI's IP or hostname, about how to access your RPI, see the introduction)

Then use the following command to set the IP (or hostname) of your RPI:

export AUTOPILOT_HOST=192.168.X.X

and upload:

cd Firmwaremake posix_rpi_cross upload # for cross-compiler build

Then, connect and run it via SSH (with root permission):

sudo ./px4 px4.config

Second, their own add and summarize make Posix_rpi_cross after the problem:
--Cmake_module_path:/home/myfly2/src/myfirmware/firmware/CMake--Build Type:relwithdebinfo--PX4 Version:v1.6.5- the-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-GCCCMake Error at CMakeLists.txt:275(Project): The Cmake_cxx_compiler:arm-linux-gnueabihf-g++Is isn't a full path and were not foundinchThe PATH. Tell CMake where toFindThe 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 nameifIt isinchThe PATH. CMake Error at CMakeLists.txt:275(Project): The Cmake_c_compiler:arm-linux-gnueabihf-GCCIs isn't a full path and were not foundinchThe PATH. Tell CMake where toFindThe 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 nameifIt isinchThe PATH. CMake Error at CMakeLists.txt:275(Project): The Cmake_asm_compiler:arm-linux-gnueabihf-GCCIs isn't a full path and were not foundinchThe PATH. Tell CMake where toFindThe 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 nameifIt isinchThe PATH.--Warning:did notFind filecompiler/-@Sl--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:1: Cd:can'T CD To/home/myfly2/src/myfirmware/firmware/build_posix_rpi_crossMakefile:158: recipe forTarget'Posix_rpi_cross'failed Make: * * * [Posix_rpi_cross] Error2

Workaround:

Modify the ~/.profile to increase the environment:

Export rpi_toolchain_dir=/opt/rpi_toolchain/gcc-linaro-arm-linux-gnueabihf-raspbianexport PATH = $RPI _toolchain_dir/bin: $PATHexport autopilot_host=192.168. 1.105

And then:

SOURCE ~/.profile

Continue to Issue 2:
--Cmake_module_path:/home/myfly2/src/myfirmware/firmware/CMake--Build Type:relwithdebinfo--PX4 Version:v1.6.5- the-G4CCBEB4--config:posix-rpi- Cross--Cmake_install_prefix:/usr--The CXX compiler identification is GNU4.8.3--The C compiler identification is GNU4.8.3--The ASM compiler identification is GNU--Found Assembler:/opt/rpi_toolchain/GCC-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-GCC--Check forWorking CXX Compiler:/opt/rpi_toolchain/GCC-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++--Check forWorking CXX Compiler:/opt/rpi_toolchain/GCC-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-g++--Works--Detecting CXX compiler ABIInfo--Detecting CXX compiler ABIInfo- Done--detecting CXX Compile features--detecting CXX compile Features- Done--Check forWorking C Compiler:/opt/rpi_toolchain/GCC-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-GCC--Check forWorking C Compiler:/opt/rpi_toolchain/GCC-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-GCC--Works--Detecting C compiler ABIInfo--Detecting C compiler ABIInfo- 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:148(message): Couldn't find python module JINJA2:             forDebian Systems Try:sudoApt-getInstallpython-JINJA2 or forAll other oss/Debian:sudo-H PIPInstallJINJA2 (MISSING:PY_JINJA2) Call Stack (most recent call first):/usr/share/cmake-3.5/modules/findpackagehandlestandardargs.cmake:388(_fphsa_failure_message) CMake/common/px4_base.cmake:621(Find_package_handle_standard_args) CMakeLists.txt:295(Px4_find_python_module)--Configuring incomplete, Errors occurred!See also"/home/myfly2/src/myfirmware/firmware/build_posix_rpi_cross/cmakefiles/cmakeoutput.log"./bin/SH:1: Cd:can'T CD To/home/myfly2/src/myfirmware/firmware/build_posix_rpi_crossMakefile:158: recipe forTarget'Posix_rpi_cross'failed Make: * * * [Posix_rpi_cross] Error2

The problem is less jinja2:

sudo Install PYTHON-JINJA2  

Ubuntu Configuration PX4 Compilation environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.