From 97db7e9c5d7ca1ef0531d723897b6b425edf5b46 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Thu, 3 May 2018 09:49:52 +1000 Subject: [PATCH] Build projects/wuffs as C, not C++ (#1397) The upstream Wuffs project is C, not C++. Having OSS-Fuzz compile Wuffs as plain C, the way Wuffs' own build system does, should hopefully lessen OSS-Fuzz build breakages such as issue #1373 --- projects/wuffs/build.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/projects/wuffs/build.sh b/projects/wuffs/build.sh index ddc856f6d..6bcee64e8 100755 --- a/projects/wuffs/build.sh +++ b/projects/wuffs/build.sh @@ -19,13 +19,15 @@ # Wuffs' generated C files are "drop-in libraries" a la # http://gpfault.net/posts/drop-in-libraries.txt.html -for f in fuzz/c/std/*_fuzzer.cc; do - # Extract the format name, such as "gzip", from the C++ file name, - # "fuzz/c/std/gzip_fuzzer.cc". - b=$(basename $f _fuzzer.cc) +for f in fuzz/c/std/*_fuzzer.c; do + # Extract the format name, such as "gzip", from the C file name, + # "fuzz/c/std/gzip_fuzzer.c". + b=$(basename $f _fuzzer.c) - # Make the "gzip_fuzzer" binary. - $CXX $CXXFLAGS -std=c++11 $f -o $OUT/${b}_fuzzer -lFuzzingEngine + # Make the "gzip_fuzzer" binary. First compile the (C) Wuffs code, then link + # the (C++) fuzzing library. + $CC $CFLAGS -c -std=c99 $f -o $WORK/${b}_fuzzer.o + $CXX $CXXFLAGS $WORK/${b}_fuzzer.o -o $OUT/${b}_fuzzer -lFuzzingEngine # Make the optional "gzip_fuzzer_seed_corpus.zip" archive. This means # extracting the "foo/bar/*.gz" out of the matching "gzip: foo/bar/*.gz"