Opened 2 weeks ago

Closed 7 days ago

#71261 closed defect (worksforme)

legacy-support-devel @20241104_0: error: passing argument 3 of 'scandir' from incompatible pointer type

Reported by: barracuda156 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.10.4
Keywords: Cc: fhgwright (Fred Wright), mascguy (Christopher Nielsen)
Port: legacy-support-devel

Description

legacysupport compatibility wrapper for scandir should be used on darwin < 13, but it seems to fail in this case:

FAILED: libgnome-desktop/libgnome-desktop-4.2.dylib.p/gnome-languages.c.o 
ccache /opt/local/bin/gcc-mp-14 -Ilibgnome-desktop/libgnome-desktop-4.2.dylib.p -Ilibgnome-desktop -I../gnome-desktop-43.2/libgnome-desktop -I/opt/local/include/LegacySupport -I. -I../gnome-desktop-43.2 -I/opt/local/include/gdk-pixbuf-2.0 -I/opt/local/include/libpng16 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include/gio-unix-2.0 -I/opt/local/include/gsettings-desktop-schemas -I/opt/local/include/libxml2 -I/opt/local/include -fdiagnostics-color=always -Wall -Winvalid-pch -std=gnu99 -O0 -g -pipe -Os -arch ppc '-DG_LOG_DOMAIN="GnomeDesktop"' -DGDK_DISABLE_DEPRECATION_WARNINGS -DGTK_DISABLE_DEPRECATION_WARNINGS '-DGNOMELOCALEDIR="/opt/local/share/locale"' '-DLIBLOCALEDIR="/opt/local/lib/locale"' '-DISO_CODES_PREFIX="/opt/local"' '-DFONTCONFIG_CACHE_PATH="/opt/local/var/cache/fontconfig"' '-DXKB_BASE="/opt/local/share/X11/xkb"' -MD -MQ libgnome-desktop/libgnome-desktop-4.2.dylib.p/gnome-languages.c.o -MF libgnome-desktop/libgnome-desktop-4.2.dylib.p/gnome-languages.c.o.d -o libgnome-desktop/libgnome-desktop-4.2.dylib.p/gnome-languages.c.o -c ../gnome-desktop-43.2/libgnome-desktop/gnome-languages.c
../gnome-desktop-43.2/libgnome-desktop/gnome-languages.c: In function 'collect_locales_from_directory':
../gnome-desktop-43.2/libgnome-desktop/gnome-languages.c:471:53: error: passing argument 3 of 'scandir' from incompatible pointer type [-Wincompatible-pointer-types]
  471 |         ndirents = scandir (LIBLOCALEDIR, &dirents, select_dirs, alphasort);
      |                                                     ^~~~~~~~~~~
      |                                                     |
      |                                                     int (*)(const struct dirent *)
In file included from /opt/local/include/LegacySupport/dirent.h:27,
                 from ../gnome-desktop-43.2/libgnome-desktop/gnome-languages.c:30:
/usr/include/dirent.h:119:5: note: expected 'int (*)(struct dirent *)' but argument is of type 'int (*)(const struct dirent *)'
  119 |     int (*)(struct dirent *), int (*)(const void *, const void *)) __DARWIN_INODE64(scandir);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~

Change History (7)

comment:1 Changed 2 weeks ago by mascguy (Christopher Nielsen)

Cc: mascguy added

comment:2 Changed 2 weeks ago by fhgwright (Fred Wright)

Did you define _MACPORTS_LEGACY_COMPATIBLE_SCANDIR nonzero before the includes?

See #70702#comment:1

comment:3 in reply to:  2 ; Changed 2 weeks ago by barracuda156

Replying to fhgwright:

Did you define _MACPORTS_LEGACY_COMPATIBLE_SCANDIR nonzero before the includes?

See #70702#comment:1

Thank you, I missed that. It worked, ticket can be closed.

comment:4 Changed 2 weeks ago by fhgwright (Fred Wright)

Note that that definition should be harmless in OS versions that don't need it, and even in non-Mac OSes. So putting it in the source might be accepted upstream if they don't object to the clutter.

comment:5 Changed 2 weeks ago by ryandesign (Ryan Carsten Schmidt)

I don't think we should be suggesting that upstream projects add MacPorts-specific code. We can easily add preprocessor definitions in Portfiles or in the legacy support portgroup.

comment:6 in reply to:  5 Changed 13 days ago by fhgwright (Fred Wright)

Replying to ryandesign:

I don't think we should be suggesting that upstream projects add MacPorts-specific code. We can easily add preprocessor definitions in Portfiles or in the legacy support portgroup.

Upstream code often includes OS-specific code far more significant than a one-line #define.

comment:7 in reply to:  3 Changed 7 days ago by mascguy (Christopher Nielsen)

Resolution: worksforme
Status: newclosed

Replying to barracuda156:

Replying to fhgwright:

Did you define _MACPORTS_LEGACY_COMPATIBLE_SCANDIR nonzero before the includes?

See #70702#comment:1

Thank you, I missed that. It worked, ticket can be closed.

Great, glad it's resolved Sergey!

Note: See TracTickets for help on using tickets.