From 01f805701a468fb24051af8f51e78119c487bc04 Mon Sep 17 00:00:00 2001 From: Jonathan Metzman Date: Thu, 15 May 2025 19:13:43 -0400 Subject: [PATCH 1/2] Temporary fix for imagemagick and xpdf: harfbuzz dynamic loading freetype recently added support for dynamic loading of harfbuzz https://github.com/freetype/freetype/commit/7651fe00befc98c7b1ffb364abdc212282704f83 This has broken a few projects. Rather than disable as ffmpeg did, fix compilation of this feature. https://github.com/google/oss-fuzz/commit/41910ee50209675c9495b1663f61db2e0d29cdf6 --- projects/imagemagick/build.sh | 1 + projects/xpdf/build.sh | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/projects/imagemagick/build.sh b/projects/imagemagick/build.sh index 73711f208991..7832c84db1f6 100755 --- a/projects/imagemagick/build.sh +++ b/projects/imagemagick/build.sh @@ -14,4 +14,5 @@ # ################################################################################ +export CFLAGS="$CFLAGS -D_GNU_SOURCE" . oss-fuzz/build.sh diff --git a/projects/xpdf/build.sh b/projects/xpdf/build.sh index 6b6932c3f486..47be6f167b0d 100755 --- a/projects/xpdf/build.sh +++ b/projects/xpdf/build.sh @@ -27,10 +27,10 @@ export PKG_CONFIG="`which pkg-config` --static" export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig export PATH=$PREFIX/bin:$PATH pushd $SRC/freetype -./autogen.sh -./configure --prefix="$PREFIX" --disable-shared PKG_CONFIG_PATH="$PKG_CONFIG_PATH" --with-png=no --with-zlib=no -make -j$(nproc) -make install +CFLAGS="$CFLAGS -D_GNU_SOURCE" ./autogen.sh +CFLAGS="$CFLAGS -D_GNU_SOURCE" ./configure --prefix="$PREFIX" --disable-shared PKG_CONFIG_PATH="$PKG_CONFIG_PATH" --with-png=no --with-zlib=no +CFLAGS="$CFLAGS -D_GNU_SOURCE" make -j$(nproc) +CFLAGS="$CFLAGS -D_GNU_SOURCE" make install popd # Make minor change in the CMakeFiles file. From 4e7580abcda0ad19995b77406a04b88c60c82cb2 Mon Sep 17 00:00:00 2001 From: Jonathan Metzman Date: Thu, 15 May 2025 20:38:16 -0400 Subject: [PATCH 2/2] Comment --- projects/imagemagick/build.sh | 5 +++++ projects/xpdf/build.sh | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/projects/imagemagick/build.sh b/projects/imagemagick/build.sh index 7832c84db1f6..40795d521a13 100755 --- a/projects/imagemagick/build.sh +++ b/projects/imagemagick/build.sh @@ -14,5 +14,10 @@ # ################################################################################ +# Temporarily Add -D_GNU_SOURCE to CFLAGS to fix freetype's dependence on GNU +# extensions for dlsym to dynamically load harfbuzz. This feature +# should potentially be disabled instead of fixing the compilation. But that is +# not possible to do from the OSS-Fuzz repo :-) +# See https://github.com/google/oss-fuzz/pull/13325 for more details. export CFLAGS="$CFLAGS -D_GNU_SOURCE" . oss-fuzz/build.sh diff --git a/projects/xpdf/build.sh b/projects/xpdf/build.sh index 47be6f167b0d..c658c52e5344 100755 --- a/projects/xpdf/build.sh +++ b/projects/xpdf/build.sh @@ -27,6 +27,10 @@ export PKG_CONFIG="`which pkg-config` --static" export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig export PATH=$PREFIX/bin:$PATH pushd $SRC/freetype +# Temporarily Add -D_GNU_SOURCE to CFLAGS to fix freetype's dependence on GNU +# extensions for dlsym to dynamically load harfbuzz. This feature +# should potentially be disabled instead of fixing the compilation. +# See https://github.com/google/oss-fuzz/pull/13325 for more details. CFLAGS="$CFLAGS -D_GNU_SOURCE" ./autogen.sh CFLAGS="$CFLAGS -D_GNU_SOURCE" ./configure --prefix="$PREFIX" --disable-shared PKG_CONFIG_PATH="$PKG_CONFIG_PATH" --with-png=no --with-zlib=no CFLAGS="$CFLAGS -D_GNU_SOURCE" make -j$(nproc)