4 years, 3 months ago.

cannot compile helloyotta for mbed-gcc

Trying to build "helloyotta" sample for mbed-gcc, but encounter the errors described below:

Ubuntu 12.04.5. Installed latest gcc-arm-none-eabi manually.

Downloaded helloyotta. yotta target mbed-gcc yotta build

info: generate for target: mbed-gcc 1.2.2 at /ade/borisst/helloyotta/yotta_targets/mbed-gcc The C compiler identification is GNU 5.4.1 The CXX compiler identification is GNU 5.4.1 Check for working C compiler: /usr/bin/arm-none-eabi-gcc Check for working C compiler: /usr/bin/arm-none-eabi-gcc broken CMake Error at /usr/share/cmake-3.6/Modules/CMakeTestCCompiler.cmake:61 (message): The C compiler "/usr/bin/arm-none-eabi-gcc" is not able to compile a simple test program.

It fails with the following output:

Change Dir: /ade/borisst/helloyotta/build/mbed-gcc/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/ninja" "cmTC_4bad7"

[1/2] Building C object CMakeFiles/cmTC_4bad7.dir/testCCompiler.c.o

[2/2] Linking C executable cmTC_4bad7

FAILED: : && /usr/bin/arm-none-eabi-gcc -fno-exceptions -fno-unwind-tables -Wl,gc-sections -Wl,sort-common -Wl,sort-section=alignment -Wl,-wrap,main -Wl,-u,_printf_float -Wl,-Map,cmTC_4bad7.map -Wl,start-group CMakeFiles/cmTC_4bad7.dir/testCCompiler.c.o -lm -lc -lgcc -lm -lc -lgcc -Wl,end-group specs=nano.specs -o cmTC_4bad7 && :

/usr/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/libc_nano.a(lib_a-exit.o): In function `exit':

exit.c:(.text.exit+0x34): undefined reference to `_exit'

/usr/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/crt0.o: In function `_start':

(.text+0xec): undefined reference to `wrap_main'

/usr/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/lib/libc_nano.a(lib_a-sbrkr.o): In function `_sbrk_r':

sbrkr.c:(.text._sbrk_r+0x18): undefined reference to `_sbrk'

collect2: error: ld returned 1 exit status

ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:71 (project)

Configuring incomplete, errors occurred! See also "/ade/borisst/helloyotta/build/mbed-gcc/CMakeFiles/CMakeOutput.log". See also "/ade/borisst/helloyotta/build/mbed-gcc/CMakeFiles/CMakeError.log". error: command ['cmake', '-D', 'CMAKE_BUILD_TYPE=RelWithDebInfo', '-G', 'Ninja', '.'] failed

1 Answer

4 years, 3 months ago.

Hello Boris,

I'm not sure that the latest version of GCC is supported by mbed at the moment. As stated in the yotta documentation (it is not in the right section): mbed is tested with GCC 4.9 (see here: http://yottadocs.mbed.com/#windows-cross-compile).

You should also get GCC from this PPA: https://launchpad.net/gcc-arm-embedded.