Build using ./waf showing error

I wanted to build the arbusub firmware from scratch. I followed the steps shown in Build ArduSub · GitBook

I configured the board using the command,

./waf configure --board px4-v2

for which the output was the following:

ardusub$ ./waf configure --board px4-v2
Setting top to                           : /home/abel/px4_docs/Source_Code/ardusub 
Setting out to                           : /home/abel/px4_docs/Source_Code/ardusub/build 
Autoconfiguration                        : enabled 
Setting board to                         : px4-v2 
Checking for program 'arm-none-eabi-ar'  : /home/abel/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-ar 
Using toolchain                          : arm-none-eabi 
Checking for 'g++' (C++ compiler)        : /home/abel/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-g++ 
Checking for 'gcc' (C compiler)          : /home/abel/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc 
Checking for c flags '-MMD'              : yes 
Checking for cxx flags '-MMD'            : yes 
Checking for HAVE_CMATH_ISFINITE         : no 
Checking for HAVE_CMATH_ISINF            : no 
Checking for HAVE_CMATH_ISNAN            : no 
Checking for NEED_CMATH_ISFINITE_STD_NAMESPACE : no 
Checking for NEED_CMATH_ISINF_STD_NAMESPACE    : no 
Checking for NEED_CMATH_ISNAN_STD_NAMESPACE    : no 
Checking for header endian.h                   : not found 
Checking for header byteswap.h                 : not found 
Checking for program 'cmake'                   : /usr/bin/cmake 
Checking cmake version                         : 3.5.1 
Checking for program 'ninja, ninja-build'      : /usr/bin/ninja 
Checking for program 'python'                  : /usr/bin/python 
Checking for python version >= 2.7.0           : 2.7.12 
Checking for program 'python'                  : /usr/bin/python 
Checking for python version >= 2.7.0           : 2.7.12 
Source is git repository                       : yes 
Update submodules                              : yes 
Checking for program 'git'                     : /usr/bin/git 
Gtest                                          : STM32 boards currently don't support compiling gtest 
Checking for program 'arm-none-eabi-size'      : /home/abel/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-size 
Benchmarks                                     : disabled 
Unit tests                                     : disabled 
Checking for program 'rsync'                   : /usr/bin/rsync 
'configure' finished successfully (1.045s)

Then I build using the command,

./waf build sub

to which I get an error message

[649/847] Compiling ArduCopter/crash_check.cpp
* Node /home/abel/px4_docs/Source_Code/ardusub/build/px4-v2/modules/PX4Firmware/CMakeCache.txt is created more than once (full message on 'waf -v -v'). The task generators are:
  1. 'px4_msg_gen' in /home/abel/px4_docs/Source_Code/ardusub
  2. 'bin/ardurover' in /home/abel/px4_docs/Source_Code/ardusub/APMrover2
  3. 'bin/antennatracker' in /home/abel/px4_docs/Source_Code/ardusub/AntennaTracker
  4. 'bin/arducopter' in /home/abel/px4_docs/Source_Code/ardusub/ArduCopter
  5. 'bin/arducopter-heli' in /home/abel/px4_docs/Source_Code/ardusub/ArduCopter
  6. 'bin/arduplane' in /home/abel/px4_docs/Source_Code/ardusub/ArduPlane
  7. 'bin/ardusub' in /home/abel/px4_docs/Source_Code/ardusub/ArduSub
