Building chromium with clang coverage

96 views
Skip to first unread message

Manas Ghandat

unread,
Mar 6, 2026, 7:59:54 AM (8 days ago) Mar 6
to Chromium-dev
I am trying to build a coveage build for chromium and run into the following issue:

```
../../third_party/libFuzzer/src/FuzzerInterceptors.cpp:151:25: error: conflicting types for 'bcmp'
  151 | ATTRIBUTE_INTERFACE int bcmp(const char *s1, const char *s2, size_t n) {
      |                         ^
gen/build/modules/linux/../../../../../../build/linux/debian_bullseye_amd64-sysroot/usr/include/strings.h:34:12: note: previous
      declaration is here
   34 | extern int bcmp (const void *__s1, const void *__s2, size_t __n)
      |            ^
../../third_party/libFuzzer/src/FuzzerInterceptors.cpp:197:27: error: functions that differ only in their return type cannot be
      overloaded
  197 | ATTRIBUTE_INTERFACE char *strstr(const char *s1, const char *s2) {
      |                     ~~~~~~^
../../build/linux/debian_bullseye_amd64-sysroot/usr/include/string.h:323:1: note: previous definition is here
  322 | __extern_always_inline const char *
      |                              ~~~~~~
  323 | strstr (const char *__haystack, const char *__needle) __THROW
      | ^
../../third_party/libFuzzer/src/FuzzerInterceptors.cpp:205:27: error: functions that differ only in their return type cannot be
      overloaded
  205 | ATTRIBUTE_INTERFACE char *strcasestr(const char *s1, const char *s2) {
      |                     ~~~~~~^
../../build/linux/debian_bullseye_amd64-sysroot/usr/include/string.h:356:26: note: previous declaration is here
  356 | extern "C++" const char *strcasestr (const char *__haystack,
```

Event after fixing the `FuzzerInterceptors.cpp` file, there are stil errors that persist. Below is my compilation approach:

```
gn gen out/coverage --args='''
dcheck_always_on = false

is_debug = false
use_clang_coverage = true
is_component_build = false
optimize_for_fuzzing = false
use_remoteexec = false
is_asan = false
use_libfuzzer = true
symbol_level = 2'''

autoninja -C out/coverage
```

If anyone has a fix, do let me know

Giovanni Ortuño

unread,
Mar 6, 2026, 10:07:05 AM (8 days ago) Mar 6
to ghanda...@gmail.com, Chromium-dev
Hi,

How come you're using `use_libfuzzer = true`? Are you trying to compile a fuzzer?

We don't support running fuzzers with code coverage enabled.

Gio

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/31c387b1-866c-48be-a04f-025b9665b7fen%40chromium.org.

Manas Ghandat

unread,
Mar 6, 2026, 10:26:43 AM (8 days ago) Mar 6
to Giovanni Ortuño, Chromium-dev
Hi,

My goal is generating coverage for the input corpus that I have got after fuzzing. That would require me to generate a fuzz target (thus `use_libfuzzer=true`) and use clang coverage. I was following the instructions mentioned here: https://github.com/chromium/chromium/blob/main/tools/code_coverage/coverage.py#L38

Thanks,
Manas
On 3/6/26 20:34, Giovanni Ortuño wrote:
> Hi,
>
> How come you're using `use_libfuzzer = true`? Are you trying to compile a fuzzer?
>
> We don't support running fuzzers with code coverage enabled.
>
> Gio
>
> Chromium Developers mailing list: chromi...@chromium.org <mailto:chromi...@chromium.org>
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev <http://groups.google.com/a/chromium.org/group/chromium-dev>
> ---
> You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org <mailto:chromium-dev...@chromium.org>.
> To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/31c387b1-866c-48be-a04f-025b9665b7fen%40chromium.org <https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/31c387b1-866c-48be-a04f-025b9665b7fen%40chromium.org?utm_medium=email&utm_source=footer>.
>

Giovanni Ortuño

unread,
Mar 6, 2026, 10:44:51 AM (8 days ago) Mar 6
to Manas Ghandat, Chromium-dev, Dylan Jew, Tigran Bantikyan
Ah, I was mistaken. We do support building fuzzers with code coverage. Looking at the code coverage bot, I see this gn argument that you might be missing:

```
use_clang_modules = false

```

Mind trying that?

Manas Ghandat

unread,
Mar 9, 2026, 5:08:23 AM (6 days ago) Mar 9
to Giovanni Ortuño, Chromium-dev, Dylan Jew, Tigran Bantikyan

Thank you so much, the suggested method worked.
On 3/6/26 21:11, Giovanni Ortuño wrote:
> Ah, I was mistaken. We do support building fuzzers with code coverage. Looking at the code coverage bot, I see this gn argument that you might be missing:
>
> ```
> use_clang_modules = false
> ```
>
> Mind trying that?
>
> On Fri, Mar 6, 2026 at 10:24 AM Manas Ghandat <ghanda...@gmail.com <mailto:ghanda...@gmail.com>> wrote:
>
> Hi,
>
> My goal is generating coverage for the input corpus that I have got after fuzzing. That would require me to generate a fuzz target (thus `use_libfuzzer=true`) and use clang coverage. I was following the instructions mentioned here: https://github.com/chromium/chromium/blob/main/tools/code_coverage/coverage.py#L38 <https://github.com/chromium/chromium/blob/main/tools/code_coverage/coverage.py#L38>
> >     Chromium Developers mailing list: chromi...@chromium.org <mailto:chromi...@chromium.org> <mailto:chromi...@chromium.org <mailto:chromi...@chromium.org>>
> >     View archives, change email options, or unsubscribe:
> >     http://groups.google.com/a/chromium.org/group/chromium-dev <http://groups.google.com/a/chromium.org/group/chromium-dev> <http://groups.google.com/a/chromium.org/group/chromium-dev <http://groups.google.com/a/chromium.org/group/chromium-dev>>
> >     ---
> >     You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
> >     To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org <mailto:chromium-dev%2Bunsu...@chromium.org> <mailto:chromium-dev...@chromium.org <mailto:chromium-dev%2Bunsu...@chromium.org>>.
> >     To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/31c387b1-866c-48be-a04f-025b9665b7fen%40chromium.org <https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/31c387b1-866c-48be-a04f-025b9665b7fen%40chromium.org> <https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/31c387b1-866c-48be-a04f-025b9665b7fen%40chromium.org?utm_medium=email&utm_source=footer <https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/31c387b1-866c-48be-a04f-025b9665b7fen%40chromium.org?utm_medium=email&utm_source=footer>>.
> >
>

Nico Weber

unread,
Mar 9, 2026, 11:45:23 AM (5 days ago) Mar 9
to ghanda...@gmail.com, Giovanni Ortuño, Chromium-dev, Dylan Jew, Tigran Bantikyan
(Modules not working in coverage builds is crbug.com/440481921)

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/60f26b59-d14d-47e0-b3e8-ea70878e5316%40gmail.com.

Junji Watanabe

unread,
Mar 9, 2026, 10:11:49 PM (5 days ago) Mar 9
to tha...@chromium.org, ghanda...@gmail.com, Giovanni Ortuño, Chromium-dev, Dylan Jew, Tigran Bantikyan
It sounds like we need to disable use_clang_modules when use_clang_coverage is enabled. 
We will follow up on it.

Sidhin Thomas

unread,
Mar 11, 2026, 7:03:39 AM (4 days ago) Mar 11
to jw...@google.com, tha...@chromium.org, ghanda...@gmail.com, Giovanni Ortuño, Chromium-dev, Dylan Jew, Tigran Bantikyan
Apologies, wrong thread.

On Wed, Mar 11, 2026 at 4:30 PM Sidhin Thomas <sidhin...@gmail.com> wrote:
Inspired by the thread. I tried another hand on RBE and got native link working. The benefits from caching are huge vs ccache. But in order to get it working I had to hard code the container-image from google.star while building the worker image. I'll update it every now and then.

Any idea, how much and what kind of issues can I expect due to toolchain drift when using the RBE for dev workflows? C++ in general is ABI compatible so I am assuming it should be safe. 
(I am basically ignoring toolchain as a match condition for workers)

Sidhin Thomas

unread,
Mar 11, 2026, 7:03:39 AM (4 days ago) Mar 11
to jw...@google.com, tha...@chromium.org, ghanda...@gmail.com, Giovanni Ortuño, Chromium-dev, Dylan Jew, Tigran Bantikyan
Inspired by the thread. I tried another hand on RBE and got native link working. The benefits from caching are huge vs ccache. But in order to get it working I had to hard code the container-image from google.star while building the worker image. I'll update it every now and then.

Any idea, how much and what kind of issues can I expect due to toolchain drift when using the RBE for dev workflows? C++ in general is ABI compatible so I am assuming it should be safe. 
(I am basically ignoring toolchain as a match condition for workers)

On Tue, Mar 10, 2026 at 7:38 AM 'Junji Watanabe' via Chromium-dev <chromi...@chromium.org> wrote:
Reply all
Reply to author
Forward
0 new messages