diff mbox series

[v2,1/2] ci: also define CXX environment variable

Message ID e55b6912725fa478134c7a67a9e4aeab7dca2c57.1712858920.git.steadmon@google.com (mailing list archive)
State New, archived
Headers show
Series fuzz: build fuzzers by default on Linux | expand

Commit Message

Josh Steadmon April 11, 2024, 6:14 p.m. UTC
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 with the next patch, so for
now, only adjust configuration for the Linux CI jobs.

Signed-off-by: Josh Steadmon <steadmon@google.com>
---
 .github/workflows/main.yml | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Jeff King April 12, 2024, 4:22 a.m. UTC | #1
On Thu, Apr 11, 2024 at 11:14:24AM -0700, 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.

Since you took my suggestion in patch 2, this "which requires a C++
compiler" is no longer true, is it? And I don't think we'd even look at
the CXX variable at all, since it's now FUZZ_CXX.

So this patch can just be dropped, I'd think.

-Peff
Josh Steadmon April 24, 2024, 6:15 p.m. UTC | #2
On 2024.04.12 00:22, Jeff King wrote:
> On Thu, Apr 11, 2024 at 11:14:24AM -0700, 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.
> 
> Since you took my suggestion in patch 2, this "which requires a C++
> compiler" is no longer true, is it? And I don't think we'd even look at
> the CXX variable at all, since it's now FUZZ_CXX.
> 
> So this patch can just be dropped, I'd think.
> 
> -Peff

Done in V3.
diff mbox series

Patch

diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 3428773b09..d9986256e6 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -265,42 +265,54 @@  jobs:
         vector:
           - jobname: linux-sha256
             cc: clang
+            cxx: clang++
             pool: ubuntu-latest
           - jobname: linux-reftable
             cc: clang
+            cxx: clang++
             pool: ubuntu-latest
           - jobname: linux-gcc
             cc: gcc
+            cxx: g++
             cc_package: gcc-8
             pool: ubuntu-20.04
           - jobname: linux-TEST-vars
             cc: gcc
+            cxx: g++
             cc_package: gcc-8
             pool: ubuntu-20.04
           - jobname: osx-clang
             cc: clang
+            cxx: clang++
             pool: macos-13
           - jobname: osx-reftable
             cc: clang
+            cxx: clang++
             pool: macos-13
           - jobname: osx-gcc
             cc: gcc
+            cxx: g++
             cc_package: gcc-13
             pool: macos-13
           - jobname: linux-gcc-default
             cc: gcc
+            cxx: g++
             pool: ubuntu-latest
           - jobname: linux-leaks
             cc: gcc
+            cxx: g++
             pool: ubuntu-latest
           - jobname: linux-reftable-leaks
             cc: gcc
+            cxx: g++
             pool: ubuntu-latest
           - jobname: linux-asan-ubsan
             cc: clang
+            cxx: clang++
             pool: ubuntu-latest
     env:
       CC: ${{matrix.vector.cc}}
+      CXX: ${{matrix.vector.cxx}}
       CC_PACKAGE: ${{matrix.vector.cc_package}}
       jobname: ${{matrix.vector.jobname}}
       runs_on_pool: ${{matrix.vector.pool}}