Created attachment 19945 [details] build.log Build fails with freetype-2.10.3. Downgrading to freetype-2.10.2 "fixes" the issue. Dunno if this is a bug in latest freetype release or if ghostscript need adjustment. See also Gentoo downstream bug report: https://bugs.gentoo.org/747808 Error messages during build: x86_64-pc-linux-gnu-gcc -DHAVE_MKSTEMP -DHAVE_FILE64 -DHAVE_FSEEKO -DHAVE_MKSTEMP64 -DHAVE_FONTCONFIG -DHAVE_LIBIDN -DHAVE_SETLOCALE -DHAVE_SSE2 -DHAVE_DBUS -DHAVE_BSWAP32 -DHAVE_BYTESWAP_H -DHAVE_STRERROR -DHAVE_ISNAN -DHAVE_ISINF -DHAVE_PREAD_PWRITE=1 -DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE -fPIC -O2 -DNDEBUG -fPIC \ -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -march=native -mtune=native -O2 -pipe -DHAVE_RESTRICT=1 -DUSE_LIBPAPER -fno-strict-aliasing -DHAVE_POPEN_PROTO=1 -DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\"/usr/lib64/ghostscript/9.53.3\" -I./soobj -I./base -I./devices -DWHICH_CMS="lcms2" -o ./soobj/gxfapi.o -c ./base/gxfapi.c ./soobj/aux/echogs -e .dev -w- -l-obj ./soobj/fapiu x86_64-pc-linux-gnu-gcc -DHAVE_MKSTEMP -DHAVE_FILE64 -DHAVE_FSEEKO -DHAVE_MKSTEMP64 -DHAVE_FONTCONFIG -DHAVE_LIBIDN -DHAVE_SETLOCALE -DHAVE_SSE2 -DHAVE_DBUS -DHAVE_BSWAP32 -DHAVE_BYTESWAP_H -DHAVE_STRERROR -DHAVE_ISNAN -DHAVE_ISINF -DHAVE_PREAD_PWRITE=1 -DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE -fPIC -O2 -DNDEBUG -fPIC \ -Wall -Wstrict-prototypes -Wundef -Wmissing-declarations -Wmissing-prototypes -Wwrite-strings -fno-strict-aliasing -Werror=declaration-after-statement -fno-builtin -fno-common -Werror=return-type -DHAVE_STDINT_H=1 -DHAVE_DIRENT_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_TIMES_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_LIBDL=1 -DGX_COLOR_INDEX_TYPE="unsigned long long" -D__USE_UNIX98=1 -march=native -mtune=native -O2 -pipe -DHAVE_RESTRICT=1 -DUSE_LIBPAPER -fno-strict-aliasing -DHAVE_POPEN_PROTO=1 -DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\"/usr/lib64/ghostscript/9.53.3\" -I./soobj -I./base -I./devices -DWHICH_CMS="lcms2" -march=native -mtune=native -O2 -pipe -DHAVE_RESTRICT=1 -DUSE_LIBPAPER -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DSHARE_FT=1 -o ./soobj/fapi_ft_1.o -c ./base/fapi_ft.c ./base/fapi_ft.c:128:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 128 | FT_CALLBACK_DEF(void *) | ^~~~~~~~~~~~~~~ ./base/fapi_ft.c:128:1: warning: no previous prototype for ‘FT_CALLBACK_DEF’ [-Wmissing-prototypes] ./base/fapi_ft.c: In function ‘FT_CALLBACK_DEF’: ./base/fapi_ft.c:129:1: error: expected declaration specifiers before ‘FF_alloc’ 129 | FF_alloc(FT_Memory memory, long size) | ^~~~~~~~ ./base/fapi_ft.c:136:1: error: expected declaration specifiers before ‘FT_CALLBACK_DEF’ 136 | FT_CALLBACK_DEF(void *) | ^~~~~~~~~~~~~~~ ./base/fapi_ft.c:156:1: error: expected declaration specifiers before ‘FT_CALLBACK_DEF’ 156 | FT_CALLBACK_DEF(void) | ^~~~~~~~~~~~~~~ ./base/fapi_ft.c:172:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 172 | { | ^ ./base/fapi_ft.c:191:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 191 | { | ^ ./base/fapi_ft.c:197:19: error: storage class specified for parameter ‘file_default_buffer_size’ 197 | extern const uint file_default_buffer_size; | ^~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:201:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 201 | { | ^ ./base/fapi_ft.c:279:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 279 | { | ^ ./base/fapi_ft.c:298:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 298 | { | ^ ./base/fapi_ft.c:326:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 326 | { | ^ ./base/fapi_ft.c:346:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 346 | { | ^ ./base/fapi_ft.c:357:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 357 | { | ^ ./base/fapi_ft.c:445:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 445 | { | ^ ./base/fapi_ft.c:460:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 460 | { | ^ ./base/fapi_ft.c:489:38: error: storage class specified for parameter ‘TheFAPIIncrementalInterfaceFuncs’ 489 | static const FT_Incremental_FuncsRec TheFAPIIncrementalInterfaceFuncs = { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:489:1: error: parameter ‘TheFAPIIncrementalInterfaceFuncs’ is initialized 489 | static const FT_Incremental_FuncsRec TheFAPIIncrementalInterfaceFuncs = { | ^~~~~~ ./base/fapi_ft.c:490:5: error: ‘get_fapi_glyph_data’ undeclared (first use in this function); did you mean ‘st_glyph_data’? 490 | get_fapi_glyph_data, | ^~~~~~~~~~~~~~~~~~~ | st_glyph_data ./base/fapi_ft.c:490:5: note: each undeclared identifier is reported only once for each function it appears in ./base/fapi_ft.c:491:5: error: ‘free_fapi_glyph_data’ undeclared (first use in this function) 491 | free_fapi_glyph_data, | ^~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:492:5: error: ‘get_fapi_glyph_metrics’ undeclared (first use in this function); did you mean ‘gs_fapi_glyph_error’? 492 | get_fapi_glyph_metrics | ^~~~~~~~~~~~~~~~~~~~~~ | gs_fapi_glyph_error ./base/fapi_ft.c:497:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 497 | { | ^ ./base/fapi_ft.c:519:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 519 | { | ^ ./base/fapi_ft.c:533:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 533 | { | ^ ./base/fapi_ft.c:550:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 550 | { | ^ ./base/fapi_ft.c:915:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 915 | { | ^ ./base/fapi_ft.c:978:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 978 | { | ^ ./base/fapi_ft.c:1113:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1113 | { | ^ ./base/fapi_ft.c:1426:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1426 | { | ^ ./base/fapi_ft.c:1436:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1436 | { | ^ ./base/fapi_ft.c:1456:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1456 | { | ^ ./base/fapi_ft.c:1470:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1470 | { | ^ ./base/fapi_ft.c:1494:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1494 | { | ^ ./base/fapi_ft.c:1506:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1506 | { | ^ ./base/fapi_ft.c:1516:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1516 | { | ^ ./base/fapi_ft.c:1535:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1535 | { | ^ ./base/fapi_ft.c:1549:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1549 | { | ^ ./base/fapi_ft.c:1574:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1574 | { | ^ ./base/fapi_ft.c:1588:3: error: storage class specified for parameter ‘FF_path_info’ 1588 | } FF_path_info; | ^~~~~~~~~~~~ ./base/fapi_ft.c:1592:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1592 | { | ^ ./base/fapi_ft.c:1601:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1601 | { | ^ ./base/fapi_ft.c:1621:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1621 | { | ^ ./base/fapi_ft.c:1638:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1638 | { | ^ ./base/fapi_ft.c:1690:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1690 | { | ^ ./base/fapi_ft.c:1716:31: error: storage class specified for parameter ‘TheFtOutlineFuncs’ 1716 | static const FT_Outline_Funcs TheFtOutlineFuncs = { | ^~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1716:1: error: parameter ‘TheFtOutlineFuncs’ is initialized 1716 | static const FT_Outline_Funcs TheFtOutlineFuncs = { | ^~~~~~ ./base/fapi_ft.c:1717:5: error: ‘move_to’ undeclared (first use in this function); did you mean ‘mode_t’? 1717 | move_to, | ^~~~~~~ | mode_t ./base/fapi_ft.c:1718:5: error: ‘line_to’ undeclared (first use in this function) 1718 | line_to, | ^~~~~~~ ./base/fapi_ft.c:1719:5: error: ‘conic_to’ undeclared (first use in this function) 1719 | conic_to, | ^~~~~~~~ ./base/fapi_ft.c:1720:5: error: ‘cubic_to’ undeclared (first use in this function) 1720 | cubic_to, | ^~~~~~~~ ./base/fapi_ft.c:1730:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1730 | { | ^ ./base/fapi_ft.c:1757:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1757 | { | ^ ./base/fapi_ft.c:1777:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1777 | { | ^ ./base/fapi_ft.c:1786:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1786 | { | ^ ./base/fapi_ft.c:1796:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1796 | { | ^ ./base/fapi_ft.c:1830:13: error: storage class specified for parameter ‘gs_fapi_freetype_destroy’ 1830 | static void gs_fapi_freetype_destroy(gs_fapi_server ** serv); | ^~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1832:40: error: storage class specified for parameter ‘freetypedescriptor’ 1832 | static const gs_fapi_server_descriptor freetypedescriptor = { | ^~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1832:1: error: parameter ‘freetypedescriptor’ is initialized 1832 | static const gs_fapi_server_descriptor freetypedescriptor = { | ^~~~~~ ./base/fapi_ft.c:1838:29: error: storage class specified for parameter ‘freetypeserver’ 1838 | static const gs_fapi_server freetypeserver = { | ^~~~~~~~~~~~~~ ./base/fapi_ft.c:1838:1: error: parameter ‘freetypeserver’ is initialized 1838 | static const gs_fapi_server freetypeserver = { | ^~~~~~ ./base/fapi_ft.c:1848:5: error: ‘gs_fapi_ft_ensure_open’ undeclared (first use in this function); did you mean ‘gs_fapi_font_feature_lenIV’? 1848 | gs_fapi_ft_ensure_open, | ^~~~~~~~~~~~~~~~~~~~~~ | gs_fapi_font_feature_lenIV ./base/fapi_ft.c:1849:5: error: ‘gs_fapi_ft_get_scaled_font’ undeclared (first use in this function); did you mean ‘gs_fapi_font_scale_s’? 1849 | gs_fapi_ft_get_scaled_font, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | gs_fapi_font_scale_s ./base/fapi_ft.c:1850:5: error: ‘gs_fapi_ft_get_decodingID’ undeclared (first use in this function) 1850 | gs_fapi_ft_get_decodingID, | ^~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1851:5: error: ‘gs_fapi_ft_get_font_bbox’ undeclared (first use in this function); did you mean ‘gs_fapi_get_font_info’? 1851 | gs_fapi_ft_get_font_bbox, | ^~~~~~~~~~~~~~~~~~~~~~~~ | gs_fapi_get_font_info ./base/fapi_ft.c:1852:5: error: ‘gs_fapi_ft_get_font_proportional_feature’ undeclared (first use in this function) 1852 | gs_fapi_ft_get_font_proportional_feature, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1853:5: error: ‘gs_fapi_ft_can_retrieve_char_by_name’ undeclared (first use in this function) 1853 | gs_fapi_ft_can_retrieve_char_by_name, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1854:5: error: ‘gs_fapi_ft_can_replace_metrics’ undeclared (first use in this function) 1854 | gs_fapi_ft_can_replace_metrics, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1856:5: error: ‘gs_fapi_ft_get_fontmatrix’ undeclared (first use in this function); did you mean ‘gs_fapi_get_font_info’? 1856 | gs_fapi_ft_get_fontmatrix, | ^~~~~~~~~~~~~~~~~~~~~~~~~ | gs_fapi_get_font_info ./base/fapi_ft.c:1857:5: error: ‘gs_fapi_ft_get_char_width’ undeclared (first use in this function); did you mean ‘gs_text_setcharwidth’? 1857 | gs_fapi_ft_get_char_width, | ^~~~~~~~~~~~~~~~~~~~~~~~~ | gs_text_setcharwidth ./base/fapi_ft.c:1858:5: error: ‘gs_fapi_ft_get_char_raster_metrics’ undeclared (first use in this function) 1858 | gs_fapi_ft_get_char_raster_metrics, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1859:5: error: ‘gs_fapi_ft_get_char_raster’ undeclared (first use in this function) 1859 | gs_fapi_ft_get_char_raster, | ^~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1860:5: error: ‘gs_fapi_ft_get_char_outline_metrics’ undeclared (first use in this function) 1860 | gs_fapi_ft_get_char_outline_metrics, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1861:5: error: ‘gs_fapi_ft_get_char_outline’ undeclared (first use in this function) 1861 | gs_fapi_ft_get_char_outline, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1862:5: error: ‘gs_fapi_ft_release_char_data’ undeclared (first use in this function) 1862 | gs_fapi_ft_release_char_data, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1863:5: error: ‘gs_fapi_ft_release_typeface’ undeclared (first use in this function) 1863 | gs_fapi_ft_release_typeface, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1864:5: error: ‘gs_fapi_ft_check_cmap_for_GID’ undeclared (first use in this function) 1864 | gs_fapi_ft_check_cmap_for_GID, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c:1866:5: error: ‘gs_fapi_ft_set_mm_weight_vector’ undeclared (first use in this function); did you mean ‘gs_fapi_font_feature_WeightVector’? 1866 | gs_fapi_ft_set_mm_weight_vector, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | gs_fapi_font_feature_WeightVector ./base/fapi_ft.c:1873:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1873 | { | ^ ./base/fapi_ft.c:1902:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token 1902 | { | ^ ./base/fapi_ft.c:128:1: error: old-style parameter declarations in prototyped function definition 128 | FT_CALLBACK_DEF(void *) | ^~~~~~~~~~~~~~~ ./base/fapi_ft.c:128:17: error: parameter name omitted 128 | FT_CALLBACK_DEF(void *) | ^~~~~~ ./base/fapi_ft.c:1917: error: expected ‘{’ at end of input 1917 | } | ./base/fapi_ft.c: At top level: ./base/fapi_ft.c:121:1: warning: ‘delete_inc_int’ declared ‘static’ but never defined [-Wunused-function] 121 | delete_inc_int(gs_fapi_server * a_server, | ^~~~~~~~~~~~~~ ./base/fapi_ft.c:125:1: warning: ‘delete_inc_int_info’ declared ‘static’ but never defined [-Wunused-function] 125 | delete_inc_int_info(gs_fapi_server * a_server, | ^~~~~~~~~~~~~~~~~~~ ./base/fapi_ft.c: In function ‘FT_CALLBACK_DEF’: ./base/fapi_ft.c:1917:1: error: control reaches end of non-void function [-Werror=return-type] 1917 | } | ^ cc1: some warnings being treated as errors make[2]: *** [base/lib.mak:1337: soobj/fapi_ft_1.o] Error 1
It seems like FT_CALLBACK_DEF macro has been changed to be internal to freetype only: https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=bb66c8d8cf1eb86309273d7c53c44522d35941d4
MacPorts recently encountered this problem (https://trac.macports.org/ticket/61306), since it builds Ghostscript with a separately-maintained build of freetype (which it just updated to 2.10.3), rather than the one bundled with Ghostscript. It is indeed because the FT_CALLBACK_DEF macro was moved from <freetype/config/ftconfig.h> to a private, non-installed header <freetype/internal/compiler-macros.h>. The important error observed using clang: ./base/fapi_ft.c:129:1: error: expected function body after function declarator FF_alloc(FT_Memory memory, long size) ^ clang mistakes FT_CALLBACK_DEF(void *) on the previous line for the function declarator, and '^' is where it expects the opening '{'. One workaround is to define FT_CALLBACK_DEF directly in fapi_ft.c: --- base/fapi_ft.c.orig +++ base/fapi_ft.c @@ -124,6 +124,14 @@ static void delete_inc_int_info(gs_fapi_server * a_server, FT_IncrementalRec * a_inc_int_info); + +#ifndef FT_CALLBACK_DEF +#ifdef __cplusplus +#define FT_CALLBACK_DEF( x ) extern "C" x +#else +#define FT_CALLBACK_DEF( x ) static x +#endif +#endif FT_CALLBACK_DEF(void *) FF_alloc(FT_Memory memory, long size)
I've asked the freetype developers for some guidance on the appropriate fix for this (FT_CALLBACK_DEF seems like the right thing to use when defining a callback for freetype!). At the moment, there seems to be some uncertainty, and the developer who those changes to freetype has not actually replied. Once I get that guidance, I'll commit a fix based on it.
Well, over a week, and no reply from the developer that actually made that change to Freetype, so I've gone ahead and committed the "obvious" change: https://git.ghostscript.com/?p=ghostpdl.git;a=commitdiff;h=41ef9a0bc36b I still think it seems bonkers to have a macro for declaring callbacks that is inaccessible for code that wants to define callbacks.... oh well.