PX4 V1.13.0 conflicting declaration of c functiond

Hello
I’m trying to build the latest version of PX4 (1.13) for my cube orange. I’m using PX4 toolchain on windows 10. I used this command to make it:
"make cubpilot_cubeorange "

Older versions build fine but I need the latest version, it seems that the error is in the cmath function which has been recently added to the source files. Here is the bottom part of the message report…can someon suggest a reason for it?

.
[31/1092] Building CXX object src/drivers/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/node/uc_scheduler.cpp.ob
FAILED: src/drivers/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/node/uc_scheduler.cpp.obj
/cygdrive/c/PX4/toolchain/gcc-arm/bin/arm-none-eabi-g++.exe -DCONFIG_ARCH_BOARD_CUBEPILOT_CUBEORANGE -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 -DUAVCAN_DRIVER=uavcan_stm32h7 -DUAVCAN_IMPLEMENT_PLACEMENT_NEW=1 -DUAVCAN_MEM_POOL_BLOCK_SIZE=48 -DUAVCAN_NO_ASSERTIONS -DUAVCAN_PLATFORM=generic -DUAVCAN_STM32H7_NUM_IFACES=2 -DUAVCAN_STM32H7_NUTTX=1 -DUAVCAN_STM32H7_TIMER_NUMBER=5 -D_SYS_CDEFS_H_ -D_SYS_REENT_H_ -D__CUSTOM_FILE_IO__ -D__PX4_NUTTX -D__STDC_FORMAT_MACROS -I…/…/boards/cubepilot/cubeorange/src -I…/…/platforms/nuttx/src/px4/common/include -I. -Isrc/lib -I…/…/platforms/nuttx/src/px4/stm/stm32h7/include -I…/…/platforms/common -I…/…/platforms/common/include -I…/…/src -I…/…/src/include -I…/…/src/lib -I…/…/src/lib/matrix -I…/…/src/modules -I…/…/platforms/nuttx/NuttX/nuttx/arch/arm/src/armv7-m -I…/…/platforms/nuttx/NuttX/nuttx/arch/arm/src/chip -I…/…/platforms/nuttx/NuttX/nuttx/arch/arm/src/common -I…/…/platforms/nuttx/NuttX/apps/include -Iexternal/Install/include -I…/…/src/drivers/uavcan/libuavcan/./libuavcan/include -I…/…/src/drivers/uavcan/libuavcan/./libuavcan/include/dsdlc_generated -I…/…/src/drivers/uavcan/libuavcan/libuavcan/include/dsdlc_generated -I…/…/src/drivers/uavcan/libuavcan/libuavcan/include -isystem …/…/platforms/nuttx/NuttX/include/cxx -isystem …/…/platforms/nuttx/NuttX/nuttx/include/cxx -isystem …/…/platforms/nuttx/NuttX/nuttx/include -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -Wall -Wextra -Wundef -std=c++11 -Os -DNDEBUG -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -fno-exceptions -fno-threadsafe-statics -Wreorder -Wno-overloaded-virtual -fno-rtti -nostdinc++ -fno-sized-deallocation -Wno-cast-align -Wno-deprecated-copy -Wno-address-of-packed-member -std=gnu++14 -MD -MT src/drivers/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/node/uc_scheduler.cpp.obj -MF src/drivers/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/node/uc_scheduler.cpp.obj.d -o src/drivers/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/node/uc_scheduler.cpp.obj -c …/…/src/drivers/uavcan/libuavcan/libuavcan/src/node/uc_scheduler.cpp
In file included from …/…/src/drivers/uavcan/libuavcan/./libuavcan/include/uavcan/util/templates.hpp:10:0,
from …/…/src/drivers/uavcan/libuavcan/./libuavcan/include/uavcan/util/linked_list.hpp:12,
from …/…/src/drivers/uavcan/libuavcan/./libuavcan/include/uavcan/node/scheduler.hpp:9,
from …/…/src/drivers/uavcan/libuavcan/libuavcan/src/node/uc_scheduler.cpp:5:
…/…/platforms/nuttx/NuttX/include/cxx/cmath: In function ‘bool std::isfinite(double)’:
…/…/platforms/nuttx/NuttX/include/cxx/cmath:60:13: error: conflicting declaration of C function ‘bool std::isfinite(double)’
inline bool isfinite(double value) { return <em><em>builtin_isfinite(value); }
^~~~~~~~
compilation terminated due to -Wfatal-errors.
[32/1092] Building CXX object src/drivers/uavcan/libuavcan…MakeFiles/uavcan.dir/src/node/uc_generic_publisher.cpp.obj
FAILED: src/drivers/uavcan/libuavcan/libuavcan/CMakeFiles/uavcan.dir/src/node/uc_generic_publisher.cpp.obj</em></em>

Hey! I have this problem too. Have you found any solutions?

@Edikscrmp can you please describe the commands you’re running and the full output? I need to know version of PX4. Version of the compiler, etc.

I download The latest PX4 source code, via

git clone https://github.com/PX4/PX4-Autopilot.git --recursive

and trying to build firmware for Kakute H7:

After that, it was necessary to install a couple of libraries:




After that:


-- PX4 version: v1.14.0-beta1-112-g54d825730e
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.6.9", minimum required is "3") 
-- PX4 config file: /home/clever/Documents/PX4-Autopilot/boards/holybro/kakuteh7/default.px4board
-- PLATFORM nuttx
-- TOOLCHAIN arm-none-eabi
-- ARCHITECTURE cortex-m7
-- ROMFSROOT px4fmu_common
-- SERIAL_GPS1 /dev/ttyS3
-- SERIAL_TEL1 /dev/ttyS0
-- SERIAL_TEL2 /dev/ttyS1
-- SERIAL_RC /dev/ttyS4
-- PX4 config: holybro_kakuteh7_default
-- PX4 platform: nuttx
-- The CXX compiler identification is GNU 7.2.1
-- The C compiler identification is GNU 7.2.1
-- The ASM compiler identification is GNU
-- Found assembler: /opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc
-- Check for working CXX compiler: /opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-g++
-- Check for working CXX compiler: /opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-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/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc
-- Check for working C compiler: /opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Enabling double FP precision hardware instructions
-- cmake build type: MinSizeRel
-- ccache enabled (export CCACHE_DISABLE=1 to disable)
CMake Warning at src/modules/microdds_client/CMakeLists.txt:35 (message):
  skipping microdds_client, Micro-XRCE-DDS-Client needs to be fixed to work
  with CMAKE_VERSION 3.10.2


-- ROMFS: ROMFS/px4fmu_common
-- ROMFS:  Adding platforms/nuttx/init/stm32h7/rc.board_arch_defaults -> /etc/init.d/rc.board_arch_defaults
-- ROMFS:  Adding boards/holybro/kakuteh7/init/rc.board_defaults -> /etc/init.d/rc.board_defaults
-- ROMFS:  Adding boards/holybro/kakuteh7/init/rc.board_sensors -> /etc/init.d/rc.board_sensors
-- ROMFS:  Adding boards/holybro/kakuteh7/init/rc.board_extras -> /etc/init.d/rc.board_extras
-- ROMFS:  Adding boards/holybro/kakuteh7/extras/holybro_kakuteh7_bootloader.bin -> /etc/extras/holybro_kakuteh7_bootloader.bin
-- Configuring done
-- Generating done
-- Build files have been written to: /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default
[2/1040] git submodule src/drivers/gps/devices
[3/1040] git submodule platforms/nuttx/NuttX/nuttx
[5/1040] git submodule src/modules/mavlink/mavlink
[7/1040] Generating Mavlink common: src/modules/mavlink/mavlink/message_definitions/v1.0/common.xml
WARNING: Failed to import lxml module etree. Are lxml, libxml2 and libxslt installed? XML validation will not be performed
Validation skipped for /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/common.xml.
Parsing /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/common.xml
Validation skipped for /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/standard.xml.
Parsing /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/standard.xml
Validation skipped for /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/minimal.xml.
Parsing /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/minimal.xml
Found 221 MAVLink message types in 3 XML files
Generating C implementation in directory /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default/mavlink/common
Generating C implementation in directory /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default/mavlink/standard
Generating C implementation in directory /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default/mavlink/minimal
Copying fixed headers for protocol 2.0 to /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default/mavlink
[10/1040] Generating Mavlink uAvionix: src/modules/mavlink/mavlink/message_definitions/v1.0/uAvionix.xml
WARNING: Failed to import lxml module etree. Are lxml, libxml2 and libxslt installed? XML validation will not be performed
Validation skipped for /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/uAvionix.xml.
Parsing /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/uAvionix.xml
Validation skipped for /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/common.xml.
Parsing /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/common.xml
Validation skipped for /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/standard.xml.
Parsing /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/standard.xml
Validation skipped for /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/minimal.xml.
Parsing /home/clever/Documents/PX4-Autopilot/src/modules/mavlink/mavlink/message_definitions/v1.0/minimal.xml
Found 224 MAVLink message types in 4 XML files
Generating C implementation in directory /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default/mavlink/uAvionix
Generating C implementation in directory /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default/mavlink/common
Generating C implementation in directory /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default/mavlink/standard
Generating C implementation in directory /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default/mavlink/minimal
Copying fixed headers for protocol 2.0 to /home/clever/Documents/PX4-Autopilot/build/holybro_kakuteh7_default/mavlink
[23/1040] Building CXX object src/lib/geo/CMakeFiles/geo.dir/geo.cpp.obj
FAILED: src/lib/geo/CMakeFiles/geo.dir/geo.cpp.obj 
/usr/bin/ccache /opt/gcc-arm-none-eabi-7-2017-q4-major/bin/arm-none-eabi-g++  -DCONFIG_ARCH_BOARD_HOLYBRO_KAKUTEH7 -D_SYS_CDEFS_H_ -D_SYS_REENT_H_ -D__CUSTOM_FILE_IO__ -D__PX4_NUTTX -D__STDC_FORMAT_MACROS -isystem ../../platforms/nuttx/NuttX/include/cxx -isystem ../../platforms/nuttx/NuttX/nuttx/include/cxx -isystem ../../platforms/nuttx/NuttX/nuttx/include -I../../boards/holybro/kakuteh7/src -I../../platforms/nuttx/src/px4/common/include -I. -Isrc/lib -I../../platforms/nuttx/src/px4/stm/stm32h7/include -I../../platforms/common -I../../platforms/common/include -I../../src -I../../src/include -I../../src/lib -I../../src/lib/matrix -I../../src/modules -I../../platforms/nuttx/NuttX/nuttx/arch/arm/src/armv7-m -I../../platforms/nuttx/NuttX/nuttx/arch/arm/src/chip -I../../platforms/nuttx/NuttX/nuttx/arch/arm/src/common -I../../platforms/nuttx/NuttX/apps/include -Iexternal/Install/include -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -Os -DNDEBUG   -g -fdata-sections -ffunction-sections -fomit-frame-pointer -fmerge-all-constants -fno-signed-zeros -fno-trapping-math -freciprocal-math -fno-math-errno -fno-strict-aliasing -fvisibility=hidden -include visibility.h -Wall -Wextra -Werror -Warray-bounds -Wcast-align -Wdisabled-optimization -Wdouble-promotion -Wfatal-errors -Wfloat-equal -Wformat-security -Winit-self -Wlogical-op -Wpointer-arith -Wshadow -Wuninitialized -Wunknown-pragmas -Wunused-variable -Wno-missing-field-initializers -Wno-missing-include-dirs -Wno-unused-parameter -fdiagnostics-color=always -fno-builtin-printf -fno-strength-reduce -Wformat=1 -Wunused-but-set-variable -Wno-format-truncation -fcheck-new -Wreorder -Wno-overloaded-virtual -fno-rtti -fno-exceptions -fno-sized-deallocation -fno-threadsafe-statics -nostdinc++ -O2 -std=gnu++14 -MD -MT src/lib/geo/CMakeFiles/geo.dir/geo.cpp.obj -MF src/lib/geo/CMakeFiles/geo.dir/geo.cpp.obj.d -o src/lib/geo/CMakeFiles/geo.dir/geo.cpp.obj -c ../../src/lib/geo/geo.cpp
In file included from ../../src/lib/matrix/matrix/helper_functions.hpp:3:0,
                 from ../../src/lib/matrix/matrix/math.hpp:6,
                 from ../../src/lib/mathlib/math/Functions.hpp:45,
                 from ../../src/lib/mathlib/mathlib.h:45,
                 from ../../src/lib/geo/geo.h:53,
                 from ../../src/lib/geo/geo.cpp:45:
../../platforms/nuttx/NuttX/include/cxx/cmath: In function 'bool std::isfinite(double)':
../../platforms/nuttx/NuttX/include/cxx/cmath:60:13: error: conflicting declaration of C function 'bool std::isfinite(double)'
 inline bool isfinite(double value) { return __builtin_isfinite(value); }
             ^~~~~~~~
compilation terminated due to -Wfatal-errors.
[25/1040] Generating uORB topic sources
ninja: build stopped: subcommand failed.
Makefile:227: recipe for target 'holybro_kakuteh7_default' failed
make: *** [holybro_kakuteh7_default] Error 1

This looks like a fairly old GCC toolchain.

I suggest you try the one suggest in the setup script:

1 Like

I had the same issue and updating the toolchain as you mentioned helped resolve it.
However, the part of the script that you pointed out didn’t work as expected since the link is broken.
The following step worked for me (linux):

  1. Download the tar file from the following link Downloads | GNU Arm Embedded Toolchain Downloads – Arm Developer
  2. extract the tar file to /opt
    sudo tar -jxf gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 -C /opt/
  3. Add it to the path in bashrc
    echo "export PATH=/opt/gcc-arm-none-eabi-9-2020-q2-update/bin:\$PATH" >> $HOME/.bashrc
  4. Go to the PX4-Autopilot directory, clean and build again (make sure to use your corresponding target, I used KakuteF7)
    cd PX4-Autopilot && make distclean && make holybro_kakutef7_default
2 Likes