From 37106f20bd5cc016a473fbdb2e9e37da096cff5f Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Sun, 12 Dec 2021 22:03:49 +0100 Subject: [PATCH] oss-fuzz: convert to static cross-build This way we can get rid of the pre-generated locale data and the special fuzzers target, which invokes a full gbuild make for every prereqisite, always parsing the whole tree, taking ages. This also reverts: - commit d0780b21cfe235c4446adf649eb690f9c1771dd5 ("fix oss-fuzz build") by adding epubgen and revenge dependencies. - commit ff25d6a123beb42476bf42d189b3033a86835b2a ("ofz#41602 fix more build failure"), which shouldn't happen anymore since commit d47628f287f4377394c4ff488c433bfe254b6abe ("don't want to link to system static libs for DISABLE_DYNLOADING") Change-Id: I3aed9ec62da507254b42e4e7470bae1097b4bc8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127031 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- Makefile.in | 2 -- bin/oss-fuzz-build.sh | 9 +++++---- configure.ac | 4 ++-- desktop/Module_desktop.mk | 2 ++ distro-configs/LibreOfficeOssFuzz.conf | 2 ++ smoketest/Module_smoketest.mk | 2 ++ vcl/Executable_docxfuzzer.mk | 2 ++ vcl/Executable_fodtfuzzer.mk | 2 ++ vcl/Executable_htmlfuzzer.mk | 4 +++- vcl/Module_vcl.mk | 3 +-- vcl/commonfuzzer.mk | 4 +++- vcl/workben/docxfuzzer.cxx | 5 ----- vcl/workben/fodtfuzzer.cxx | 5 ----- vcl/workben/htmlfuzzer.cxx | 2 -- 14 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Makefile.in b/Makefile.in index 3ac9ce6d3c22..7c30271cffb9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -504,8 +504,6 @@ $(BUILDDIR)/vs-code.code-workspace: $(BUILDDIR)/vs-code.code-workspace.template @test -e $@ || cp $< $@ && \ cmp -s $@ $< || echo "ATTN: $(@F) differs from $( templateservices.rdb diff --git a/configure.ac b/configure.ac index 1ba896d7defb..f85e0b1701f3 100644 --- a/configure.ac +++ b/configure.ac @@ -3799,7 +3799,7 @@ if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then fi -if test "$build_cpu" != "$host_cpu" -o \( "$DISABLE_DYNLOADING" = TRUE -a "$enable_fuzzers" != yes \); then +if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then # To allow building Windows multi-arch releases without cross-tooling if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then cross_compiling="yes" @@ -9574,7 +9574,7 @@ else LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib" else LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2" - if test "$DISABLE_DYNLOADING" = TRUE -a "$ENABLE_FUZZERS" != "TRUE"; then + if test "$DISABLE_DYNLOADING" = TRUE; then LIBXML_LIBS="$LIBXML_LIBS -lm" fi fi diff --git a/desktop/Module_desktop.mk b/desktop/Module_desktop.mk index a03a552e4271..ce8f254d7af1 100644 --- a/desktop/Module_desktop.mk +++ b/desktop/Module_desktop.mk @@ -100,9 +100,11 @@ $(eval $(call gb_Module_add_targets,desktop,\ else ifeq (,$(filter MACOSX ANDROID iOS HAIKU,$(OS))) +ifeq (,$(filter FUZZERS,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,desktop,\ Executable_oosplash \ )) +endif endif diff --git a/distro-configs/LibreOfficeOssFuzz.conf b/distro-configs/LibreOfficeOssFuzz.conf index 434452a673f0..5f50f2774bc5 100644 --- a/distro-configs/LibreOfficeOssFuzz.conf +++ b/distro-configs/LibreOfficeOssFuzz.conf @@ -8,6 +8,7 @@ --disable-cups --disable-dbus --disable-dconf +--disable-extensions --disable-firebird-sdbc --disable-gio --disable-gtk3 @@ -29,5 +30,6 @@ --with-locales=en --with-system-lockfile --without-fonts +--without-galleries --without-java --without-webdav diff --git a/smoketest/Module_smoketest.mk b/smoketest/Module_smoketest.mk index 217dbfa6543a..5d66a0daa1e4 100644 --- a/smoketest/Module_smoketest.mk +++ b/smoketest/Module_smoketest.mk @@ -12,10 +12,12 @@ $(eval $(call gb_Module_Module,smoketest)) ifeq ($(CROSS_COMPILING),) +ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,smoketest,\ Library_smoketest \ Zip_smoketestdoc \ )) +endif ifneq ($(ENABLE_JAVA),) ifneq ($(filter EXTENSIONS,$(BUILD_TYPE)),) diff --git a/vcl/Executable_docxfuzzer.mk b/vcl/Executable_docxfuzzer.mk index fbacbe92fd98..57bc9020713b 100644 --- a/vcl/Executable_docxfuzzer.mk +++ b/vcl/Executable_docxfuzzer.mk @@ -19,6 +19,8 @@ $(eval $(call gb_Executable_use_api,docxfuzzer,\ $(eval $(call gb_Executable_use_externals,docxfuzzer,\ $(fuzzer_externals) \ + epubgen \ + revenge \ )) $(eval $(call gb_Executable_set_include,docxfuzzer,\ diff --git a/vcl/Executable_fodtfuzzer.mk b/vcl/Executable_fodtfuzzer.mk index 94a15362cbd4..f07a002f8fcf 100644 --- a/vcl/Executable_fodtfuzzer.mk +++ b/vcl/Executable_fodtfuzzer.mk @@ -19,6 +19,8 @@ $(eval $(call gb_Executable_use_api,fodtfuzzer,\ $(eval $(call gb_Executable_use_externals,fodtfuzzer,\ $(fuzzer_externals) \ + epubgen \ + revenge \ )) $(eval $(call gb_Executable_set_include,fodtfuzzer,\ diff --git a/vcl/Executable_htmlfuzzer.mk b/vcl/Executable_htmlfuzzer.mk index 33a567a4c417..fc42be8584bc 100644 --- a/vcl/Executable_htmlfuzzer.mk +++ b/vcl/Executable_htmlfuzzer.mk @@ -18,7 +18,9 @@ $(eval $(call gb_Executable_use_api,htmlfuzzer,\ )) $(eval $(call gb_Executable_use_externals,htmlfuzzer,\ - $(fuzzer_externals) \ + $(fuzzer_externals) \ + epubgen \ + revenge \ )) $(eval $(call gb_Executable_set_include,htmlfuzzer,\ diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 879bfd5afa05..b1cfb2c5b2cd 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -29,7 +29,7 @@ $(eval $(call gb_Module_add_targets,vcl,\ Package_opengl_denylist ) \ $(if $(filter SKIA,$(BUILD_TYPE)), \ Package_skia_denylist ) \ - $(if $(filter DESKTOP,$(BUILD_TYPE)), \ + $(if $(filter DESKTOP FUZZERS,$(BUILD_TYPE)), \ StaticLibrary_vclmain \ $(if $(DISABLE_GUI),, \ $(if $(filter LINUX MACOSX SOLARIS WNT %BSD,$(OS)), \ @@ -151,7 +151,6 @@ $(eval $(call gb_Module_add_targets,vcl,\ CustomTarget_nativedraw \ CustomTarget_nativewriter \ CustomTarget_nativemath \ - StaticLibrary_fuzzerstubs \ StaticLibrary_fuzzer_core \ StaticLibrary_fuzzer_calc \ StaticLibrary_fuzzer_draw \ diff --git a/vcl/commonfuzzer.mk b/vcl/commonfuzzer.mk index 968bb6e8eb75..07f5c4c47591 100644 --- a/vcl/commonfuzzer.mk +++ b/vcl/commonfuzzer.mk @@ -44,7 +44,6 @@ fuzzer_externals = \ fuzzer_statics = \ findsofficepath \ - fuzzerstubs \ ulingu \ fuzzer_core_libraries = \ @@ -150,6 +149,9 @@ fuzzer_core_libraries = \ gcc3_uno \ salhelper \ sal \ + index_data \ + localedata_en \ + localedata_others \ fuzzer_calc_libraries = \ analysis \ diff --git a/vcl/workben/docxfuzzer.cxx b/vcl/workben/docxfuzzer.cxx index 4e116c6002cf..73fc198bd886 100644 --- a/vcl/workben/docxfuzzer.cxx +++ b/vcl/workben/docxfuzzer.cxx @@ -16,11 +16,6 @@ extern "C" void* SwCreateDialogFactory() return nullptr; } -extern "C" void* com_sun_star_comp_Writer_EPUBExportFilter_get_implementation() -{ - return nullptr; -} - extern "C" bool TestImportDOCX(SvStream &rStream); extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) diff --git a/vcl/workben/fodtfuzzer.cxx b/vcl/workben/fodtfuzzer.cxx index 54ae26622b7b..71c37aa7c42d 100644 --- a/vcl/workben/fodtfuzzer.cxx +++ b/vcl/workben/fodtfuzzer.cxx @@ -16,11 +16,6 @@ extern "C" void* SwCreateDialogFactory() return nullptr; } -extern "C" void* com_sun_star_comp_Writer_EPUBExportFilter_get_implementation() -{ - return nullptr; -} - extern "C" bool TestImportFODT(SvStream &rStream); extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv) diff --git a/vcl/workben/htmlfuzzer.cxx b/vcl/workben/htmlfuzzer.cxx index 6da6c853f3bb..b2e89442088b 100644 --- a/vcl/workben/htmlfuzzer.cxx +++ b/vcl/workben/htmlfuzzer.cxx @@ -13,8 +13,6 @@ extern "C" void* SwCreateDialogFactory() { return nullptr; } -extern "C" void* com_sun_star_comp_Writer_EPUBExportFilter_get_implementation() { return nullptr; } - extern "C" bool TestImportHTML(SvStream& rStream); extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)