diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-10-22 18:11:59 +0200 |
---|---|---|
committer | Max Moroz <dor3s1@gmail.com> | 2018-10-22 09:11:59 -0700 |
commit | f2b4a02601d7439e3546e5ce9655d5c581f35f4f (patch) | |
tree | 09ec6e6e70ca9f7ff294a95c972651a26f2f73db /projects/wireshark | |
parent | 82ba771507a3d98ed56e343af5d188b9f5365eaa (diff) | |
download | oss-fuzz-f2b4a02601d7439e3546e5ce9655d5c581f35f4f.tar.gz |
[wireshark] fix build, simplify build configuration (#1895)
Since Wireshark v2.9.0rc0-2266-g7e88bb5e53, building fuzzing binaries is
better integrated in the Wireshark build system. While that change was
supposed to be backwards compatible, unfortunately the resulting fuzzer
binaries are dynamically linked due to how cmake caches library paths.
The very first cmake invocation must be invoked with -DOSS_FUZZ=ON.
Changes:
- Use ninja for better control of parallel linker jobs.
- Installing files (make install) is no longer needed.
- Avoid setting a long list of cmake options (BUILD_xxx=OFF).
- Remove fortify comment, it does not belong here.
- Remove lemon workaround, it is fixed since v2.9.0rc0-2273-gbb2caa2a9f.
Diffstat (limited to 'projects/wireshark')
-rw-r--r-- | projects/wireshark/Dockerfile | 2 | ||||
-rwxr-xr-x | projects/wireshark/build.sh | 34 |
2 files changed, 10 insertions, 26 deletions
diff --git a/projects/wireshark/Dockerfile b/projects/wireshark/Dockerfile index 1ba0ef849..d698db307 100644 --- a/projects/wireshark/Dockerfile +++ b/projects/wireshark/Dockerfile @@ -17,7 +17,7 @@ FROM gcr.io/oss-fuzz-base/base-builder MAINTAINER Jakub Zawadzki <darkjames-ws@darkjames.pl> -RUN apt-get update && apt-get install -y make cmake \ +RUN apt-get update && apt-get install -y ninja-build cmake \ flex bison \ libglib2.0-dev libgcrypt20-dev diff --git a/projects/wireshark/build.sh b/projects/wireshark/build.sh index 0a56a3af7..bdb34eb52 100755 --- a/projects/wireshark/build.sh +++ b/projects/wireshark/build.sh @@ -18,47 +18,31 @@ WIRESHARK_BUILD_PATH="$WORK/build" mkdir -p "$WIRESHARK_BUILD_PATH" -export WIRESHARK_INSTALL_PATH="$WORK/install" -mkdir -p "$WIRESHARK_INSTALL_PATH" - # Prepare Samples directory export SAMPLES_DIR="$WORK/samples" mkdir -p "$SAMPLES_DIR" cp -a $SRC/wireshark-fuzzdb/samples/* "$SAMPLES_DIR" # compile static version of libs -# XXX, with static wireshark linking each fuzzer binary is ~338 MB (just libwireshark.a is 623 MBs). +# XXX, with static wireshark linking each fuzzer binary is ~346 MB (just libwireshark.a is 761 MB). # XXX, wireshark is not ready for including static plugins into binaries. CMAKE_DEFINES="-DENABLE_STATIC=ON -DENABLE_PLUGINS=OFF" # disable optional dependencies CMAKE_DEFINES="$CMAKE_DEFINES -DENABLE_PCAP=OFF -DENABLE_GNUTLS=OFF" -# need only libs, disable programs -# TODO, add something like --without-extcap, which would disable all extcap binaries -CMAKE_DEFINES="$CMAKE_DEFINES -DBUILD_wireshark=OFF -DBUILD_tshark=OFF -DBUILD_sharkd=OFF \ - -DBUILD_dumpcap=OFF -DBUILD_capinfos=OFF -DBUILD_captype=OFF -DBUILD_randpkt=OFF -DBUILD_dftest=OFF \ - -DBUILD_editcap=OFF -DBUILD_mergecap=OFF -DBUILD_reordercap=OFF -DBUILD_text2pcap=OFF \ - -DBUILD_fuzzshark=OFF \ - -DBUILD_androiddump=OFF -DBUILD_randpktdump=OFF -DBUILD_udpdump=OFF \ - " - -# Fortify and asan don't like each other ... :( -# TODO, right now -D_FORTIFY_SOURCE=2 is not added in cmake builds. -# sed -i '/AC_WIRESHARK_GCC_FORTIFY_SOURCE_CHECK/d' configure.ac +# There is no need to manually disable programs via BUILD_xxx=OFF since the +# all-fuzzers targets builds the minimum required binaries. However we do have +# to disable the Qt GUI or else the cmake step will fail. +CMAKE_DEFINES="$CMAKE_DEFINES -DBUILD_wireshark=OFF" cd "$WIRESHARK_BUILD_PATH" -cmake -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ +cmake -GNinja \ + -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \ -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ - -DCMAKE_INSTALL_PREFIX="$WIRESHARK_INSTALL_PATH" $CMAKE_DEFINES -DDISABLE_WERROR=ON $SRC/wireshark/ - -# disable leak checks, lemon is build with ASAN, and it leaks memory during building. -export ASAN_OPTIONS="detect_leaks=0" -make "-j$(nproc)" -make install + -DDISABLE_WERROR=ON -DOSS_FUZZ=ON $CMAKE_DEFINES $SRC/wireshark/ -# make install didn't install config.h, install it manually -cp "$WIRESHARK_BUILD_PATH/config.h" "$WIRESHARK_INSTALL_PATH/include/wireshark/" +ninja all-fuzzers $SRC/wireshark/tools/oss-fuzzshark/build.sh all |