Cygwin build of px4 firmware fails

I just installed the Cygwin PX4 Tool Chain on Win10 using the .msi. The initial build succeeded, but all subsequent builds fail with errors like the one below.
Doing a make clean does not fix the problem, just changes the file that cannot be renamed to “libsystemcmds__param.a”.
I cannot find any of these files on my disk and google searches for this sort of problem have not been helpful.

Any help would be greatly appreciated.

FAILED: src/modules/mc_pos_control/libmodules__mc_pos_control.a
: && /usr/bin/cmake.exe -E remove src/modules/mc_pos_control/libmodules__mc_pos_control.a && /cygdrive/c/PX4Cyg/toolchain/gcc-arm/bin/arm-none-eabi-ar.exe qc src/modules/mc_pos_control/libmodules__mc_pos_control.a src/modules/mc_pos_control/CMakeFiles/modules__mc_pos_control.dir/mc_pos_control_main.cpp.obj src/modules/mc_pos_control/CMakeFiles/modules__mc_pos_control.dir/PositionControl.cpp.obj src/modules/mc_pos_control/CMakeFiles/modules__mc_pos_control.dir/Utility/ControlMath.cpp.obj && /cygdrive/c/PX4Cyg/toolchain/gcc-arm/bin/arm-none-eabi-ranlib.exe src/modules/mc_pos_control/libmodules__mc_pos_control.a && :
C:\PX4Cyg\toolchain\gcc-arm\bin\arm-none-eabi-ar.exe: unable to rename ‘src/modules/mc_pos_control/libmodules__mc_pos_control.a’; reason: File exists
[583/648] Generating nuttx/drivers/libdrivers.a
ninja: build stopped: subcommand failed.


On further exploration, it seems this failure only happens when using the integrated terminal in VS Code (which is setup to run “run-console.bat”).
Running run-console.bat directly fixes the problem.

@MaEtUgR do you have any idea?

Sorry for the answer delay.

On the first glace it sounded to me like a permission problem. If the stuff gets run as administrator for the first time and then the build gets repeated as a user with very limited rights I can imagine something could break. But it’s still strange because judging from the error almost the whole build ran through and it fails at some of the last steps.

I’m happy you found out that running run-console.bat fixes the problem. Using that batch script directly worst case with elevated rights should be the first thing to test when something doesn’t work. What I also know is that if you run the build without bash login shell (see causes some pathon plugin to not load correctly. I myself use Visual Studio Code and have C:\PX4\run-console.bat as my default terminal for the workspace (also running it from power shell manually works) and never had a problem.