Compile for APM2 on Mac - not working

I’m trying to build the code using make, according to this guide.

I have installed Arduino (tried 1.5, 1.0 and the modified ArduPilot version) and have Xcode developer tools. I cloned the latest code using git clone github.com/diydrones/ardupilot.git. Make configure produces a config.mk which is fine; make then exits with an error after ArduPlane.o (see attached log file).

Apparently something goes wrong with linking or assembly, because on the one hand I get a lot of “X undefined in this scope” and then later on “X defined but not used”. Since I followed the instructions to the letter and that page mentions it “works out of the box” for Mac, I am at a loss as to what goes wrong.

Can anybody help me solve this problem, so I can compile/build using make on Mac?

Here an excerpt of the make output file:

[edit] PS my OSX version is 10.9.2, kernel (uname -a) Darwin 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; my make version is GNU Make 3.81.

Is there anybody who has successfully compiled the code on Mac?

Yes. Please see
dev.ardupilot.com/wiki/building-the-code-on-mac/

Dear Craig3DR,

You may have misunderstood my question. What I am trying to do is:

I know it’s possible to use the modified Arduino environment, but I want to build it using make. For numerous reasons, but one of them is that—according to 3DR’s/dev.ardupilot’s building for APM with Make guide—it is the preferred method:

I would like to get this way to work on my Mac, and if anybody knows what the problem is, or if anyone has successfully built the code on Mac (using make), I would very much like to hear it.

[edit] Since the problem has not been solved yet, is it possible to remove the “solved” flag again? I do not remember indicating the issue solved, and I do not know where to change the status.

I’m facing exactly the same problem. Have tried it on 2 machines running 10.9.2; but the same ‘not declared in scope’ errors. Could it be that ARM Toolchain 4.7.4 is not working?

arm-none-eabi-g++ (GNU Tools for ARM Embedded Processors) 4.7.4 20130913 (release) [ARM/embedded-4_7-branch revision 202601] Copyright (C) 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Downgrading to 4.6 does not seems to work either:

12 warnings and 1 error generated. make[3]: *** [Box.lo] Error 1 make[2]: *** [all] Error 2 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2

Kind regards,

Sander

I’ve set the issue as unsolved, I’ll look into the issue later today and post a solution for you.

I had this problem too and fixed it as follows:

$ brew install gawk
$ sudo rm -f /usr/bin/awk
$ sudo ln -s which gawk /usr/bin/awk

The problem is that the version of awk installed by default is old (2007). mk/sketch_sources.mk contains an awk script that extracts function prototypes from the concatenated .pde files, and it silently fails to work correctly when using such an old version of awk. This fix installs a recent version of gawk.

Confirmed working, thanks a lot!

Would be a great idea adding this to the wiki: building-px4-with-make-on-mac