Opened 14 months ago

Last modified 13 months ago

#68277 assigned defect

dosbox-staging @0.80.1: error: call to undeclared function 'select'; ISO C99 and later do not support implicit function declarations

Reported by: thaewrapt (Alexey Ugnichev) Owned by: kakuhen
Priority: Normal Milestone:
Component: ports Version:
Keywords: sonoma Cc:
Port: dosbox-staging

Description (last modified by thaewrapt (Alexey Ugnichev))

During a port rebuild after upgrading to Sonoma, the build is failing.

Excerpt from the main.log (which is in the attachment as well):

:info:build /usr/bin/clang -Isrc/libs/manymouse/libmanymouse.a.p -Isrc/libs/manymouse -I../dosbox-staging-0.80.1/src/libs/manymouse -I../dosbox-staging-0.80.1/include -I. -I../dosbox-staging-0.80.1 -I/opt/local/include -fcolor-diagnostics
 -DNDEBUG -Wall -Winvalid-pch -Wextra -Wpedantic -O3 -Wno-unknown-pragmas -Weffc++ -Wextra-semi -fstrict-aliasing -Wstrict-aliasing -fmerge-all-constants -fno-math-errno -fno-signed-zeros -fno-trapping-math -fassociative-math -freciprocal
-math -ffinite-math-only -ffunction-sections -fdata-sections -fPIC -pipe -Os -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch arm64 -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -MD -MQ src/libs/manymo
use/libmanymouse.a.p/x11_xinput2.c.o -MF src/libs/manymouse/libmanymouse.a.p/x11_xinput2.c.o.d -o src/libs/manymouse/libmanymouse.a.p/x11_xinput2.c.o -c ../dosbox-staging-0.80.1/src/libs/manymouse/x11_xinput2.c
:info:build ../dosbox-staging-0.80.1/src/libs/manymouse/x11_xinput2.c:377:13: error: call to undeclared function 'select'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
:info:build         if (select(fd+1, &fdset, NULL, NULL, &nowait) == 1)
:info:build             ^
:info:build 1 error generated.

Attachments (1)

dosbox-staging-main.log (2.4 MB) - added by thaewrapt (Alexey Ugnichev) 14 months ago.

Change History (8)

Changed 14 months ago by thaewrapt (Alexey Ugnichev)

Attachment: dosbox-staging-main.log added

comment:1 Changed 14 months ago by thaewrapt (Alexey Ugnichev)

Description: modified (diff)

comment:2 Changed 14 months ago by jmroot (Joshua Root)

Owner: set to kakuhen
Status: newassigned

Looks like an upstream bug; select is called without including sys/select.h.

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

Keywords: sonoma added
Summary: dosbox-staging port build fails on MacOSX 14 Sonomadosbox-staging @0.80.1: error: call to undeclared function 'select'; ISO C99 and later do not support implicit function declarations

And see WimplicitFunctionDeclaration but it's curious because usually those issues affect all systems with Xcode 12 or later (Catalina and later) yet we have successful builds of this port on the build system on all systems up to Ventura. (We haven't started building for Sonoma yet.) Maybe sys/select.h got included by some other header on Xcode 14 and earlier and this has changed in Xcode 15.

When you report this problem to the developers, you might also mention some of this software's other problems, such as a function declaration without a prototype is deprecated in all versions of C.

comment:4 Changed 14 months ago by thaewrapt (Alexey Ugnichev)

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

Upstream has fixed it by including that header so we could add a patch to MacPorts to do the same.

However it's also pointed out in the upstream issue that this code only takes effect when xinput was found and is only relevant to X11, and while we do offer xinput and X11 in MacPorts, this port does not declare dependencies on xinput or any other X11 ports, so this use may be unintentional. For example if I configure dosbox-staging on my system using trace mode (on Monterey where it works; trace mode is broken on Ventura and later), I see:

--->  Configuring dosbox-staging
Warning: The following existing files were hidden from the build system by trace mode:
  /opt
  /opt/local/bin/ar
  /opt/local/bin/git
  /opt/local/bin/gmake
  /opt/local/bin/lipo
  /opt/local/lib/pkgconfig/xi.pc
  /private/var/select/sh
  /usr/X11R6

And:

% port provides /opt/local/lib/pkgconfig/xi.pc
/opt/local/lib/pkgconfig/xi.pc is provided by: xorg-libXi

xorg-libXi is the X11 input extension.

So the port should either declare a dependency on xorg-libXi if it wants to use it, or ensure that it will not be used even if it is installed.

Version 0, edited 14 months ago by ryandesign (Ryan Carsten Schmidt) (next)

comment:6 Changed 14 months ago by thaewrapt (Alexey Ugnichev)

I've tried to add the xinput2 variant to a Portfile (which reverts to upstream's default setting of looking for a lib in question), and if that variant is not specified, we specifically tell meson to not look for it. Tested with a couple of DOS games I have, the experience seems identical when built with or without it.

If that's ok with everybody, I could send a merge for my changes.

comment:7 Changed 13 months ago by thaewrapt (Alexey Ugnichev)

Just to avoid confusion, here are the said changes (see both 'Portfile' and a patch under 'files' directory): https://github.com/thaewrapt/macports-emulators-dosbox-staging

Note: See TracTickets for help on using tickets.