Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails with GNU Arm Embedded Toolchain #1

Closed
nschuetz1311 opened this issue Apr 23, 2021 · 6 comments
Closed

Build fails with GNU Arm Embedded Toolchain #1

nschuetz1311 opened this issue Apr 23, 2021 · 6 comments

Comments

@nschuetz1311
Copy link

nschuetz1311 commented Apr 23, 2021

Bug description:
Compiling problem when trying to build the "EcFw-zephyr"

Reproducible by:
following the getting started guide (https://intel.github.io/ecfw-zephyr/index.html)

Expected behavior:
"west build -c -p auto -b mec1501modular_assy6885" compiling without any issues.

Environment:
Windows 10
GnuArmEmb 10 2020-Q4-Major
CMake v3.20.1

Additional Information:
building other applications with the "normal" Zephyr SDK works on my Windows system, only trying to build this seems to cause this problem.

CMakeError.log:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status

@franciscomunoz
Copy link
Contributor

franciscomunoz commented Apr 24, 2021

@nschuetz1311 downgrade CMake to 3.18 or 3.16.

@nschuetz1311
Copy link
Author

So I tested it with V3.18 and 3.16 but still get the same output.

3.18.0:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status

3.16.0:

Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler: C:/Program Files (x86)/GNU Arm Embedded Toolchain/bin/arm-none-eabi-gcc.exe 
Build flags: 
Id flags:  

The output was:
1
c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld.exe: c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/lib\libc.a(lib_a-exit.o): in function `exit':
exit.c:(.text.exit+0x2c): undefined reference to `_exit'
collect2.exe: error: ld returned 1 exit status

@franciscomunoz
Copy link
Contributor

Please read this thread
zephyrproject-rtos/zephyr#22060

@nschuetz1311
Copy link
Author

After setting everything up from scratch with the CMake 3.16, the build process now aborts at a different issue.

Is this also a known issue?

D:\EC\sandbox2\ecfw-zephyr>west build -c -p auto -b mec1501modular_assy6885
-- west build: generating a build system
-- Application: D:/EC/sandbox2/ecfw-zephyr
-- Zephyr version: 2.3.0 (D:/EC/sandbox2/zephyr_snapshot)
-- Found Python3: C:/Program Files/Python38/python.exe (found suitable exact version "3.8.9") found components: Interpreter
-- git describe failed: fatal: No tags can describe 'fc728c040d886332e0b202c8416befac63f2570b'.
Try --always, or create some tags.;
   BUILD_VERSION is left undefined
-- Board: mec1501modular_assy6885
-- Found west: C:/Program Files/Python38/Scripts/west.exe (found suitable version "0.10.1", minimum required is "0.7.1")
-- Found toolchain: gnuarmemb (C:/Program Files (x86)/GNU Arm Embedded Toolchain)
-- Found BOARD.dts: D:/EC/sandbox2/zephyr_snapshot/boards/arm/mec1501modular_assy6885/mec1501modular_assy6885.dts
-- Found devicetree overlay: D:/EC/sandbox2/ecfw-zephyr/mec1501modular_assy6885.overlay
-- Generated zephyr.dts: D:/EC/sandbox2/ecfw-zephyr/build/zephyr/zephyr.dts
-- Generated devicetree_unfixed.h: D:/EC/sandbox2/ecfw-zephyr/build/zephyr/include/generated/devicetree_unfixed.h
Parsing D:/EC/sandbox2/ecfw-zephyr/Kconfig
Loaded configuration 'D:/EC/sandbox2/ecfw-zephyr/build/zephyr/.config'
No change to configuration in 'D:/EC/sandbox2/ecfw-zephyr/build/zephyr/.config'
No change to Kconfig header in 'D:/EC/sandbox2/ecfw-zephyr/build/zephyr/include/generated/autoconf.h'
-- Cache files will be written to: D:/EC/sandbox2/zephyr_snapshot/.cache
CMake Warning at D:/EC/sandbox2/zephyr_snapshot/boards/arm/mec1501modular_assy6885/CMakeLists.txt:29 (message):
  Microchip SPI Image Generation tool (everglades_spi_gen.exe) is not
  available.  SPI Image will not be generated.


-- Configuring done
-- Generating done
-- Build files have been written to: D:/EC/sandbox2/ecfw-zephyr/build
-- west build: building application
[79/131] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_core.c.obj
FAILED: zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_core.c.obj
C:\PROGRA~2\GNUARM~1\bin\AR19DD~1.EXE -DKERNEL -D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -ID:/EC/sandbox2/zephyr_snapshot/include -Izephyr/include/generated -ID:/EC/sandbox2/zephyr_snapshot/soc/arm/microchip_mec/mec1501 -ID:/EC/sandbox2/modules/hal/cmsis/CMSIS/Core/Include -ID:/EC/sandbox2/modules/hal/microchip/mec/common -ID:/EC/sandbox2/modules/hal/microchip/mec/mec1501 -isystem D:/EC/sandbox2/zephyr_snapshot/lib/libc/minimal/include -isystem "c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/include" -isystem "c:/program files (x86)/gnu arm embedded toolchain/bin/../lib/gcc/arm-none-eabi/10.2.1/include-fixed" -Os -imacrosD:/EC/sandbox2/ecfw-zephyr/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -mcpu=cortex-m4 -mthumb -mabi=aapcs -imacrosD:/EC/sandbox2/zephyr_snapshot/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-address-of-packed-member -Wno-pointer-sign -Wpointer-arith -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=D:/EC/sandbox2/ecfw-zephyr=CMAKE_SOURCE_DIR -fmacro-prefix-map=D:/EC/sandbox2/zephyr_snapshot=ZEPHYR_BASE -fmacro-prefix-map=D:/EC/sandbox2=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -Werror -MD -MT zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_core.c.obj -MF zephyr\CMakeFiles\zephyr.dir\subsys\logging\log_core.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/subsys/logging/log_core.c.obj   -c D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c
In file included from D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c:9:
D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c: In function 'log_hexdump_sync':
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:9: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c: In function 'dropped_notify':
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:9: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
In file included from D:/EC/sandbox2/zephyr_snapshot/include/logging/log.h:11,
                 from D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c:8:
D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c: In function 'log_source_name_get':
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_core.h:426:26: error: array subscript src_id is outside array bounds of 'struct log_source_const_data[0]' [-Werror=array-bounds]
  426 |  return __log_const_start[source_id].name;
      |         ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_core.h:416:37: note: while referencing '__log_const_start'
  416 | extern struct log_source_const_data __log_const_start[0];
      |                                     ^~~~~~~~~~~~~~~~~
In file included from D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c:9:
D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c: In function 'log_backend_enable':
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:9: error: array subscript 0 is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c: In function 'log_init':
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:9: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
In file included from D:/EC/sandbox2/zephyr_snapshot/include/logging/log.h:11,
                 from D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c:8:
D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c: In function 'log_filter_get':
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_core.h:436:26: error: array subscript src_id is outside array bounds of 'struct log_source_const_data[0]' [-Werror=array-bounds]
  436 |  return __log_const_start[source_id].level;
      |         ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_core.h:416:37: note: while referencing '__log_const_start'
  416 | extern struct log_source_const_data __log_const_start[0];
      |                                     ^~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c: In function 'z_impl_log_process':
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_core.h:426:26: error: array subscript <unknown> is outside array bounds of 'struct log_source_const_data[0]' [-Werror=array-bounds]
  426 |  return __log_const_start[source_id].name;
      |         ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_core.h:416:37: note: while referencing '__log_const_start'
  416 | extern struct log_source_const_data __log_const_start[0];
      |                                     ^~~~~~~~~~~~~~~~~
In file included from D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c:9:
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:9: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/subsys/logging/log_core.c: In function 'z_impl_log_panic':
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:9: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:219:30: error: array subscript <unknown> is outside array bounds of 'const struct log_backend[0]' [-Werror=array-bounds]
  219 |  return &__log_backends_start[idx];
      |          ~~~~~~~~~~~~~~~~~~~~^~~~~
D:/EC/sandbox2/zephyr_snapshot/include/logging/log_backend.h:65:33: note: while referencing '__log_backends_start'
   65 | extern const struct log_backend __log_backends_start[0];
      |                                 ^~~~~~~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
[96/131] Building C object zephyr/drivers/espi/CMakeFiles/drivers__espi.dir/espi_mchp_xec.c.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'C:\Program Files\CMake\bin\cmake.EXE' --build 'D:\EC\sandbox2\ecfw-zephyr\build'

@oolonpg
Copy link

oolonpg commented May 13, 2021

Can reproduce this with a clean install.

I tried to disable logging in the prj file ... build is working. So the project itself seems to be o.k.

To solve the logging issue i changed to an old SDK. Project is based on Zephyr 2.3 so went down to SDK 0.11.4.
Now i was able to build the project with logging enabled.

@nschuetz1311
Copy link
Author

Thank you, disabling the logging did actually solve this issue for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants