Re: build of libharfbuzz0-shlibs-2.6.8-2 failed

[email protected] Mon, 07 Oct 2024 19:01:29 -0500
Newsgroups gmane.os.apple.fink.general
Message-ID <[email protected]>
On 2024-10-06 12:48, Eduard Karel de Jong wrote:
> L:.S.
> 
> The compiler chokes on some type casts.
> 
> hb-ft.cc:758:73: error: cast from 'void (*)(FT_Face)' (aka 'void
> (*)(FT_FaceRec_ *)') to 'FT_Generic_Finalizer' (aka 'void (*)(void
> *)') converts to incompatible function type
> [-Werror,-Wcast-function-type-strict]
>   758 |   if (unlikely (!ft_face->generic.data ||
> ft_face->generic.finalizer != (FT_Generic_Finalizer)
> hb_ft_face_finalize))
>       |
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ./hb.hh:225:46: note: expanded from macro 'unlikely'
>   225 | #define unlikely(expr) (__builtin_expect (!!(expr), 0))
>       |                                              ^~~~
> hb-ft.cc:764:34: error: cast from 'void (*)(FT_Face)' (aka 'void
> (*)(FT_FaceRec_ *)') to 'FT_Generic_Finalizer' (aka 'void (*)(void
> *)') converts to incompatible function type
> [-Werror,-Wcast-function-type-strict]
>   764 |     ft_face->generic.finalizer = (FT_Generic_Finalizer)
> hb_ft_face_finalize;
>       |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> hb-ft.cc:1033:32: error: cast from 'void (*)(FT_Face)' (aka 'void
> (*)(FT_FaceRec_ *)') to 'FT_Generic_Finalizer' (aka 'void (*)(void
> *)') converts to incompatible function type
> [-Werror,-Wcast-function-type-strict]
>  1033 |   ft_face->generic.finalizer = (FT_Generic_Finalizer)
> _release_blob;
>       |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> System info
> Package manager version: 0.45.99.git
> Distribution version: selfupdate-rsync Sun Oct  6 09:30:27 2024, 13.0,
> x86_64
> Trees: local/main stable/main
> No recognized Xcode.app installed
> Xcode command-line tools: 16.0.0.0.1.1724870825
> Max. Fink build jobs:  12

I'm unable to test this on any of my systems (none are new enough to 
recognize the -Wcast-function-type-strict flag). However, upstream has 
some changes around that section of their code that might fix something, 
but it's hard to tell.

Also, is that the extent of the error messages for hb-ft.cc ? Please 
also include the full compiler command in the future.

I've attached a .info and .patch file with perhaps a fix. Save them to 
/opt/sw/fink/dists/local/main/finkfinfo and try rebuilding 
libharfbuzz0-shlibs

Hanspeter

_______________________________________________
Fink-users mailing list
[email protected]
List archive:
https://sourceforge.net/p/fink/mailman/fink-users/
Subscription management:
https://lists.sourceforge.net/lists/listinfo/fink-users
libharfbuzz0-shlibs.info (text/plain, 2.8 KB)
Package: libharfbuzz0-shlibs
# 2.7.x needs g_unicode_script_to_iso15924 NEWGLIB24
Version: 2.6.8
Revision: 2.1
Description: Text shaping engine/library
License: BSD
# Free to change, update, and take over
Maintainer: Hanspeter Niederstrasser <[email protected]>
Depends: <<
	freetype219-shlibs,
	glib2-shlibs,
	libgettext8-shlibs,
	libgraphite2-shlibs,
	libicu72-shlibs
<<
BuildDepends: <<
	fink (>= 0.32),
	cairo,
	fontconfig2-dev,
	freetype219,
	glib2-dev,
	libgraphite2-dev,
	libicu72-dev,
	ppkg-config
<<
GCC: 4.0
Source: https://github.com/harfbuzz/harfbuzz/releases/download/%v/harfbuzz-%v.tar.xz
Source-Checksum: SHA256(6648a571a27f186e47094121f0095e1b809e918b3037c630c7f38ffad86e3035)
PatchFile: %n.patch
PatchFile-MD5: c3fedb8f4c11630a9defcdee9e97e291
PatchScript: <<
	%{default_script}
	# cleanup -framework flags
	perl -pi -e 's/(-framework)\s+(\S+)/-Wl,\1,\2/g' configure
<<
ConfigureParams: <<
	--disable-static \
	--enable-dependency-tracking \
	--disable-silent-rules \
	--with-graphite2 \
	--with-coretext=yes \
	--enable-introspection=no \
	--with-gobject=no \
	PKG_CONFIG_PATH="%p/lib/glib-2.0/pkgconfig-strict:$PKG_CONFIG_PATH" \
	PKG_CONFIG="%p/bin/ppkg-config"
<<
CompileScript: <<
	%{default_script}
	fink-package-precedence --prohibit-bdep=libharfbuzz0-dev .
<<
# tests expect a python3 executable
#InfoTest: <<
#	TestScript: <<
#		make check || exit 2
#	<<
#<<
InstallScript: <<
	make install DESTDIR=%d
	# clean up docs, but don't rebuild, just patch URL
	perl -pi -e 's|/usr/share/gtk-doc|%p/share/gtk-doc|g' %i/share/gtk-doc/html/harfbuzz/*.html 
<<
DocFiles: COPYING
Shlibs: <<
	%p/lib/libharfbuzz.0.dylib 20601.0.0 %n (>= 2.6.8-1)
	%p/lib/libharfbuzz-icu.0.dylib 20601.0.0 %n (>= 2.6.8-1)
	%p/lib/libharfbuzz-subset.0.dylib 20601.0.0 %n (>= 2.6.8-1)
<<
SplitOff: <<
	Package: libharfbuzz0-dev
	Description: Text shaping engine/library (dev pkg)
	Files: <<
		include
		lib/cmake
		lib/pkgconfig
		lib/libharfbuzz.{dylib,la}
		lib/libharfbuzz-icu.{dylib,la}
		lib/libharfbuzz-subset.{dylib,la}
		share/gtk-doc
	<<
	Depends: %N (= %v-%r)
	Conflicts: libharfbuzz0-dev
	Replaces: libharfbuzz0-dev
	BuildDependsOnly: true
	DocFiles: AUTHORS COPYING NEWS README.md
<<
SplitOff2: <<
	Package: libharfbuzz-bin
	Description: Text shaping engine binaries
	Files: <<
		bin
	<<
	Depends: <<
		%N (>= %v-%r),
		cairo-shlibs,
		freetype219-shlibs,
		glib2-shlibs,
		libgettext8-shlibs,
		libgraphite2-shlibs
	<<
	DocFiles: AUTHORS COPYING NEWS README.md
<<
Homepage: https://github.com/harfbuzz/harfbuzz
DescDetail: <<
HarfBuzz is a text shaping engine. It primarily supports OpenType, but
also Apple Advanced Typography.
<<
DescPort: <<
* Remove unused supp_size
https://github.com/harfbuzz/harfbuzz/pull/2995
* Fix for cast-function-type-strict errors in hb.hh
  commits db730f46d093b69667ad430785ca50fc32f2172c 7e7f1d0414c9128ce2e09659711f45e6b0f74c39
<<
libharfbuzz0-shlibs.patch (text/x-diff, 1.5 KB)
diff -ruN harfbuzz-2.7.0-orig/src/hb-subset-cff1.cc harfbuzz-2.7.0/src/hb-subset-cff1.cc
--- harfbuzz-2.7.0-orig/src/hb-subset-cff1.cc	2020-07-25 03:10:57.000000000 -0500
+++ harfbuzz-2.7.0/src/hb-subset-cff1.cc	2023-01-16 05:04:07.000000000 -0600
@@ -402,12 +402,11 @@
   void plan_subset_encoding (const OT::cff1::accelerator_subset_t &acc, hb_subset_plan_t *plan)
   {
     const Encoding *encoding = acc.encoding;
-    unsigned int  size0, size1, supp_size;
+    unsigned int  size0, size1;
     hb_codepoint_t  code, last_code = CFF_UNDEF_CODE;
     hb_vector_t<hb_codepoint_t> supp_codes;
 
     subset_enc_code_ranges.resize (0);
-    supp_size = 0;
     supp_codes.init ();
 
     subset_enc_num_codes = plan->num_output_glyphs () - 1;
@@ -443,7 +442,6 @@
 	  code_pair_t pair = { supp_codes[i], sid };
 	  subset_enc_supp_codes.push (pair);
 	}
-	supp_size += SuppEncoding::static_size * supp_codes.length;
       }
     }
     supp_codes.fini ();
diff -ruN harfbuzz-2.6.8-orig/src/hb.hh harfbuzz-2.6.8/src/hb.hh
--- harfbuzz-2.6.8-orig/src/hb.hh	2020-06-15 20:14:32
+++ harfbuzz-2.6.8/src/hb.hh	2024-10-07 18:47:10
@@ -221,8 +221,8 @@
  */
 
 #if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
-#define likely(expr) (__builtin_expect (!!(expr), 1))
-#define unlikely(expr) (__builtin_expect (!!(expr), 0))
+#define likely(expr) __builtin_expect (bool(expr), 1)
+#define unlikely(expr) __builtin_expect (bool(expr), 0)
 #else
 #define likely(expr) (expr)
 #define unlikely(expr) (expr)