PX4源碼分析15:初次編譯,No CMAKE_CXX_COMPILER could be found,需要設置環境變量CXX

簡略描述:

驗證nuttx安裝完整性
第一步:arm-none-eabi-gcc --version
第二步:sudo apt install gcc-arm-none-eabi
再次編譯問題解決

詳細描述

筆者用官方ubuntu.sh配置好編譯環境後,初次用“make px4_fmu-v2_default”命令編譯1.10.1stb版本的PX4固件時遇到如下問題:

arm-none-eabi-g++   路徑不完整,找不到
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.

說明我們在首次編譯前沒有驗證nuttx的安裝完整性,你可以通過確認gcc的版本來驗證Nuttx的安裝,如果安裝不完整,系統會提醒我們該裝什麼來修復:

輸入:arm-none-eabi-gcc --version
輸出:Command 'arm-none-eabi-gcc' not found, but can be installed with:
	 sudo apt install gcc-arm-none-eabi

系統告訴我們需要安裝gcc-arm-none-eabi,因此:

輸入:sudo apt install gcc-arm-none-eabi
輸出:...
	 正在設置 libstdc++-arm-none-eabi-newlib (15:6.3.1+svn253039-1+10) ...
	 正在設置 gcc-arm-none-eabi (15:6.3.1+svn253039-1build1) ...
	 正在處理用於 man-db (2.8.3-2ubuntu0.1) 的觸發器 ...
	 正在處理用於 ccache (3.4.1-1) 的觸發器 ...
	 Updating symlinks in /usr/lib/ccache ...
	 正在處理用於 libc-bin (2.27-3ubuntu1) 的觸發器 ...

我們再來驗證一次nuttx的安裝完整性:

輸入:arm-none-eabi-gcc --version
輸出:arm-none-eabi-gcc (15:6.3.1+svn253039-1build1) 6.3.1 20170620
	 Copyright (C) 2016 Free Software Foundation, Inc.
	 This is free software; see the source for copying conditions.  There is NO
	 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

說明nuttx已經完整安裝,接着我們再次編譯測試:

輸入:make px4_fmu-v2_default
輸出:[0/7] Performing build step for 'px4io_firmware'
	 ninja: no work to do.
	 [7/7] Creating /home/heng/桌面/v1.10..._fmu-v2_default/px4_fmu-v2_default.px4

編譯通過,問題解決

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章