Cannot build APM from sources

Hello,
I am trying to build APM from sources, following the provided guide.
I am getting the following error:
Checking modules
// BUILDROOT=/tmp/ArduCopter.build HAL_BOARD=HAL_BOARD_LINUX HAL_BOARD_SUBTYPE=HAL_BOARD_SUBTYPE_LINUX_NAVIO2 TOOLCHAIN=RPI EXTRAFLAGS=-DGIT_VERSION=“cc24f323” -I/home/pi/ardupilot/libraries/AP_Common/missing -DHAVE_CMATH_ISFINITE -DNEED_CMATH_ISFINITE_STD_NAMESPACE
%% control_rtl.o
/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++: 1: /opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++: Syntax error: “(” unexpected
…/mk/build_rules.mk:11: recipe for target ‘/tmp/ArduCopter.build/control_rtl.o’ failed
make: *** [/tmp/ArduCopter.build/control_rtl.o] Error 2

I am building on the Navio Image.

Thanks,

@Nassim_BA

Could you please elaborate on the issue? You’re trying to build a binary for Navio2 using the image for Navio+. Am I correct? If so, are you sure you followed the guide for Navio2 and not the Navio+?

I am using Navio2, and following this guide : http://docs.emlid.com/navio2/Navio-APM/building-from-sources/
I got the error when executing : make navio2-quad

Is that me or It is not possible to get any answer on this forum?

I was not testing, but I feel it is because of a freshly inserted commit which does not like the toolchain.

Could you give more details about how it’s failing? Since you are using the master branch you could be having some problems with it that there isn’t in released versions.

We are compiling from master branch without problem, but not in the RPi. Please try building with:
make navio2-quad V=1
And send the entire log.

Here’s one example of it building: http://showterm.io/934290f9aebdaac64cd00

I run the command make navio2-quad then I get
// BUILDROOT=/tmp/ArduCopter.build HAL_BOARD=HAL_BOARD_LINUX HAL_BOARD_SUBTYPE=HAL_BOARD_SUBTYPE_LINUX_NAVIO2 TOOLCHAIN=RPI EXTRAFLAGS=-DGIT_VERSION=“cc24f323” -I/home/pi/ardupilot/libraries/AP_Common/missing -DHAVE_CMATH_ISFINITE -DNEED_CMATH_ISFINITE_STD_NAMESPACE
%% control_rtl.o
/opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++: 1: /opt/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-g++: Syntax error: “(” unexpected
…/mk/build_rules.mk:11: recipe for target ‘/tmp/ArduCopter.build/control_rtl.o’ failed
make: *** [/tmp/ArduCopter.build/control_rtl.o] Error 2
I will try with the V=1 flag and let you know.
Thanks,

Oh… and it’s VERBOSE=1, not V=1… my bad

There are really only two things that could be going on here as far as I can tell:

1- This particular source file (/tmp/Arducopter.build/control_rtl.o) has a syntax error. The program won’t compile until that error is resolved.

2- You don’t have all of the necessary dependencies properly installed and configured, so when that source file goes looking for a library that it needs, it’s not recognizing some code, causing it to not expect an opening parenthesis. So you’re going to have issues until you resolve that.

That’s my input for now. When I try to build it next week I’ll let you know what I come up with.

Edit: I think that quote I included might not be referencing the particular file I thought. Either way, something is up with compiling that particular file. What are you compiling on and what version of gcc are you using?

Apparently,this is not related to a source file, but rather to a build script (or a parameter passed to the build script) : build_rules.mk line 11).
I quickly checked the syntax and I suspect that one of the passed parameter is wrong, compiling with verbose will give more info.

1 Like