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

Hanspeter Niederstrasser <[email protected]> Wed, 9 Oct 2024 04:04:45 -0500
Newsgroups gmane.os.apple.fink.general
Organization Snaggled Works
Message-ID <[email protected]>
On 10/8/24 3:17 PM, Derek Homeier wrote:
> On 8 Oct 2024, at 2:01 AM, [email protected] wrote:
>>
>> 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.
>>
> Changing the `unlikely` macro does not fix it; the other two assignments to FT_Generic_Finalizer
> throwing an error are unrelated to that anyway.
> 
> Below is the full command and output (14.0, Xcode.app: 16.0, command-line tools: 16.0.0.0.1.1724870825)
> 
> 					Derek
> 
> 
> /bin/sh ../libtool  --tag=CXX   --mode=compile g++ -std=gnu++11 -DHAVE_CONFIG_H -I. -I..  -pthread -I/opt/sw3/include/glib-2.0 ->
> Password:
> libtool: compile:  g++ -std=gnu++11 -DHAVE_CONFIG_H -I. -I.. -pthread -I/opt/sw3/include/glib-2.0 -I/opt/sw3/lib/glib-2.0/include -I/opt/sw3/include/freetype2 -I/opt/sw3/include -I/opt/sw3/include -fno-rtti -g -O2 -fno-exceptions -fno-threadsafe-statics -fvisibility-inlines-hidden -MT libharfbuzz_la-hb-ft.lo -MD -MP -MF .deps/libharfbuzz_la-hb-ft.Tpo -c hb-ft.cc  -fno-common -DPIC -o .libs/libharfbuzz_la-hb-ft.o
> 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:47: note: expanded from macro 'unlikely'
>    225 | #define unlikely(expr) __builtin_expect (bool(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;
>        |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 3 errors generated.

Thanks. Can you check with the new attached files? I found the upstream 
commit that directly references the above errors.

Hanspeter

-- 
Drag image to the desktop
Right click, tap spacebar, use menu
Disable JavaScript
File > Save As (then pick the option to save with images)
Look in the browser cache
Use a browser other then IE
Take a screenshot
Use the toolbar that pops up in IE6 when you hover the mouse over an image
Click the EDIT item in the main toolbar and then grab the image from Word

_______________________________________________
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.patch (text/plain, 3.2 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 ();
From d88269c827895b38f99f7cf741fa60210d4d5169 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]>
Date: Fri, 28 Oct 2022 22:17:15 +0300
Subject: [PATCH] freetype: Fix function signatures to match without casts

Clang 16 has got a new stricter warning for casts of function types
(see https://github.com/llvm/llvm-project/commit/1aad641c793090b4d036c03e737df2ebe2c32c57).

This new warning gets included as part of the existing error
diagnostic setting of -Wcast-function-type.

This fixes errors like these:

../src/hb-ft.cc:1011: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]
    ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
 src/hb-ft.cc | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index bcc1dd080f5..1626b9a1500 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -975,8 +979,9 @@ hb_ft_face_create_referenced (FT_Face ft_face)
 }
 
 static void
-hb_ft_face_finalize (FT_Face ft_face)
+hb_ft_face_finalize (void *arg)
 {
+  FT_Face ft_face = (FT_Face) arg;
   hb_face_destroy ((hb_face_t *) ft_face->generic.data);
 }
 
@@ -1008,7 +1013,7 @@ hb_ft_face_create_cached (FT_Face ft_face)
       ft_face->generic.finalizer (ft_face);
 
     ft_face->generic.data = hb_ft_face_create (ft_face, nullptr);
-    ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
+    ft_face->generic.finalizer = hb_ft_face_finalize;
   }
 
   return hb_face_reference ((hb_face_t *) ft_face->generic.data);
@@ -1217,8 +1222,9 @@ get_ft_library ()
 }
 
 static void
-_release_blob (FT_Face ft_face)
+_release_blob (void *arg)
 {
+  FT_Face ft_face = (FT_Face) arg;
   hb_blob_destroy ((hb_blob_t *) ft_face->generic.data);
 }
 
@@ -1271,7 +1277,7 @@ hb_ft_font_set_funcs (hb_font_t *font)
 
 
   ft_face->generic.data = blob;
-  ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob;
+  ft_face->generic.finalizer = _release_blob;
 
   _hb_ft_font_set_funcs (font, ft_face, true);
   hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING);
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.2
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: 5d239363c4cb854db470603ea20f610a
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
* Use relevant/matching part of upstream d88269c827895b38f99f7cf741fa60210d4d5169 to fix -Wcast-function-type-strict that are fatal with Xcode16
<<