git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Josh Steadmon <steadmon@google.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] ci: also define CXX environment variable
Date: Wed, 10 Apr 2024 13:58:50 -0700	[thread overview]
Message-ID: <Zhb9ioeICP6FRJlu@google.com> (raw)
In-Reply-To: <20240306010016.GA3811328@coredump.intra.peff.net>

On 2024.03.05 20:00, Jeff King wrote:
> On Tue, Mar 05, 2024 at 07:50:58PM -0500, Jeff King wrote:
> 
> > On Tue, Mar 05, 2024 at 01:11:59PM -0800, Josh Steadmon wrote:
> > 
> > > In a future commit, we will build the fuzzer executables as part of the
> > > default 'make all' target, which requires a C++ compiler. If we do not
> > > explicitly set CXX, it defaults to g++ on GitHub CI. However, this can
> > > lead to incorrect feature detection when CC=clang, since the
> > > 'detect-compiler' script only looks at CC. Fix the issue by always
> > > setting CXX to match CC in our CI config.
> > > 
> > > We only plan on building fuzzers on Linux, so none of the other CI
> > > configs need a similar adjustment.
> > 
> > Does this mean that after your patch 2, running:
> > 
> >   make CC=clang
> > 
> > may have problems on Linux, because it will now try to link fuzzers
> > using g++, even though everything else is built with clang (and ditto
> > the detect-compiler used it)?
> 
> Also, if the answer is "yes": do we really need a c++ linker here? My
> understanding from reading "git log -SCXX Makefile" is that when using
> oss-fuzz, you'd sometimes want to pass c++ specific things in
> FUZZ_CXXFLAGS. But we're not using that here, and are just making sure
> that things can be linked. Can we just use $(CC) by default here, then?
> 
> Something like:
> 
> diff --git a/Makefile b/Makefile
> index f74e96d7c2..3f09d75f46 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -3861,17 +3861,18 @@ cover_db_html: cover_db
>  #
>  # An example command to build against libFuzzer from LLVM 11.0.0:
>  #
> -# make CC=clang CXX=clang++ \
> +# make CC=clang FUZZ_CXX=clang++ \
>  #      CFLAGS="-fsanitize=fuzzer-no-link,address" \
>  #      LIB_FUZZING_ENGINE="-fsanitize=fuzzer,address" \
>  #      fuzz-all
>  #
> +FUZZ_CXX ?= $(CC)
>  FUZZ_CXXFLAGS ?= $(ALL_CFLAGS)
>  
>  .PHONY: fuzz-all
>  
>  $(FUZZ_PROGRAMS): %: %.o oss-fuzz/dummy-cmd-main.o $(GITLIBS) GIT-LDFLAGS
> -	$(QUIET_LINK)$(CXX) $(FUZZ_CXXFLAGS) -o $@ $(ALL_LDFLAGS) \
> +	$(QUIET_LINK)$(FUZZ_CXX) $(FUZZ_CXXFLAGS) -o $@ $(ALL_LDFLAGS) \
>  		-Wl,--allow-multiple-definition \
>  		$(filter %.o,$^) $(filter %.a,$^) $(LIBS) $(LIB_FUZZING_ENGINE)
>  
> 
> -Peff

Indeed, it does break, and this is a good fix. Thanks for the catch!


  reply	other threads:[~2024-04-10 20:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 21:11 [PATCH 0/2] fuzz: build fuzzers by default on Linux Josh Steadmon
2024-03-05 21:11 ` [PATCH 1/2] ci: also define CXX environment variable Josh Steadmon
2024-03-05 21:37   ` Junio C Hamano
2024-04-09 21:32     ` Josh Steadmon
2024-03-06  0:50   ` Jeff King
2024-03-06  1:00     ` Jeff King
2024-04-10 20:58       ` Josh Steadmon [this message]
2024-03-05 21:12 ` [PATCH 2/2] fuzz: link fuzz programs with `make all` on Linux Josh Steadmon
2024-03-05 21:44   ` Junio C Hamano
2024-04-09 21:58     ` Josh Steadmon
2024-04-10 20:49       ` Josh Steadmon
2024-04-10 20:57         ` Junio C Hamano
2024-04-10 21:11       ` Jeff King
2024-03-26 21:51 ` [PATCH 0/2] fuzz: build fuzzers by default " Junio C Hamano
2024-04-09 21:34   ` Josh Steadmon
2024-04-11 18:14 ` [PATCH v2 " Josh Steadmon
2024-04-11 18:14   ` [PATCH v2 1/2] ci: also define CXX environment variable Josh Steadmon
2024-04-12  4:22     ` Jeff King
2024-04-24 18:15       ` Josh Steadmon
2024-04-11 18:14   ` [PATCH v2 2/2] fuzz: link fuzz programs with `make all` on Linux Josh Steadmon
2024-04-11 21:39     ` Junio C Hamano
2024-04-24 18:14 ` [PATCH v3] " Josh Steadmon
2024-04-24 19:07   ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=Zhb9ioeICP6FRJlu@google.com \
    --to=steadmon@google.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).