Skip to content

libgcc: C11 threads-based gthread support cannot link samples/cpp/hello_world out-of-the-box #751

@cfriedt

Description

@cfriedt

Just test-driving the v0.16.6 SDK, and it looks like samples/cpp/hello_world does not build and run OOTB.

Moving from v0.16.5-1 to 0.16.6, I needed to additionally enable the following in order for the app to link.

CONFIG_COMMON_LIBC_THRD=y
CONFIG_POSIX_API=y
CONFIG_DYNAMIC_THREAD=y
CONFIG_THREAD_STACK_INFO=y

One possible solution for the above would be to create weak versions of the C11 <thread.h> functions in the toolchain, such that linking to an external implementation will provided the necessary functionality (when required).

Since samples/cpp/hello_world does not require C++11 threading, this seems like it would be a good choice.

Beyond that, a couple of additional platforms are now facing issues

qemu_riscv64 and qemu_riscv32

[142/143] To exit from QEMU enter: 'CTRL+a, x'[QEMU] CPU: riscv64
*** Booting Zephyr OS build v3.6.0-3273-g40a8022e4a14 ***
abort()
[142/143] To exit from QEMU enter: 'CTRL+a, x'[QEMU] CPU: riscv32
*** Booting Zephyr OS build v3.6.0-3273-g40a8022e4a14 ***
abort()

This is likely due to something like stack unwinding, but it will take additional effort to diagnose / remedy.

Otherwise, qemu_x86_64, qemu_cortex_a53, qemu_cortex_m3 have been tested with the command below

west build -p -b qemu_cortex_m3 -t run samples/cpp/hello_world \
  -- \
  -DCONFIG_COMMON_LIBC_THRD=y \
  -DCONFIG_POSIX_API=y \
  -DCONFIG_DYNAMIC_THREAD=y \
  -DCONFIG_THREAD_STACK_INFO=y

Metadata

Metadata

Assignees

Labels

area: libstdc++Issues related to libstdc++ (GNU C++ Library)priority: lowLow impact/importance issue

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions