Help Needed: CMake Error - C++ Compiler Fails to Compile Test Program for make px4_fmu-v3_default

Hi PX4 community,
I’m facing an issue while running make px4_fmu-v3_default in my PX4-Autopilot setup on Cygwin ( windows ). The build process stops with a CMake error indicating that the C++ compiler (arm-none-eabi-g++) cannot compile a simple test program. Here’s the relevant error message:

Dell@Harsh ~/PX4-Autopilot
$ make px4_fmu-v3_default VERBOSE=1
Re-run cmake no build system arguments
-- PX4_GIT_TAG: v1.15.0-beta1-2620-ge8f8bc9af7
CMake Warning (dev) at CMakeLists.txt:176 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.9.16", minimum required is "3")
-- PX4 config file: /cygdrive/c/PX4/home/PX4-Autopilot/boards/px4/fmu-v3/default.px4board
-- PLATFORM nuttx
-- TOOLCHAIN arm-none-eabi
-- ARCHITECTURE cortex-m4
-- ROMFSROOT px4fmu_common
-- IO px4_io-v2_default
-- CONSTRAINED_MEMORY y
-- SERIAL_GPS1 /dev/ttyS3
-- SERIAL_TEL1 /dev/ttyS1
-- SERIAL_TEL2 /dev/ttyS2
-- SERIAL_TEL4 /dev/ttyS6
-- ROOT_PATH /fs/microsd
-- PARAM_FILE /fs/mtd_params
-- UAVCAN_INTERFACES 2
-- PX4 config: px4_fmu-v3_default
-- PX4 platform: nuttx
-- The CXX compiler identification is GNU 9.3.1
-- The C compiler identification is GNU 9.3.1
-- The ASM compiler identification is GNU
-- Found assembler: /cygdrive/c/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-gcc.exe
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - failed
-- Check for working CXX compiler: /cygdrive/c/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-g++.exe
-- Check for working CXX compiler: /cygdrive/c/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-g++.exe - broken
CMake Error at /usr/share/cmake-3.28.3/Modules/CMakeTestCXXCompiler.cmake:60 (message):
  The C++ compiler

    "/cygdrive/c/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-g++.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: '/cygdrive/c/PX4/home/PX4-Autopilot/build/px4_fmu-v3_default/CMakeFiles/CMakeScratch/TryCompile-sRqtpb'

    Run Build Command(s): /usr/bin/ninja.exe -v cmTC_88049
    [1/2] "/cygdrive/c/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-g++.exe"    -o CMakeFiles/cmTC_88049.dir/testCXXCompiler.cxx.obj -c /cygdrive/c/PX4/home/PX4-Autopilot/build/px4_fmu-v3_default/CMakeFiles/CMakeScratch/TryCompile-sRqtpb/testCXXCompiler.cxx
    FAILED: CMakeFiles/cmTC_88049.dir/testCXXCompiler.cxx.obj
    "/cygdrive/c/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-g++.exe"    -o CMakeFiles/cmTC_88049.dir/testCXXCompiler.cxx.obj -c /cygdrive/c/PX4/home/PX4-Autopilot/build/px4_fmu-v3_default/CMakeFiles/CMakeScratch/TryCompile-sRqtpb/testCXXCompiler.cxx
    arm-none-eabi-g++.exe: error: /cygdrive/c/PX4/home/PX4-Autopilot/build/px4_fmu-v3_default/CMakeFiles/CMakeScratch/TryCompile-sRqtpb/testCXXCompiler.cxx: No such file or directory
    arm-none-eabi-g++.exe: fatal error: no input files
    compilation terminated.
    ninja: build stopped: subcommand failed.





  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:230 (project)


-- Configuring incomplete, errors occurred!
Error: /cygdrive/c/PX4/home/PX4-Autopilot/build/px4_fmu-v3_default is not a directory
make: *** [Makefile:227: px4_fmu-v3_default] Error 1

Dell@Harsh ~/PX4-Autopilot
$ which arm-none-eabi-gcc
/cygdrive/c/Program Files (x86)/GNU Arm Embedded Toolchain/9 2020-q2-update/bin/arm-none-eabi-gcc

I’ve confirmed that the toolchain path and permissions are correctly set, but the compilation still fails. Any guidance to help resolve this issue would be much appreciated!

Hello,

Have you tried make distclean and build again?

Is there any chance you could also build on an native Ubuntu?

Yes I have tried make dist clean but the result is same. Also I have followed the steps in Ubuntu and successful in it but I wanted to try that out in windows cygwin just to get a good idea.

1 Like

are there any other things i should try to resolve the errors ?

Sorry, I cannot help you.
I do not use Windows for dev.

Yes, don’t use Cygwin. It hasn’t been supported since PX4 v1.11. It might work on that version, but no guarantees after that. Windows Development Environment (Cygwin-based) | PX4 Guide (main).
There have been a bunch of gcc compiler updates etc since the version in cygwin.

I’d remove it, but someone might be able to restore it one day. Personally I wouldn’t bother - WSL 2 works great.

1 Like