Opened 9 months ago

Closed 8 months ago

#69462 closed defect (fixed)

libiconv @1.17: install errors on lib/encodings.def with an "incompatible function pointer types initializing" error.

Reported by: rbeyer (Ross Beyer) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.9.1
Keywords: Cc: nanigashi-uji (Nanigashi Uji)
Port: libiconv

Description

I have a brand-new M3 Max MBP, with Sonoma (14.3.1). I installed MacPorts into /opt/macports/ and the very first thing I did with this shiny new MacPorts install was to port install git, which resulted in this error installing libiconv. I port cleaned everything and still get this error when I try to install libiconv:

In file included from lib/genflags.c:109:
lib/encodings.def:75:45: error: incompatible function pointer types initializing 'int (*)(conv_t, unsigned char *, ucs4_t, size_t)' (aka 'int (*)(struct conv_struct *, unsigned char *, unsigned int, unsigned long)') with an expression of type 'int (conv_t, unsigned char *, ucs4_t, int)' (aka 'int (struct conv_struct *, unsigned char *, unsigned int, int)') [-Wincompatible-function-pointer-types]
            { utf8mac_mbtowc, NULL },     { utf8mac_wctomb, NULL })
                                            ^~~~~~~~~~~~~~
lib/genflags.c:104:34: note: expanded from macro 'DEFENCODING'
    struct wctomb_funcs ofuncs = xxx_ofuncs1,xxx_ofuncs2; \
                                 ^~~~~~~~~~~

Lots of ports depend on libiconv, and I was surprised that this brought me up short. There were also some warnings about "extraneous parentheses" in the libiconv install, but they were just warnings.

Attachments (1)

main.log (45.3 KB) - added by rbeyer (Ross Beyer) 9 months ago.
main.log file from run of port install libiconv immediately after a port clean --all libiconv

Download all attachments as: .zip

Change History (6)

comment:1 Changed 9 months ago by ryandesign (Ryan Carsten Schmidt)

Owner: set to ryandesign
Status: newassigned
Summary: libiconv 1.17: install errors on lib/encodings.def with an "incompatible function pointer types initializing" error.libiconv @1.17: install errors on lib/encodings.def with an "incompatible function pointer types initializing" error.

Could you attach the main.log file?

Changed 9 months ago by rbeyer (Ross Beyer)

Attachment: main.log added

main.log file from run of port install libiconv immediately after a port clean --all libiconv

comment:2 Changed 9 months ago by nanigashi-uji (Nanigashi Uji)

I met the same error.

Type of of last argument of functions, 'utf8mac_mbtowc' and 'utf8mac_wctomb', in 'lib/utf8mac.h' (added by patch-utf8mac.diff) should be 'size_t', but 'int' in patch-utf8mac.diff.

This issue can be solved by correcting them as follows.

static int
utf8mac_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, size_t n)

static int
utf8mac_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, size_t n) /* n == 0 is acceptable */
Last edited 9 months ago by ryandesign (Ryan Carsten Schmidt) (previous) (diff)

comment:3 Changed 9 months ago by ryandesign (Ryan Carsten Schmidt)

Cc: nanigashi-uji added
Status: assignedaccepted

Thank you for pointing that out. I'll take a look.

comment:4 Changed 8 months ago by ryandesign (Ryan Carsten Schmidt)

I agree with the fix. The parameter changed from int to size_t in GNU libiconv 1.15 and we didn't notice and update our patch. We've been coasting along with a warning all this time.

Apple made this change and a few others in version 41 of their libiconv so I'll adopt their changes into the port.

After version 64, Apple switched from GNU libiconv to Citrus libiconv.

comment:5 Changed 8 months ago by ryandesign (Ryan Carsten Schmidt)

Resolution: fixed
Status: acceptedclosed

In 9103af9f7d7950b347687f4dcf510b15983850c1/macports-ports (master):

libiconv: Update utf8mac patch from Apple libiconv 41

Fixes build with newer versions of clang.

Closes: #69462

Note: See TracTickets for help on using tickets.