You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by "Jens Geyer (Jira)" <ji...@apache.org> on 2026/10/14 21:53:00 UTC

[jira] [Created] (THRIFT-6412) c_glib: make check fails with gcc because the fuzz targets have no main()

Jens Geyer created THRIFT-6412:
----------------------------------

             Summary: c_glib: make check fails with gcc because the fuzz targets have no main()
                 Key: THRIFT-6412
                 URL: https://issues.apache.org/jira/browse/THRIFT-6412
             Project: Thrift
          Issue Type: Bug
          Components: C glib - Library, Build Process
            Reporter: Jens Geyer


{{lib/c_glib/test/Makefile.am}} enters {{fuzz}} first ({{SUBDIRS = fuzz}}), and {{lib/c_glib/test/fuzz/Makefile.am}} builds {{fuzz_parse_compact}} and {{fuzz_parse_binary}} as {{check_PROGRAMS}}. Their sources define {{LLVMFuzzerTestOneInput()}} and no {{main()}}; that comes from libFuzzer, which the Makefile links only when the compiler is clang ({{if USING_CLANG}} adds {{\-fsanitize=fuzzer}}). With gcc the link fails, and {{make check}} stops there before a single c_glib test has run. This applies to {{make check}} in {{lib/c_glib/test}}, in {{lib/c_glib}} and at the top level, which all recurse into it.

On master with gcc 11, C++ enabled so that zlib is linked:

{noformat}
Making check in fuzz
make[2]: Entering directory '.../lib/c_glib/test/fuzz'
...
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:590: fuzz_parse_compact] Error 1
{noformat}

The {{lib-c_glib}} CI job runs {{make \-C lib/c_glib/test check-am}} to step around it. The C++ fuzz targets build with gcc: {{lib/cpp/test/fuzz/FuzzCommon.tcc}} gives them a weak {{main()}} outside fuzzing builds.

Proposed change: give the c_glib fuzz targets the same weak {{main()}}, or build them only with clang, so that a plain {{make check}} passes with gcc. The targets were added under THRIFT-5855.

_Drafted with AI assistance (Claude Opus 5.5); reviewed and filed by Jens Geyer._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)