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

tests/kernel/common fails to build for qemu_kvm_arm64 #56189

Closed
manuargue opened this issue Mar 24, 2023 · 4 comments
Closed

tests/kernel/common fails to build for qemu_kvm_arm64 #56189

manuargue opened this issue Mar 24, 2023 · 4 comments
Labels
area: ARM64 ARM (64-bit) Architecture area: Kernel area: QEMU QEMU Emulation area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug

Comments

@manuargue
Copy link
Member

manuargue commented Mar 24, 2023

Describe the bug
tests/kernel/common/kernel.common fails to build for qemu_kvm_arm64 from commit fbf851c.

To Reproduce
west build -p always -b qemu_kvm_arm64 ./tests/kernel/common

Expected behavior
Test can build without errors on this board.

Impact
Blocking #56178

Logs and console output

INFO    -  87/663 qemu_kvm_arm64            tests/kernel/common/kernel.common                   ERROR Build failure (build)
INFO    - -----/__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/build.log------
ERROR   - Loading Zephyr default modules (Zephyr base).
-- Application: /__w/zephyr/zephyr/tests/kernel/common
-- CMake version: 3.20.5
-- Found Python3: /usr/bin/python3.8 (found suitable exact version "3.8.10") found components: Interpreter 
-- Cache files will be written to: /__w/zephyr/zephyr/.cache
-- Zephyr version: 3.3.99 (/__w/zephyr/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: qemu_kvm_arm64
-- Found host-tools: zephyr 0.16.0 (/opt/toolchains/zephyr-sdk-0.16.0)
-- Found toolchain: zephyr 0.16.0 (/opt/toolchains/zephyr-sdk-0.16.0)
-- Found Dtc: /opt/toolchains/zephyr-sdk-0.16.0/sysroots/x86_64-pokysdk-linux/usr/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6") 
-- Found BOARD.dts: /__w/zephyr/zephyr/boards/arm64/qemu_kvm_arm64/qemu_kvm_arm64.dts
-- Generated zephyr.dts: /__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/zephyr/zephyr.dts
-- Generated devicetree_generated.h: /__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/zephyr/include/generated/devicetree_generated.h
-- Including generated dts.cmake file: /__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/zephyr/dts.cmake
Parsing /__w/zephyr/zephyr/Kconfig
Loaded configuration '/__w/zephyr/zephyr/boards/arm64/qemu_kvm_arm64/qemu_kvm_arm64_defconfig'
Merged configuration '/__w/zephyr/zephyr/tests/kernel/common/prj.conf'
Merged configuration '/__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/zephyr/misc/generated/extra_kconfig_options.conf'
Configuration saved to '/__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/zephyr/.config'
Kconfig header saved to '/__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/zephyr/include/generated/autoconf.h'
-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/aarch64-zephyr-elf-gcc
-- Configuring done
-- Generating done
-- Build files have been written to: /__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common
[1/173] Preparing syscall dependency handling

[2/173] Generating include/generated/version.h
-- Zephyr version: 3.3.99 (/__w/zephyr/zephyr), build: zephyr-v3.3.0-[166](https://github.com/zephyrproject-rtos/zephyr/actions/runs/4510053473/jobs/7940582708?pr=56178#step:13:167)3-gce35298f2288
[3/[173](https://github.com/zephyrproject-rtos/zephyr/actions/runs/4510053473/jobs/7940582708?pr=56178#step:13:174)] Generating misc/generated/syscalls_subdirs.trigger
[4/173] Generating misc/generated/syscalls.json, misc/generated/struct_tags.json
[5/173] Generating include/generated/syscall_dispatch.c, include/generated/syscall_list.h
[6/173] Generating include/generated/kobj-types-enum.h, include/generated/otype-to-str.h, include/generated/otype-to-size.h
[7/173] Generating include/generated/driver-validation.h
[8/173] Building C object zephyr/CMakeFiles/offsets.dir/arch/arm64/core/offsets/offsets.c.obj
[9/173] Generating include/generated/offsets.h
[10/173] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.obj
FAILED: zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.obj 
ccache /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/aarch64-zephyr-elf-gcc -DKERNEL -DTC_RUNID=d1ed75d5fcd69c8397b2cd2c873ef663 -D__ZEPHYR__=1 -I../../../../../../kernel/include -I../../../../../../arch/arm64/include -I../../../../../../include -Izephyr/include/generated -I../../../../../../soc/arm64/qemu_virt_arm64 -I../../../../../../subsys/testsuite/include -I../../../../../../subsys/testsuite/ztest/include -isystem ../../../../../../lib/libc/minimal/include -isystem /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/../lib/gcc/aarch64-zephyr-elf/12.2.0/include -isystem /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/../lib/gcc/aarch64-zephyr-elf/12.2.0/include-fixed -fno-strict-aliasing -Werror -Os -imacros /__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mabi=lp64 --sysroot=/opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/aarch64-zephyr-elf -imacros /__w/zephyr/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/__w/zephyr/zephyr/tests/kernel/common=CMAKE_SOURCE_DIR -fmacro-prefix-map=/__w/zephyr/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/__w/zephyr=WEST_TOPDIR -ffunction-sections -fdata-sections -mno-outline-atomics -moverride=tune=no_ldp_stp_qregs -std=c99 -nostdinc -MD -MT zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.obj -MF zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/lib/os/hex.c.obj -c /__w/zephyr/zephyr/lib/os/hex.c
In file included from ../../../../../../include/zephyr/arch/syscall.h:19,
                 from ../../../../../../include/zephyr/syscall.h:12,
                 from zephyr/include/generated/syscalls/errno_private.h:12,
                 from ../../../../../../include/zephyr/sys/errno_private.h:53,
                 from ../../../../../../lib/libc/minimal/include/errno.h:32,
                 from /__w/zephyr/zephyr/lib/os/hex.c:9:
../../../../../../include/zephyr/arch/arm64/syscall.h:152:25: error: conflicting types for 'arch_syscall_invoke0'; have 'uintptr_t(uintptr_t)' {aka 'long unsigned int(long unsigned int)'}
  152 | static inline uintptr_t arch_syscall_invoke0(uintptr_t call_id)
      |                         ^~~~~~~~~~~~~~~~~~~~
In file included from ../../../../../../include/zephyr/sys/time_units.h:1418,
                 from ../../../../../../include/zephyr/sys/util.h:565,
                 from ../../../../../../include/zephyr/arch/arm64/cpu.h:10,
                 from ../../../../../../include/zephyr/arch/arm64/lib_helpers.h:12,
                 from ../../../../../../include/zephyr/arch/arm64/syscall.h:28:
zephyr/include/generated/syscalls/time_units.h:28:30: note: previous implicit declaration of 'arch_syscall_invoke0' with type 'int()'
   28 |                 return (int) arch_syscall_invoke0(K_SYSCALL_SYS_CLOCK_HW_CYCLES_PER_SEC_RUNTIME_GET);
      |                              ^~~~~~~~~~~~~~~~~~~~
../../../../../../include/zephyr/syscall.h:94:27: error: conflicting types for 'z_syscall_trap'; have '_Bool(void)'
   94 | static ALWAYS_INLINE bool z_syscall_trap(void)
      |                           ^~~~~~~~~~~~~~
zephyr/include/generated/syscalls/time_units.h:27:13: note: previous implicit declaration of 'z_syscall_trap' with type 'int()'
   27 |         if (z_syscall_trap()) {
      |             ^~~~~~~~~~~~~~
[11/173] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/dec.c.obj
[12/173] Building C object CMakeFiles/app.dir/src/printk.c.obj
[13/173] Building C object CMakeFiles/app.dir/src/main.c.obj
[14/173] Building C object CMakeFiles/app.dir/src/boot_delay.c.obj
[15/173] Building C object CMakeFiles/app.dir/src/multilib.c.obj
[16/173] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj
FAILED: zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj 
ccache /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/aarch64-zephyr-elf-gcc -DKERNEL -DTC_RUNID=d1ed75d5fcd69c8397b2cd2c873ef663 -D__ZEPHYR__=1 -I../../../../../../kernel/include -I../../../../../../arch/arm64/include -I../../../../../../include -Izephyr/include/generated -I../../../../../../soc/arm64/qemu_virt_arm64 -I../../../../../../subsys/testsuite/include -I../../../../../../subsys/testsuite/ztest/include -isystem ../../../../../../lib/libc/minimal/include -isystem /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/../lib/gcc/aarch64-zephyr-elf/12.2.0/include -isystem /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/../lib/gcc/aarch64-zephyr-elf/12.2.0/include-fixed -fno-strict-aliasing -Werror -Os -imacros /__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mabi=lp64 --sysroot=/opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/aarch64-zephyr-elf -imacros /__w/zephyr/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/__w/zephyr/zephyr/tests/kernel/common=CMAKE_SOURCE_DIR -fmacro-prefix-map=/__w/zephyr/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/__w/zephyr=WEST_TOPDIR -ffunction-sections -fdata-sections -mno-outline-atomics -moverride=tune=no_ldp_stp_qregs -std=c99 -nostdinc -MD -MT zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj -MF zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/lib/os/fdtable.c.obj -c /__w/zephyr/zephyr/lib/os/fdtable.c
In file included from ../../../../../../include/zephyr/arch/syscall.h:19,
                 from ../../../../../../include/zephyr/syscall.h:12,
                 from zephyr/include/generated/syscalls/errno_private.h:12,
                 from ../../../../../../include/zephyr/sys/errno_private.h:53,
                 from ../../../../../../lib/libc/minimal/include/errno.h:32,
                 from /__w/zephyr/zephyr/lib/os/fdtable.c:16:
../../../../../../include/zephyr/arch/arm64/syscall.h:152:25: error: conflicting types for 'arch_syscall_invoke0'; have 'uintptr_t(uintptr_t)' {aka 'long unsigned int(long unsigned int)'}
  152 | static inline uintptr_t arch_syscall_invoke0(uintptr_t call_id)
      |                         ^~~~~~~~~~~~~~~~~~~~
In file included from ../../../../../../include/zephyr/sys/time_units.h:1418,
                 from ../../../../../../include/zephyr/sys/util.h:565,
                 from ../../../../../../include/zephyr/arch/arm64/cpu.h:10,
                 from ../../../../../../include/zephyr/arch/arm64/lib_helpers.h:12,
                 from ../../../../../../include/zephyr/arch/arm64/syscall.h:28:
zephyr/include/generated/syscalls/time_units.h:28:30: note: previous implicit declaration of 'arch_syscall_invoke0' with type 'int()'
   28 |                 return (int) arch_syscall_invoke0(K_SYSCALL_SYS_CLOCK_HW_CYCLES_PER_SEC_RUNTIME_GET);
      |                              ^~~~~~~~~~~~~~~~~~~~
../../../../../../include/zephyr/syscall.h:94:27: error: conflicting types for 'z_syscall_trap'; have '_Bool(void)'
   94 | static ALWAYS_INLINE bool z_syscall_trap(void)
      |                           ^~~~~~~~~~~~~~
zephyr/include/generated/syscalls/time_units.h:27:13: note: previous implicit declaration of 'z_syscall_trap' with type 'int()'
   27 |         if (z_syscall_trap()) {
      |             ^~~~~~~~~~~~~~
[17/173] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj
FAILED: zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj 
ccache /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/aarch64-zephyr-elf-gcc -DKERNEL -DTC_RUNID=d1ed75d5fcd69c8397b2cd2c873ef663 -D__ZEPHYR__=1 -I../../../../../../kernel/include -I../../../../../../arch/arm64/include -I../../../../../../include -Izephyr/include/generated -I../../../../../../soc/arm64/qemu_virt_arm64 -I../../../../../../subsys/testsuite/include -I../../../../../../subsys/testsuite/ztest/include -isystem ../../../../../../lib/libc/minimal/include -isystem /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/../lib/gcc/aarch64-zephyr-elf/12.2.0/include -isystem /opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/bin/../lib/gcc/aarch64-zephyr-elf/12.2.0/include-fixed -fno-strict-aliasing -Werror -Os -imacros /__w/zephyr/zephyr/twister-out/qemu_kvm_arm64/tests/kernel/common/kernel.common/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mabi=lp64 --sysroot=/opt/toolchains/zephyr-sdk-0.16.0/aarch64-zephyr-elf/aarch64-zephyr-elf -imacros /__w/zephyr/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/__w/zephyr/zephyr/tests/kernel/common=CMAKE_SOURCE_DIR -fmacro-prefix-map=/__w/zephyr/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/__w/zephyr=WEST_TOPDIR -ffunction-sections -fdata-sections -mno-outline-atomics -moverride=tune=no_ldp_stp_qregs -std=c99 -nostdinc -MD -MT zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj -MF zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj.d -o zephyr/CMakeFiles/zephyr.dir/lib/os/cbprintf_packaged.c.obj -c /__w/zephyr/zephyr/lib/os/cbprintf_packaged.c
In file included from ../../../../../../include/zephyr/arch/syscall.h:19,
                 from ../../../../../../include/zephyr/syscall.h:12,
                 from zephyr/include/generated/syscalls/errno_private.h:12,
                 from ../../../../../../include/zephyr/sys/errno_private.h:53,
                 from ../../../../../../lib/libc/minimal/include/errno.h:32,
                 from /__w/zephyr/zephyr/lib/os/cbprintf_packaged.c:7:
../../../../../../include/zephyr/arch/arm64/syscall.h:152:25: error: conflicting types for 'arch_syscall_invoke0'; have 'uintptr_t(uintptr_t)' {aka 'long unsigned int(long unsigned int)'}
  152 | static inline uintptr_t arch_syscall_invoke0(uintptr_t call_id)
      |                         ^~~~~~~~~~~~~~~~~~~~
In file included from ../../../../../../include/zephyr/sys/time_units.h:1418,
                 from ../../../../../../include/zephyr/sys/util.h:565,
                 from ../../../../../../include/zephyr/arch/arm64/cpu.h:10,
                 from ../../../../../../include/zephyr/arch/arm64/lib_helpers.h:12,
                 from ../../../../../../include/zephyr/arch/arm64/syscall.h:28:
zephyr/include/generated/syscalls/time_units.h:28:30: note: previous implicit declaration of 'arch_syscall_invoke0' with type 'int()'
   28 |                 return (int) arch_syscall_invoke0(K_SYSCALL_SYS_CLOCK_HW_CYCLES_PER_SEC_RUNTIME_GET);
      |                              ^~~~~~~~~~~~~~~~~~~~
../../../../../../include/zephyr/syscall.h:94:27: error: conflicting types for 'z_syscall_trap'; have '_Bool(void)'
   94 | static ALWAYS_INLINE bool z_syscall_trap(void)
      |                           ^~~~~~~~~~~~~~
zephyr/include/generated/syscalls/time_units.h:27:13: note: previous implicit declaration of 'z_syscall_trap' with type 'int()'
   27 |         if (z_syscall_trap()) {
      |             ^~~~~~~~~~~~~~
[18/173] Building C object CMakeFiles/app.dir/src/bitfield.c.obj
[19/173] Building C object CMakeFiles/app.dir/src/pow2.c.obj
[20/173] Building C object CMakeFiles/app.dir/src/irq_offload.c.obj
[21/173] Building C object CMakeFiles/app.dir/src/atomic.c.obj
[22/173] Building C object CMakeFiles/app.dir/src/timeout_order.c.obj
[23/173] Building C object CMakeFiles/app.dir/src/errno.c.obj
[24/173] Building C object zephyr/CMakeFiles/zephyr.dir/lib/os/printk.c.obj
[25/173] Building C object CMakeFiles/app.dir/src/clock.c.obj
[26/173] Building C object CMakeFiles/app.dir/src/byteorder.c.obj
[27/173] Building C object CMakeFiles/app.dir/src/bitarray.c.obj
ninja: build stopped: subcommand failed.

Environment (please complete the following information):

  • OS: Linux / Windows
  • Toolchain: Zephyr SDK 0.15.2, Zephyr SDK 0.16.0
  • Commit SHA fbf851c
  • With previous commit 0d95e16 the bug is not reproducible

Additional context
N/A

@manuargue manuargue added the bug The issue is a bug, or the PR is fixing a bug label Mar 24, 2023
@peter-mitsis
Copy link
Collaborator

I may be wrong, but I think that this failure is related PR #56014.

@manuargue
Copy link
Member Author

manuargue commented Mar 28, 2023

I may be wrong, but I think that this failure is related PR #56014.

cc @yperess, please see #56014 (comment). It seems to be a regression from fbf851c, as with previous commit 0d95e16, the issue is not reproducible.

@manuargue manuargue added the Regression Something, which was working, does not anymore label Mar 28, 2023
@henrikbrixandersen henrikbrixandersen added area: Kernel area: QEMU QEMU Emulation area: Tests Issues related to a particular existing or missing test area: ARM64 ARM (64-bit) Architecture labels Mar 28, 2023
@jgl-meta jgl-meta removed the Regression Something, which was working, does not anymore label Mar 28, 2023
@nashif
Copy link
Member

nashif commented Mar 28, 2023

This is fixed upstream, can't reproduce.

@nashif
Copy link
Member

nashif commented Mar 28, 2023

fixed by

commit f43c7367b173b96a6cc989490dee35020549a420
Author: Carlo Caione <[email protected]>
Date:   Tue Mar 28 10:13:35 2023 +0200

    arm64: Break circular dependency on syscall.h

    Commit fbf851cdc4d8f0afe60131aea6154945f126d778 is introducing a
    dependency between util.h and time_units.h.

    Now, the problem is that time_units.h is from one side included by
    arm64/syscall.h (syscall.h -> lib_helpers.h -> cpu.h -> util.h) but on
    the other side it is including syscall.h (time_units.h -> syscall.h).

    Break the dependency at cpu.h level.

    Signed-off-by: Carlo Caione <[email protected]>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ARM64 ARM (64-bit) Architecture area: Kernel area: QEMU QEMU Emulation area: Tests Issues related to a particular existing or missing test bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

5 participants