Nuttx Patch Compilation Error


I’m not sure what to make of this. I looked around and I couldn’t find any information on how to fix this error.
I’ve had other successful builds with v1.5.5 (kinda, the GPS didn’t work well with QGC, but I digress)
I tried using make distclean and then trying to build it as well, but it still didn’t work.

The firmware I am using was downloaded from PX4/Firmware/releases. I unpacked the source code and initialized it with Github.

Here’s the terminal error response and the referenced stat.h.rej file.

thinking-intern@Thinking-Machine:~/Documents/PX4/Firmware/Firmware-v1.6.0$ make px4fmu-v2_default
-- PX4 VERSION: 4f8b5fa
-- CONFIG: nuttx-px4fmu-v2-default
-- CMAKE_MODULE_PATH: /home/thinking-intern/Documents/PX4/Firmware/Firmware-v1.6.0/cmake
-- Nuttx build for px4fmu-v2 on m4 hardware, using nsh with ROMFS on px4fmu_common
-- The ASM compiler identification is GNU
-- Found assembler: /home/thinking-intern/gcc-arm-none-eabi-5_4-2016q2/bin/arm-none-eabi-gcc
-- Found PythonInterp: /usr/bin/python (found version "2.7.12") 
-- Found PY_jinja2: /usr/lib/python2.7/dist-packages/jinja2  
-- C compiler: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715]
-- C++ compiler: arm-none-eabi-g++ (GNU Tools for ARM Embedded Processors) 5.4.1 20160609 (release) [ARM/embedded-5-branch revision 237715]
-- Adding ROMFS on px4fmu-v2
-- Nuttx build for px4fmu-v2 on m3 hardware, using nsh 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/thinking-intern/Documents/PX4/Firmware/Firmware-v1.6.0/build_px4fmu-v2_default
[11/558] px4fmu-v2: nuttx-patches/00002-REJECTED-fix-shadow-wanings.patch applied
FAILED: px4fmu-v2/NuttX/px4fmu-v2-nuttx_patch_00002-REJECTED-fix-shadow-wanings.patch.stamp 
cd /home/thinking-intern/Documents/PX4/Firmware/Firmware-v1.6.0/build_px4fmu-v2_default && /usr/bin/patch --verbose -d /home/thinking-intern/Documents/PX4/Firmware/Firmware-v1.6.0/build_px4fmu-v2_default/px4fmu-v2/NuttX -s -p1 -N < /home/thinking-intern/Documents/PX4/Firmware/Firmware-v1.6.0/nuttx-patches/00002-REJECTED-fix-shadow-wanings.patch && cmake -E touch /home/thinking-intern/Documents/PX4/Firmware/Firmware-v1.6.0/build_px4fmu-v2_default/px4fmu-v2/NuttX/px4fmu-v2-nuttx_patch_00002-REJECTED-fix-shadow-wanings.patch.stamp
1 out of 1 hunk FAILED -- saving rejects to file nuttx/include/sys/stat.h.rej
[12/558] Generating parameters.xml
ninja: build stopped: subcommand failed.
Makefile:161: recipe for target 'px4fmu-v2_default' failed
make: *** [px4fmu-v2_default] Error 1


— nuttx/include/sys/stat.h
+++ nuttx/include/sys/stat.h
@@ -131,7 +131,10 @@ extern “C”
int mkdir(FAR const char *pathname, mode_t mode);
int mkfifo(FAR const char *pathname, mode_t mode);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored “-Wshadow”
int stat(const char *path, FAR struct stat buf);
+#pragma GCC diagnostic pop
#if 0 /
Not yet supported */
int fstat(int fd, FAR struct stat *buf);


The diff patch is saying it cant find the first set of code. Most likely the change was already made. Check the file and see. Search for the function name and there should be the #pragma statements added. If not you can add them.