MBED SDK: build.py and make.py failing - is my python version to blame?

17 Jul 2014

I am trying to compile files with ARM's GCC for an NRF51822 mkit board in linux. I have edited private_settings.py to reflect the location of my GCC. However, when I run build.py or make.py they fail. Here's the output:

pi@raspberrypi ~/jimi/mbed_sdk/mbed/workspace_tools $ python make.py -p 25 -m NRF51822 -t GCC_ARM
Building project BLINKY (NRF51822, GCC_ARM)
Compile: main.cpp
[ERROR] [Errno 8] Exec format error
pi@raspberrypi ~/jimi/mbed_sdk/mbed/workspace_tools $ python build.py -m NRF51822 -t GCC_ARM
Building library CMSIS (NRF51822, GCC_ARM)
Assemble: startup_NRF51822.s
[Errno 8] Exec format error
Completed in: (0.25)s


Build failures:
  * GCC_ARM::NRF51822

I read here that python 2.7.6 is a 'prerequisite' for this. I am running python 2.7.3, and I have read of people getting 'Exec format error' caused by incorrect Python versions. So I am currently installing 2.7.6 (which is taking forever, so I haven't been able to try it yet!).

Have I forgotten to change some other necessary settings? Is there something else that I might be missing or doing wrong? Or is the other Python version going to fix the problem?

Any help or guidance is much appreciated!

EDIT: Just as I was about to give up and go home, python 2.7.6 finished installing. So I ran make.py and build.py with it... and got exactly the same results as with 2.7.3 posted above. Sigh! Does anyone have any ideas why I'm getting these errors?

17 Jul 2014

Hello Jim,

I haven't experienced exec format error yet.. What if you build another target? I dont think python is to blame. What's in your private_settings?

are you able to compile any project?

18 Jul 2014

Hi Martin, thanks for your help!

I think I've realised the problem. I am running this on a raspberry pi, but the arm gcc I downloaded was probably built for x86 or something. I'm going to try to sort it out — maybe I need to build it from source? Or start using a proper computer? :p

To answer your questions, though: building another target gives the same output. This is my private_settings.py:

from os.path import join

# GCC ARM
#GCC_ARM_PATH = "/home/pi/jimi/mbed_sdk/mbed/workspace_tools/gcc-arm-none-eabi-4_8-2014q2/bin"
GCC_ARM_PATH = "/opt/gcc/gcc-arm-none-eabi-4_8-2014q2/bin"
# mbed.org username
MBED_ORG_USER = "jfhc"

And no, I spent this morning trying to compile the sample projects included with the compiler and failing, ultimately realising my silly mistake! Now I'm going to look into building it for my platform (if that's possible) and see where that gets me. Thanks for any further help!

18 Jul 2014

Yes, that explain it, I would not expect to build an mbed lib on raspberry pi :-)

18 Jul 2014

Yeah, in hindsight it was pretty silly of me :p but I'm not used to developing on this machine. I won't make the same mistake next time!