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

Compilation error with Log v2 and CONFIG_LOG_PRINTK #34558

Closed
dcpleung opened this issue Apr 26, 2021 · 0 comments · Fixed by #34559
Closed

Compilation error with Log v2 and CONFIG_LOG_PRINTK #34558

dcpleung opened this issue Apr 26, 2021 · 0 comments · Fixed by #34559
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug

Comments

@dcpleung
Copy link
Member

Using the latest commit e366d79 and building hello world with the following command resulted compilation error.

Command: west build -p -b qemu_x86 samples/hello_world -- -DCONFIG_LOG_PRINTK=y -DCONFIG_LOG2_MODE_DEFERRED=y -DCONFIG_LOG=y

Build log:

[32/125] Building C object CMakeFiles/app.dir/src/main.c.obj
FAILED: CMakeFiles/app.dir/src/main.c.obj 
/opt/zephyr-sdk/current/x86_64-zephyr-elf/bin/x86_64-zephyr-elf-gcc -DBUILD_VERSION=zephyr-v2.5.0-2578-ge366d7948a53 -DKERNEL -D_FORTIFY_SOURCE=2 -D__ZEPHYR__=1 -Izephyr/rtos/zephyr/include -Izephyr/include/generated -Izephyr/rtos/zephyr/soc/x86/ia32 -isystem zephyr/rtos/zephyr/lib/libc/minimal/include -isystem /opt/zephyr-sdk/0.12/x86_64-zephyr-elf/bin/../lib/gcc/x86_64-zephyr-elf/10.2.0/include -isystem /opt/zephyr-sdk/0.12/x86_64-zephyr-elf/bin/../lib/gcc/x86_64-zephyr-elf/10.2.0/include-fixed -m32  -Os -imacros /tmp/build/zephyr/include/generated/autoconf.h -ffreestanding -fno-common -g -fdiagnostics-color=always -m32 -Wa,--divide -imacros zephyr/rtos/zephyr/include/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-address-of-packed-member -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=zephyr/rtos/zephyr/samples/hello_world=CMAKE_SOURCE_DIR -fmacro-prefix-map=zephyr/rtos/zephyr=ZEPHYR_BASE -fmacro-prefix-map=zephyr/rtos=WEST_TOPDIR -ffunction-sections -fdata-sections -mpreferred-stack-boundary=2 -mno-mmx -mno-sse -std=c99 -nostdinc -MD -MT CMakeFiles/app.dir/src/main.c.obj -MF CMakeFiles/app.dir/src/main.c.obj.d -o CMakeFiles/app.dir/src/main.c.obj -c zephyr/rtos/zephyr/samples/hello_world/src/main.c
In file included from zephyr/rtos/zephyr/include/sys/util_macro.h:34,
                 from zephyr/rtos/zephyr/include/sys/util.h:17,
                 from zephyr/rtos/zephyr/include/sched_priq.h:9,
                 from zephyr/rtos/zephyr/include/kernel_includes.h:23,
                 from zephyr/rtos/zephyr/include/kernel.h:17,
                 from zephyr/rtos/zephyr/include/zephyr.h:18,
                 from zephyr/rtos/zephyr/samples/hello_world/src/main.c:7:
zephyr/rtos/zephyr/samples/hello_world/src/main.c: In function 'main':
zephyr/rtos/zephyr/include/logging/log_msg2.h:441:48: error: 'Z_LOG_FUNC_PREFIX_LOG_LEVEL_INTERNAL_RAW_STRING' undeclared (first use in this function)
  441 |  Z_LOG_MSG2_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_##_level), \
      |                                                ^~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_internal.h:67:26: note: in definition of macro '__DEBRACKET'
   67 | #define __DEBRACKET(...) __VA_ARGS__
      |                          ^~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_internal.h:59:2: note: in expansion of macro '__GET_ARG2_DEBRACKET'
   59 |  __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)
      |  ^~~~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_internal.h:56:2: note: in expansion of macro '__COND_CODE'
   56 |  __COND_CODE(_ZZZZ##_flag, _if_0_code, _else_code)
      |  ^~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_macro.h:133:2: note: in expansion of macro 'Z_COND_CODE_0'
  133 |  Z_COND_CODE_0(_flag, _if_0_code, _else_code)
      |  ^~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/cbprintf_internal.h:110:2: note: in expansion of macro 'COND_CODE_0'
  110 |  COND_CODE_0(NUM_VA_ARGS_LESS_1(__VA_ARGS__), \
      |  ^~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/cbprintf.h:92:2: note: in expansion of macro 'Z_CBPRINTF_MUST_RUNTIME_PACKAGE'
   92 |  Z_CBPRINTF_MUST_RUNTIME_PACKAGE(skip, __VA_ARGS__)
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/logging/log_msg2.h:417:6: note: in expansion of macro 'CBPRINTF_MUST_RUNTIME_PACKAGE'
  417 |  if (CBPRINTF_MUST_RUNTIME_PACKAGE(_cstr_cnt, __VA_ARGS__)) { \
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/logging/log_msg2.h:441:2: note: in expansion of macro 'Z_LOG_MSG2_CREATE2'
  441 |  Z_LOG_MSG2_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_##_level), \
      |  ^~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_internal.h:84:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
   84 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, __VA_ARGS__)
      |                          ^~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/logging/log_msg2.h:441:39: note: in expansion of macro 'UTIL_CAT'
  441 |  Z_LOG_MSG2_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_##_level), \
      |                                       ^~~~~~~~
zephyr/rtos/zephyr/include/logging/log_core.h:480:2: note: in expansion of macro 'Z_LOG_MSG2_CREATE'
  480 |  Z_LOG_MSG2_CREATE(!IS_ENABLED(CONFIG_USERSPACE), _mode, \
      |  ^~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/printk.h:51:21: note: in expansion of macro 'Z_LOG_PRINTK'
   51 | #define printk(...) Z_LOG_PRINTK(__VA_ARGS__)
      |                     ^~~~~~~~~~~~
zephyr/rtos/zephyr/samples/hello_world/src/main.c:12:2: note: in expansion of macro 'printk'
   12 |  printk("Hello World! %s\n", CONFIG_BOARD);
      |  ^~~~~~
zephyr/rtos/zephyr/include/logging/log_msg2.h:441:48: note: each undeclared identifier is reported only once for each function it appears in
  441 |  Z_LOG_MSG2_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_##_level), \
      |                                                ^~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_internal.h:67:26: note: in definition of macro '__DEBRACKET'
   67 | #define __DEBRACKET(...) __VA_ARGS__
      |                          ^~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_internal.h:59:2: note: in expansion of macro '__GET_ARG2_DEBRACKET'
   59 |  __GET_ARG2_DEBRACKET(one_or_two_args _if_code, _else_code)
      |  ^~~~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_internal.h:56:2: note: in expansion of macro '__COND_CODE'
   56 |  __COND_CODE(_ZZZZ##_flag, _if_0_code, _else_code)
      |  ^~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_macro.h:133:2: note: in expansion of macro 'Z_COND_CODE_0'
  133 |  Z_COND_CODE_0(_flag, _if_0_code, _else_code)
      |  ^~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/cbprintf_internal.h:110:2: note: in expansion of macro 'COND_CODE_0'
  110 |  COND_CODE_0(NUM_VA_ARGS_LESS_1(__VA_ARGS__), \
      |  ^~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/cbprintf.h:92:2: note: in expansion of macro 'Z_CBPRINTF_MUST_RUNTIME_PACKAGE'
   92 |  Z_CBPRINTF_MUST_RUNTIME_PACKAGE(skip, __VA_ARGS__)
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/logging/log_msg2.h:417:6: note: in expansion of macro 'CBPRINTF_MUST_RUNTIME_PACKAGE'
  417 |  if (CBPRINTF_MUST_RUNTIME_PACKAGE(_cstr_cnt, __VA_ARGS__)) { \
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/logging/log_msg2.h:441:2: note: in expansion of macro 'Z_LOG_MSG2_CREATE2'
  441 |  Z_LOG_MSG2_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_##_level), \
      |  ^~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/util_internal.h:84:26: note: in expansion of macro 'UTIL_PRIMITIVE_CAT'
   84 | #define UTIL_CAT(a, ...) UTIL_PRIMITIVE_CAT(a, __VA_ARGS__)
      |                          ^~~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/logging/log_msg2.h:441:39: note: in expansion of macro 'UTIL_CAT'
  441 |  Z_LOG_MSG2_CREATE2(_try_0cpy, _mode, UTIL_CAT(Z_LOG_FUNC_PREFIX_##_level), \
      |                                       ^~~~~~~~
zephyr/rtos/zephyr/include/logging/log_core.h:480:2: note: in expansion of macro 'Z_LOG_MSG2_CREATE'
  480 |  Z_LOG_MSG2_CREATE(!IS_ENABLED(CONFIG_USERSPACE), _mode, \
      |  ^~~~~~~~~~~~~~~~~
zephyr/rtos/zephyr/include/sys/printk.h:51:21: note: in expansion of macro 'Z_LOG_PRINTK'
   51 | #define printk(...) Z_LOG_PRINTK(__VA_ARGS__)
      |                     ^~~~~~~~~~~~
zephyr/rtos/zephyr/samples/hello_world/src/main.c:12:2: note: in expansion of macro 'printk'
   12 |  printk("Hello World! %s\n", CONFIG_BOARD);
      |  ^~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants