poky.lists.yoctoproject.org archive mirror
 help / color / mirror / Atom feed
From: Hope Sneddon <hope.sneddon@outlook.com>
To: "poky@lists.yoctoproject.org" <poky@lists.yoctoproject.org>
Subject: Compiling Poky with Clang and Clang Coverage Flags
Date: Mon, 22 Apr 2024 01:42:49 +0000	[thread overview]
Message-ID: <SL2P216MB127763AD758C2A81F525573499122@SL2P216MB1277.KORP216.PROD.OUTLOOK.COM> (raw)

[-- Attachment #1: Type: text/plain, Size: 2385 bytes --]


Hi Poky Community,

I am trying to build a Yocto code base using Clang and LLVM as the default toolchain (i.e. nonclangables still compile with GCC) as per the “Using Clang Compiler with Yocto Project” presentation instructions<https://elinux.org/images/f/ff/Yps2021.11-clang.pdf>. The issue is I need to compile with code coverage via the Clang coverage flags which do not seem to work with Yocto/ Poky by default. I have simplified my application all the way back to a freshly cloned Poky repo with only the following changes to reproduce the error, proving it is not a problem caused by custom configurations/ use case development.

That is, to show the issue, in a fresh clone of Poky, the following lines are added to local.conf:
TOOLCHAIN = "clang"
TARGET_CPPFLAGS:prepend = "-fprofile-instr-generate -fcoverage-mapping "
RUNTIME = "llvm"
CLANGSDK = "1"

Simple Clang compilation of Poky works, however I need to compile with code coverage which doesn’t seem to currently work by default (i.e. add the Clang coverage flags in local.conf using TARGET_CPPFLAGS:prepend = "-fprofile-instr-generate -fcoverage-mapping ").

To demonstrate this I have implemented a simple “hello-world” recipe as hello-world_1.0.0.bb (extract below excludes recipe header lines):
S = "${WORKDIR}/${PN}-${PV}"

python do_hello_world(){
    print("Hello World\n")
}

addtask do_hello_world

Compiling this via the command bitbake hello-world fails.

Failure is caused by the do_compile step to failing due to oe_runmake failing:
ERROR: gcc-cross-x86_64-11.4.0-r0 do_compile: oe_runmake failed.

The log data from oe_runmake indicates the failure is induced at the following oe_runmake step (log output):
checking for suffix of object files... configure: error: in `/home/dev/poky/build/tmp/work/x86_64-linux/gcc-cross-x86_64/11.4.0-r0/gcc-11.4.0/build.x86_64-linux.x86_64-poky-linux/x86_64-poky-linux/libgcc':
| configure: error: cannot compute suffix of object files: cannot compile

The failure of gcc_cross does not seem to be representative of the actual root of the issue, so debugging this is proving difficult. Any guidance on how to get Clang coverage working would be greatly appreciated as my application requires the employment of a lot of the llvm-cov toolset (the motivation for substituting compiler in the first place).

Thank you,

Hope

[-- Attachment #2: Type: text/html, Size: 5695 bytes --]

             reply	other threads:[~2024-04-22  1:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-22  1:42 Hope Sneddon [this message]
2024-04-22  7:51 ` [poky] Compiling Poky with Clang and Clang Coverage Flags Khem Raj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SL2P216MB127763AD758C2A81F525573499122@SL2P216MB1277.KORP216.PROD.OUTLOOK.COM \
    --to=hope.sneddon@outlook.com \
    --cc=poky@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).