ARMmbed / yotta

DEPRECATED: yotta build; better software
Apache License 2.0
164 stars 64 forks source link

'yotta build' fails with error "command ['ninja'] failed" #784

Closed AoifeOS closed 7 years ago

AoifeOS commented 7 years ago

I am using Ubuntu 14.04 LTS and trying to use frdm-k64f-gcc as my target. All I want to do is compile and run blinky. This is the last section of the output when I run:

yotta build

/home/nx/example-mbedos-blinky/yotta_modules/greentea-client/source/test_env.cpp:19:18: fatal error: cstdio: No such file or directory
 #include <cstdio>
                  ^
compilation terminated.
[12/143] Building C object ym/dlmalloc...a_modules/dlmalloc/source/dlmalloc.c.o
ninja: build stopped: subcommand failed.
error: command ['ninja'] failed

No binaries are created when I run this. Any help would be appreciated!

autopulated commented 7 years ago

This is a build error due to a problem with the source files you're compiling: in this case it looks like the error happened when compiling the source for the "greentea-client" module, so a good place to start would be here: https://github.com/armmbed/greentea-client

AoifeOS commented 7 years ago

I tried using these two commands

pip install mbed-greentea --upgrade

pip install "mbed-greentea<0.2.0" --upgrade

and I tried to build it again after that and I got the same result as before. I have included the entire output, I hope it is helpful.

nx@nx-OptiPlex-390:~/example-mbedos-blinky$ yt build
info: generate for target: frdm-k64f-gcc 2.0.0 at /home/nx/example-mbedos-blinky/yotta_targets/frdm-k64f-gcc
GCC version is: arm-none-eabi-g++ (4.8.2-14ubuntu1+6) 4.8.2
Copyright (C) 2013 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.

-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/nx/example-mbedos-blinky/build/frdm-k64f-gcc
[15/143] Building CXX object ym/greent.../greentea-client/source/test_env.cpp.o
FAILED: /usr/bin/arm-none-eabi-g++  -DCPU_MK64FN1M0VMD12 -DTARGET_K64F -DYOTTA_MODULE_NAME=greentea-client --std=gnu++11 -fno-exceptions -fno-unwind-tables -ffunction-sections -fdata-sections -Wall -Wextra -gstrict-dwarf -fno-rtti -fno-threadsafe-statics -mcpu=cortex-m4 -mthumb -D__thumb2__ -Os -g -gdwarf-3 -DNDEBUG -Igenerated/include -I/home/nx/example-mbedos-blinky -I/home/nx/example-mbedos-blinky/yotta_modules/mbed-drivers -I/home/nx/example-mbedos-blinky/yotta_modules/mbed-hal -I/home/nx/example-mbedos-blinky/yotta_modules/cmsis-core -I/home/nx/example-mbedos-blinky/yotta_modules/ualloc -I/home/nx/example-mbedos-blinky/yotta_modules/minar -I/home/nx/example-mbedos-blinky/yotta_modules/core-util -I/home/nx/example-mbedos-blinky/yotta_modules/compiler-polyfill -I/home/nx/example-mbedos-blinky/yotta_modules/greentea-client -I/home/nx/example-mbedos-blinky/yotta_modules/mbed-hal-freescale -I/home/nx/example-mbedos-blinky/yotta_modules/mbed-hal-ksdk-mcu -I/home/nx/example-mbedos-blinky/yotta_modules/uvisor-lib -I/home/nx/example-mbedos-blinky/yotta_modules/mbed-hal-k64f -I/home/nx/example-mbedos-blinky/yotta_modules/cmsis-core-freescale -I/home/nx/example-mbedos-blinky/yotta_modules/cmsis-core-k64f -I/home/nx/example-mbedos-blinky/yotta_modules/mbed-hal-frdm-k64f -I/home/nx/example-mbedos-blinky/yotta_modules/dlmalloc -I/home/nx/example-mbedos-blinky/yotta_modules/minar-platform -I/home/nx/example-mbedos-blinky/yotta_modules/minar-platform-mbed -I/home/nx/example-mbedos-blinky/yotta_modules/greentea-client/source    -DTOOLCHAIN_GCC -DTOOLCHAIN_GCC_ARM -DMBED_OPERATORS -include "/home/nx/example-mbedos-blinky/build/frdm-k64f-gcc/yotta_config.h" -MMD -MT ym/greentea-client/source/CMakeFiles/greentea-client.dir/home/nx/example-mbedos-blinky/yotta_modules/greentea-client/source/test_env.cpp.o -MF "ym/greentea-client/source/CMakeFiles/greentea-client.dir/home/nx/example-mbedos-blinky/yotta_modules/greentea-client/source/test_env.cpp.o.d" -o ym/greentea-client/source/CMakeFiles/greentea-client.dir/home/nx/example-mbedos-blinky/yotta_modules/greentea-client/source/test_env.cpp.o -c /home/nx/example-mbedos-blinky/yotta_modules/greentea-client/source/test_env.cpp
/home/nx/example-mbedos-blinky/yotta_modules/greentea-client/source/test_env.cpp:19:18: fatal error: cstdio: No such file or directory
 #include <cstdio>
                  ^
compilation terminated.
[15/143] Building C object ym/dlmalloc...a_modules/dlmalloc/source/dlmalloc.c.o
ninja: build stopped: subcommand failed.
error: command ['ninja'] failed
autopulated commented 7 years ago

cc @PrzemekWirkus @thegecko @jaustin

bogdanm commented 7 years ago

Are you using https://launchpad.net/gcc-arm-embedded? I've seen similar errors for other distributions of the GCC ARM toolchain.

bogdanm commented 7 years ago

(also, @autopulated is right, this error is not in yotta itself).

PrzemekWirkus commented 7 years ago

@AoifeOS Hi! Errors related to example-mbedos-blinky/yotta_modules/greentea-client are not in this Greentea. They come from source code inside blinky example!

Just to let you know that doing $ pip install mbed-greentea -U will change that. This is all related to yotta packaging not supporting Python test tools.

PrzemekWirkus commented 7 years ago

My devbox environment

$ uname -a
Linux 3.13.0-76-generic #120-Ubuntu SMP Mon Jan 18 15:59:10 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.9.3 20150529 (release) [ARM/embedded-4_9-branch revision 227977]
Copyright (C) 2014 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.

My steps to reproduce Blinky example

~$ mkdir blinky
~$ cd blinky/
~/blinky$ git clone https://github.com/ARMmbed/example-mbedos-blinky.git
Cloning into 'example-mbedos-blinky'...
remote: Counting objects: 85, done.
remote: Total 85 (delta 0), reused 0 (delta 0), pack-reused 85
Unpacking objects: 100% (85/85), done.
Checking connectivity... done.
~/blinky$ cd example-mbedos-blinky/
~/blinky/example-mbedos-blinky$ yt target frdm-k64f-gcc
info: get versions for frdm-k64f-gcc
info: download frdm-k64f-gcc@2.0.0 from the public module registry
info: get versions for kinetis-k64-gcc
info: download kinetis-k64-gcc@2.2.0 from the public module registry
info: get versions for mbed-gcc
info: download mbed-gcc@1.2.2 from the public module registry
~/blinky/example-mbedos-blinky$ yt up
info: get versions for frdm-k64f-gcc
info: get versions for kinetis-k64-gcc
info: get versions for mbed-gcc
info: get versions for mbed-drivers
info: download mbed-drivers@1.5.0 from the public module registry
info: get versions for mbed-hal
info: download mbed-hal@1.3.0 from the public module registry
info: get versions for cmsis-core
info: download cmsis-core@1.2.0 from the public module registry
info: get versions for ualloc
info: download ualloc@1.3.0 from the public module registry
info: get versions for minar
info: download minar@1.3.0 from the public module registry
info: get versions for core-util
info: download core-util@1.8.0 from the public module registry
info: get versions for compiler-polyfill
info: download compiler-polyfill@1.3.0 from the public module registry
info: get versions for greentea-client
info: download greentea-client@1.1.0 from the public module registry
info: get versions for mbed-hal-freescale
info: download mbed-hal-freescale@1.1.0 from the public module registry
info: get versions for mbed-hal-ksdk-mcu
info: download mbed-hal-ksdk-mcu@1.3.0 from the public module registry
info: get versions for uvisor-lib
info: download uvisor-lib@2.1.2 from the public module registry
info: get versions for mbed-hal-k64f
info: download mbed-hal-k64f@1.3.0 from the public module registry
info: get versions for cmsis-core-freescale
info: download cmsis-core-freescale@1.1.0 from the public module registry
info: get versions for cmsis-core-k64f
info: download cmsis-core-k64f@1.1.0 from the public module registry
info: get versions for mbed-hal-frdm-k64f
info: download mbed-hal-frdm-k64f@1.1.1 from the public module registry
info: get versions for dlmalloc
info: download dlmalloc@1.1.0 from the public module registry
info: get versions for minar-platform
info: download minar-platform@1.1.0 from the public module registry
info: get versions for minar-platform-mbed
info: download minar-platform-mbed@1.3.0 from the public module registry
~/blinky/example-mbedos-blinky$ yt build
info: generate for target: frdm-k64f-gcc 2.0.0 at /home/przemek/blinky/example-mbedos-blinky/yotta_targets/frdm-k64f-gcc
GCC version is: 4.9.3
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/arm-none-eabi-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /home/przemek/blinky/example-mbedos-blinky/build/frdm-k64f-gcc
[58/143] Building CXX object ym/mbed-drivers/source/CMakeFiles/mbed-drivers.dir/home/przemek/blinky/example-mbedos-blinky/yotta_modules/mbed-drivers/source/test_env.cpp.o
In file included from /home/przemek/blinky/example-mbedos-blinky/yotta_modules/mbed-drivers/source/test_env.cpp:17:0:
/home/przemek/blinky/example-mbedos-blinky/yotta_modules/mbed-drivers/mbed-drivers/test_env.h:20:2: warning: #warning mbed-drivers/test_env.h is deprecated. Please use greentea-client/test_env.h instead. [-Wcpp]
 #warning mbed-drivers/test_env.h is deprecated. Please use greentea-client/test_env.h instead.
  ^
[63/143] Building C object ym/core-util/source/CMakeFiles/core-util.dir/home/przemek/blinky/example-mbedos-blinky/yotta_modules/core-util/source/critical.c.o
/home/przemek/blinky/example-mbedos-blinky/yotta_modules/core-util/source/critical.c: In function 'core_util_critical_section_exit':
/home/przemek/blinky/example-mbedos-blinky/yotta_modules/core-util/source/critical.c:65:18: warning: unused variable 'primask' [-Wunused-variable]
         uint32_t primask = __get_PRIMASK(); // get the current interrupt enabled state
                  ^
[143/143] Linking CXX executable source/example-mbedos-blinky
~/blinky/example-mbedos-blinky/build/frdm-k64f-gcc/source$ ls -l
total 952
drwxrwxr-x 3 przemek przemek   4096 Jul 12 16:25 CMakeFiles
-rw-rw-r-- 1 przemek przemek   1033 Jul 12 16:25 cmake_install.cmake
-rw-rw-r-- 1 przemek przemek    859 Jul 12 16:25 CMakeLists.txt
-rw-rw-r-- 1 przemek przemek    351 Jul 12 16:25 CTestTestfile.cmake
-rwxrwxr-x 1 przemek przemek 590719 Jul 12 16:27 example-mbedos-blinky
-rwxrwxr-x 1 przemek przemek  48704 Jul 12 16:27 example-mbedos-blinky.bin
-rw-rw-r-- 1 przemek przemek 357535 Jul 12 16:27 example-mbedos-blinky.map
AoifeOS commented 7 years ago

@PrzemekWirkus I followed your steps to reproduce blinky from scratch and got the same error again.

I have a different version of arm-none-eabi-gcc. nx@nx-OptiPlex-390:~/blinky/example-mbedos-blinky$ arm-none-eabi-gcc --version

arm-none-eabi-gcc (4.8.2-14ubuntu1+6) 4.8.2
Copyright (C) 2013 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.

nx@nx-OptiPlex-390:~/blinky/example-mbedos-blinky/build/frdm-k64f-gcc/source$ ls -l

total 16
drwxrwxr-x 3 nx nx 4096 Jul 13 09:31 CMakeFiles
-rw-rw-r-- 1 nx nx 1028 Jul 13 09:31 cmake_install.cmake
-rw-rw-r-- 1 nx nx  844 Jul 13 09:31 CMakeLists.txt
-rw-rw-r-- 1 nx nx  341 Jul 13 09:31 CTestTestfile.cmake
bogdanm commented 7 years ago

Try to install and use GCC ARM embedded from https://launchpad.net/gcc-arm-embedded. I suspect that might fix your problems.

PrzemekWirkus commented 7 years ago

@AoifeOS LIke @bogdanm have said. You need to isntall GCC ARM Embedded Compiler from Launchpad. One you have might not work correctly.

PrzemekWirkus commented 7 years ago

@AoifeOS Here is detailed instruction: http://yottadocs.mbed.com/#linux-cross-compile

I will paste it here...

To cross-compile yotta modules for embedded targets, you first need install the arm-none-eabi-gcc compiler.

On most Linux distributions (although not Ubuntu), this can be done by running:

sudo apt-get install gcc-arm-none-eabi

On Ubuntu it's necessary to use the ARM-maintained gcc-arm-embedded package, instead:

# remove the built-in package, if installed:
sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
# set up the PPA for the ARM-maintained package:
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt-get update
# install:
sudo apt-get install gcc-arm-embedded
AoifeOS commented 7 years ago

It works now! Thanks so much guys!