ARMmbed / target-mbed-gcc

DEPRECATED Base for mbed yotta compilation targets compiling with GCC
Apache License 2.0
6 stars 12 forks source link

Cannot build with 1.2.0 #36

Open tibmanus opened 8 years ago

tibmanus commented 8 years ago

All my programs fail to build with the 1.2.0 update of mbed-gcc. I'm on Mac OS 11.4; arm-none-eabi-gcc is on stable 5.0-2015-q4-major, cmake 3.5.1. If I put back 1.1.0 mbed-gcc everything works perfectly.

The output for yotta build:

info: generate for target: frdm-k64f-gcc 2.0.0 at /Users/Tibor/Desktop/testpr/yotta_targets/frdm-k64f-gcc
warning: subdirectory "test" of testpr 0.0.0 at /Users/Tibor/Desktop/testpr was ignored because it doesn't appear to contain any source files
-- The C compiler identification is GNU 5.2.1
-- The CXX compiler identification is GNU 5.2.1
-- Check for working C compiler using: Ninja
-- Check for working C compiler using: Ninja -- broken
CMake Error at /usr/local/Cellar/cmake/3.5.1/share/cmake/Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "/usr/local/bin/arm-none-eabi-gcc" is not able to compile a
  simple test program.

  It fails with the following output:

   Change Dir: /Users/Tibor/Desktop/testpr/build/frdm-k64f-gcc/CMakeFiles/CMakeTmp

  Run Build Command:"/usr/local/bin/ninja" "cmTC_af822"

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

  [2/2] Linking C executable cmTC_af822

  FAILED: : && /usr/local/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
  -mcpu=cortex-m4 -mthumb
  -T"/Users/Tibor/Desktop/testpr/yotta_targets/kinetis-k64-gcc/CMake/../ld/K64FN1M0xxx12.ld"
  -Wl,-Map,cmTC_af822.map -Wl,--start-group
  CMakeFiles/cmTC_af822.dir/testCCompiler.c.o -lm -lc -lgcc -lm -lc -lgcc
  -Wl,--end-group --specs=nano.specs -o cmTC_af822 && :

  /usr/local/Cellar/arm-none-eabi-gcc/5.0-2015-q4-major/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/bin/ld:
  warning: cannot find entry symbol Reset_Handler; defaulting to
  0000000000000410

  /usr/local/Cellar/arm-none-eabi-gcc/5.0-2015-q4-major/bin/../lib/gcc/arm-none-eabi/5.2.1/../../../../arm-none-eabi/lib/armv7e-m/libc_nano.a(lib_a-sbrkr.o):
  In function `_sbrk_r':

  sbrkr.c:(.text._sbrk_r+0xc): 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:150 (project)

-- Configuring incomplete, errors occurred!
See also "/Users/Tibor/Desktop/testpr/build/frdm-k64f-gcc/CMakeFiles/CMakeOutput.log".
See also "/Users/Tibor/Desktop/testpr/build/frdm-k64f-gcc/CMakeFiles/CMakeError.log".

CMakeOutput.log CMakeError.log

autopulated commented 8 years ago

What CMake version do you have?

I suspect this is related to https://github.com/ARMmbed/target-mbed-gcc/commit/81c549c5e9ae22defe744c1b2492adffeaf6c492.

autopulated commented 8 years ago

Should be fixed (at least temporarily) in 1.2.1. Possibly we will need to use CMAKE_TRY_COMPILE_TARGET_TYPE for gcc like we do for armcc (https://github.com/ARMmbed/target-mbed-armcc/blob/master/CMake/toolchain.cmake#L103) to support CMake >= 3.6

Leaving this open to track.

cc @bogdanm

tibmanus commented 8 years ago

CMake 3.5.1

ciarmcom commented 8 years ago

ARM Internal Ref: IOTSFW-2464

bearsh commented 7 years ago

yep set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") seems to be needed, at least for cmake 3.6 at otherwise it fails here

autopulated commented 7 years ago

cc @bogdanm @thegecko looks like set(CMAKE_TRY_COMPILE_TARGET_TYPE "STATIC_LIBRARY") will fix it

bearsh commented 7 years ago

furthermore once 'fixed' in toolchain.cmake the output of cmake is not very nice as during the test not all config variables seem to be defined

-- Check for working C compiler: /home/bearsh/apps/gcc-arm-none-eabi/bin/arm-none-eabi-gcc
CMake Warning at /home/bearsh/projects/soundbear/soundbear/yotta_targets/nordic-nrf51822-gcc/CMake/toolchain.cmake:23 (message):
  No definition of YOTTA_CFG_NRF51822_RAM_SIZE found, building image for
  default 16K target.
Call Stack (most recent call first):
  /home/bearsh/projects/soundbear/soundbear/build/soundbear-gcc/toolchain.cmake:9 (include)
  /home/bearsh/projects/soundbear/soundbear/build/soundbear-gcc/CMakeFiles/3.6.0/CMakeSystem.cmake:6 (include)
  /home/bearsh/projects/soundbear/soundbear/build/soundbear-gcc/CMakeFiles/CMakeTmp/CMakeLists.txt:3 (project)

-- Check for working C compiler: /home/bearsh/apps/gcc-arm-none-eabi/bin/arm-none-eabi-gcc -- works
-- Detecting C compiler ABI info
CMake Warning at /home/bearsh/projects/soundbear/soundbear/yotta_targets/nordic-nrf51822-gcc/CMake/toolchain.cmake:23 (message):
  No definition of YOTTA_CFG_NRF51822_RAM_SIZE found, building image for
  default 16K target.
Call Stack (most recent call first):
  /home/bearsh/projects/soundbear/soundbear/build/soundbear-gcc/toolchain.cmake:9 (include)
  /home/bearsh/projects/soundbear/soundbear/build/soundbear-gcc/CMakeFiles/3.6.0/CMakeSystem.cmake:6 (include)
  /home/bearsh/projects/soundbear/soundbear/build/soundbear-gcc/CMakeFiles/CMakeTmp/CMakeLists.txt:3 (project)

-- Detecting C compiler ABI info - done