Skip to content

[Bug]: Clang's command line option --sysroot=<path> is not considered during cmake processing phase #567

Description

@chentang16

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

In the use cases such as using llvm-libc as overlay C lib or explicitly using another C lib other than the default one of the clang toolchain, the clang compiler option --sysroot=<path> is used:
https://developer.arm.com/documentation/107976/22-1-0/Clang-reference/clang-command-line-options/--sysroot--path---clang-

With this option, clang will exclusively use the headers and libs defined by the <path> to build a project. However, due to the cmake process/creation done by CMSIS-Toolbox, CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES will be set with the default header/lib include path from the toolchain without considering the option --sysroot=<path> defined in the csolution/cpoject yml file, so that in this case an additional -isystem option with the default header/lib include path from the clang toolchain will be added during the compilation. This results in both/conflicted header/lib include paths (one default from the toolchain + one defined by --sysroot=<path>) are used during compilation.

We should find a proper solution for this use case.

Expected Behavior

When the clang compiler option --sysroot=<path> is used, only the <path> should be used/included during both cmake process/creation process and the final compilation process.

Affected tools

  • cbuild
  • cbuild2cmake

Affected operating systems

  • all

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status
Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions