Error while building PX4 firmware for PX4FMU-V2

Hi, I’m currently working on PX4 firmware 1.5.2. I tried to build by following the PX4 development guide but I got this error message.

Scanning dependencies of target nuttx_export_px4fmu-v2
[  3%] Building NuttX for px4fmu-v2
[  3%] Built target libuavcan_dsdlc
[  4%] Generating airframes.xml
make[4]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
make[4]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
make[4]: warning: -jN forced in submake: disabling jobserver mode.
make[4]: warning: -jN forced in submake: disabling jobserver mode.
string/lib_memchr.c: In function 'memchr':
string/lib_memchr.c:66:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^
cc1: all warnings being treated as errors
make[5]: *** [bin/lib_memchr.o] Error 1
make[4]: *** [libc/libc.a] Error 2
make[4]: *** Waiting for unfinished jobs....
[  4%] Built target xml_gen
string/lib_memchr.c: In function 'memchr':
string/lib_memchr.c:66:6: error: nonnull argument 's' compared to NULL [-Werror=nonnull-compare]
   if (s)
      ^
cc1: all warnings being treated as errors
make[5]: *** [bin/lib_memchr.o] Error 1
make[4]: *** [libc/libc.a] Error 2
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [px4io-v2.export] Error 2
make[2]: *** [src/modules/px4iofirmware/CMakeFiles/nuttx_export_px4io-v2.dir/all] Error 2
make[2]: *** Waiting for unfinished jobs....
make[3]: *** [px4fmu-v2.export] Error 2
make[2]: *** [CMakeFiles/nuttx_export_px4fmu-v2.dir/all] Error 2
make[1]: *** [all] Error 2
make: *** [px4fmu-v2_default] Error 2

It works well when I build it with commands “make” or “make posix_sitl_default gazebo”. What should I do to build PX4 firmware for PX4 FMU?

You have GCC 6 but we’re only supporting versions up to GCC 5 right now. You can install GCC 5 from here: http://dev.px4.io/starting-installing-linux-boutique.html#toolchain-installation

Thank you so much. It finally works.

Actually, I’ve tried that but
exportline=“export PATH=$HOME/gcc-arm-none-eabi-5_4-2016q2/bin:$PATH”
that didn’t work for me.

However,
exportline=“export PATH=$HOME/gcc-arm-none-eabi-5_4-2016q2/bin:$PATH”
works well for me.

I really appreciate you for your help.

@Nickvot Read https://linux.die.net/Bash-Beginners-Guide/sect_03_03.html to understand the reason for the presence of that backslash

Thank you for your help. It was to preserve the $ mark right? I think I should learn more about Linux commands.

Hi,I tried this method.But it did not work. Because the gcc-arm-embedded is the newest on 6.2.1. Could you give a version of gcc-arm-embedded on 5.2.1?

you can follow the http://dev.px4.io/starting-installing-linux-boutique.html#toolchain-installation to install the GCC5 ,and that i think is okay.

Thank you! I followed this introduction,but there was the same build error. “export PATH=/home/ji/gcc-arm-none-eabi-5_4-2016q2/bin:$PATH” is already in .profile. Could you give me some advices on my problem?

sorry, i am not the developer , i have met the same problem as you . and I solve it through i stupid method which is reinstall the OS and retry.

Thanks, anyway. I will keep tracking on this issue.

@JJWMr, I was facing the error message above but the exact instructions on the dev page (linked above) for installing GCC 5.4 on Ubuntu 16.04 worked.

However, I just wanted to point out that you may need to log out once before trying to build again. The instructions add a line to the .profile file which I believe is only run upon logging in. So after following the installation instructions be sure to restart and then see if that resolves the building problem above.

Whether that backslash needed or not? I install GCC5.4 failed with that backslash