From ac4a51615219e0f91799a1580d8da1e1f059bcd0 Mon Sep 17 00:00:00 2001 From: Nikita Mikhaylov Date: Mon, 23 Aug 2021 21:45:48 +0000 Subject: [PATCH] Fix build --- docker/packager/binary/build.sh | 47 +++++++++++++++++++-------------- docker/packager/packager | 4 --- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/docker/packager/binary/build.sh b/docker/packager/binary/build.sh index 99655450946..9a77d3b2fe3 100755 --- a/docker/packager/binary/build.sh +++ b/docker/packager/binary/build.sh @@ -35,26 +35,6 @@ ninja $NINJA_FLAGS clickhouse-bundle ccache --show-config ||: ccache --show-stats ||: - # Also build fuzzers if any -if [ -n "$FUZZER" ] -then - FUZZER_TARGETS=$(find ../src -name '*_fuzzer.cpp' -execdir basename {} .cpp ';' | tr '\n' ' ') - - mkdir -p /output/fuzzers - for FUZZER_TARGET in $FUZZER_TARGETS - do - # shellcheck disable=SC2086 # No quotes because I want it to expand to nothing if empty. - ninja $NINJA_FLAGS $FUZZER_TARGET - # Find this binary in build directory and strip it - FUZZER_PATH=$(find ./src -name "$FUZZER_TARGET") - strip --strip-unneeded "$FUZZER_PATH" - mv "$FUZZER_PATH" /output/fuzzers - done - - tar -zcvf /output/fuzzers.tar.gz /output/fuzzers - rm -rf /output/fuzzers -fi - mv ./programs/clickhouse* /output mv ./src/unit_tests_dbms /output ||: # may not exist for some binary builds find . -name '*.so' -print -exec mv '{}' /output \; @@ -115,3 +95,30 @@ then # files in place, and will fail because this directory is not writable. tar -cv -I pixz -f /output/ccache.log.txz "$CCACHE_LOGFILE" fi + +# Also build fuzzers if any sanitizer specified +if [ -n "$SANITIZER" ] +then + # Delete previous cache, because we add a new flag -DENABLE_FUZZING=1 + rm -rf CMakeCache.txt CMakeFiles/ + + # Hope, that the most part of files will be in cache, so we just link new executables + cmake --debug-trycompile --verbose=1 -DCMAKE_VERBOSE_MAKEFILE=1 -LA "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" \ + "-DSANITIZE=$SANITIZER" -DENABLE_FUZZING=1 -DENABLE_CHECK_HEAVY_BUILDS=1 "${CMAKE_FLAGS[@]}" .. + + FUZZER_TARGETS=$(find ../src -name '*_fuzzer.cpp' -execdir basename {} .cpp ';' | tr '\n' ' ') + + mkdir -p /output/fuzzers + for FUZZER_TARGET in $FUZZER_TARGETS + do + # shellcheck disable=SC2086 # No quotes because I want it to expand to nothing if empty. + ninja $NINJA_FLAGS $FUZZER_TARGET + # Find this binary in build directory and strip it + FUZZER_PATH=$(find ./src -name "$FUZZER_TARGET") + strip --strip-unneeded "$FUZZER_PATH" + mv "$FUZZER_PATH" /output/fuzzers + done + + tar -zcvf /output/fuzzers.tar.gz /output/fuzzers + rm -rf /output/fuzzers +fi diff --git a/docker/packager/packager b/docker/packager/packager index 50bb4d8e23b..95b7fcd8568 100755 --- a/docker/packager/packager +++ b/docker/packager/packager @@ -120,10 +120,6 @@ def parse_env_variables(build_type, compiler, sanitizer, package_type, image_typ if sanitizer: result.append("SANITIZER={}".format(sanitizer)) - # Build fuzzers only with sanitizers - # This is needed to check necessity particularly in build script - result.append("FUZZER=TRUE") - cmake_flags.append('-DENABLE_FUZZING=1') if build_type: result.append("BUILD_TYPE={}".format(build_type))