Waf: Leaving directory `/home/abel/px4_docs/Source_Code/ardusub/build/px4-v2'
Build failed
 -> task in 'objs/AP_ADSB/ArduCopter' failed (exit status 1): 
	{task 139636676358544: cxx AP_ADSB.cpp -> AP_ADSB.cpp.4.o}
/home/abel/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-g++ -DCONFIG_ARCH_BOARD_PX4FMU_V2 -D__STDC_FORMAT_MACROS -D__PX4_NUTTX -D__DF_NUTTX -g -fno-exceptions -fno-rtti -std=gnu++0x -fno-threadsafe-statics -DCONFIG_WCHAR_BUILTIN -D__CUSTOM_FILE_IO__ -Wall -Werror -Wextra -Wno-sign-compare -Wfloat-equal -Wpointer-arith -Wmissing-declarations -Wno-unused-parameter -Werror=format-security -Werror=array-bounds -Wfatal-errors -Werror=unused-variable -Werror=reorder -Werror=uninitialized -Werror=init-self -Wframe-larger-than=1024 -Werror=unused-but-set-variable -Wformat=1 -Wdouble-promotion -Werror=double-promotion -Wno-missing-field-initializers -Os -fno-strict-aliasing -fomit-frame-pointer -funsafe-math-optimizations -ffunction-sections -fdata-sections -fno-strength-reduce -fno-builtin-printf -fvisibility=hidden -include visibility.h -mcpu=cortex-m4 -mthumb -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard -nodefaultlibs -nostdlib -std=gnu++11 -fdata-sections -ffunction-sections -fno-exceptions -fsigned-char -Wall -Wextra -Wformat -Wshadow -Wpointer-arith -Wcast-align -Wundef -Wno-unused-parameter -Wno-missing-field-initializers -Wno-reorder -Wno-redundant-decls -Wno-unknown-pragmas -Werror=format-security -Werror=array-bounds -Werror=uninitialized -Werror=init-self -Werror=switch -Werror=sign-compare -Wfatal-errors -Wno-trigraphs -Werror=unused-but-set-variable -Wno-error=cast-align -Wlogical-op -Wframe-larger-than=1300 -fsingle-precision-constant -Wno-attributes -Wno-error=double-promotion -Wno-error=missing-declarations -Wno-error=float-equal -Wno-error=undef -Wno-error=cpp -MMD -include ap_config.h -Ilibraries -Ilibraries/GCS_MAVLink -Imodules/uavcan/libuavcan/include/dsdlc_generated -I. -I../../libraries -I../../libraries/AP_Common/missing -I../../modules/uavcan/libuavcan/include -I../../modules/PX4Firmware/src -Imodules/PX4Firmware -Imodules/PX4Firmware/src -I../../modules/PX4Firmware/src/modules -I../../modules/PX4Firmware/src/include -I../../modules/PX4Firmware/src/lib -I../../modules/PX4Firmware/src/platforms -I../../modules/PX4Firmware/src/drivers/boards/px4fmu-v2 -Imodules/PX4Firmware/src/modules/px4_messages -Imodules/PX4Firmware/src/modules -I../../modules/PX4Firmware/mavlink/include/mavlink -I../../modules/PX4Firmware/src/lib/DriverFramework/framework/include -IArduCopter/src/lib/matrix -I../../ArduCopter/src/lib/matrix -Imodules/PX4Firmware/px4fmu-v2/NuttX/nuttx-export/include -Imodules/PX4Firmware/px4fmu-v2/NuttX/nuttx-export/include/cxx -Imodules/PX4Firmware/px4fmu-v2/NuttX/nuttx-export/arch/chip -Imodules/PX4Firmware/px4fmu-v2/NuttX/nuttx-export/arch/common -DSKETCHBOOK="/home/abel/px4_docs/Source_Code/ardusub" -DCONFIG_HAL_BOARD=HAL_BOARD_PX4 -DHAVE_OCLOEXEC=0 -DHAVE_STD_NULLPTR_T=0 -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 -DUAVCAN_NO_ASSERTIONS=1 -DUAVCAN_NULLPTR=nullptr -DAPM_BUILD_DIRECTORY=APM_BUILD_ArduCopter -DSKETCH="ArduCopter" -DSKETCHNAME="ArduCopter" ../../libraries/AP_ADSB/AP_ADSB.cpp -c -olibraries/AP_ADSB/AP_ADSB.cpp.4.o

How should I continue?

I hope my problem was correctly explained.

Thanks

Abel

Hi,

Right now the ArduPilot project is only compatible with gcc 4.9 for stability reasons.
You can install “gcc-arm-none-eabi 4.9” and export the path for waf.

# in my machine
export PATH=/opt/gcc-arm-none-eabi-4_9-2015q3/bin/:$PATH

This is described under the Compiling topic.

You can get the correct gcc here.

Thanks, @patrickelectric & @jwalser.

It’s working.

1 Like