#67263 closed defect (fixed)

supertuxkart @1.4: builds fail for 10.12 and earlier: IOSurface/IOSurfaceRef.h not found

Reported by: mascguy (Christopher Nielsen) Owned by: evanmiller (Evan Miller)
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc: evanmiller (Evan Miller), kencu (Ken)
Port: supertuxkart

Description

Details:

supertuxkart/work/SuperTuxKart-1.4-src/lib/graphics_engine/include/vk_mvk_moltenvk.h:29:10: fatal error: 'IOSurface/IOSurfaceRef.h' file not found

#include <IOSurface/IOSurfaceRef.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~

https://ports.macports.org/port/supertuxkart/details/

Do IOSurface headers have to be included differently for older macOS releases, or...?

Change History (11)

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

Checking on 10.6, there is no IOSurfaceRef.h in the IOSurface framework.

Generally, one uses a framework by including its main header, e.g. #include <IOSurface/IOSurface.h>. That in turn might include other headers of that framework, which might change from release to release.

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/IncludingFrameworks.html:

When including framework header files, it is traditional to include only the master framework header file. The master header file is the header file whose name matches the name of the framework.

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

MoltenVK isn't going to work on OS versions that don't have Metal, however.

comment:3 in reply to:  2 Changed 12 months ago by mascguy (Christopher Nielsen)

Worst-case, if upstream now depends on newer frameworks, we may simply need to fallback to an older version where necessary.

@kencu and @evanmiller, you folks have both updated and/or patched this port of late. Thoughts/comments...?

comment:4 Changed 12 months ago by evanmiller (Evan Miller)

The earliest Mac OS with Metal support is 10.11 – maybe we could get a patch working for 10.11/10.12 but likely nothing earlier.

Supertuxkart 1.3 works fine on my 10.6 machine though. A little laggy at times but playable :-)

comment:5 Changed 12 months ago by kencu (Ken)

supertuxkart says it supports down to 10.9 with it’s available download

https://blog.supertuxkart.net/2022/11/supertuxkart-14-release.html

so perhaps there is some hope for toggles, etc

comment:6 Changed 12 months ago by kencu (Ken)

apparently there is some kind of sdl2 vulkan compat layer they used:

https://github.com/supertuxkart/stk-code/commit/17d26338f8ec19784b9a73b285b6b0f7cc7e1dd1

this has been in for some time, so maybe it’s going to be just adjusting to the master header as Ryan suggested. Easy start, anyway.

comment:7 Changed 12 months ago by evanmiller (Evan Miller)

After some tinkering I did get this playable on 10.6 with three changes.

  1. Set DLOPEN_MOLTENVK=ON
  1. In place of the IOSurfaceRef.h import you just need
typedef void *IOSurfaceRef;
  1. #ifdef out the Metal.h imports (I used an #undef __OBJC__)

With these changes the program will attempt (fail) to load Metal at run-time and fall back to OpenGL.

comment:8 Changed 12 months ago by evanmiller (Evan Miller)

Owner: set to evanmiller
Resolution: fixed
Status: newclosed

In 6269ec785ef22970894d04250e4d2fe1c0ec7645/macports-ports (master):

supertuxkart: Fix build on 10.12 and earlier

Closes: #67263

comment:9 Changed 12 months ago by jmroot (Joshua Root)

Failing on 10.9:

In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_games_supertuxkart/supertuxkart/work/SuperTuxKart-1.4-src/lib/irrlicht/source/Irrlicht/MoltenVK.mm:8:
In file included from /System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:8:
In file included from /System/Library/Frameworks/AppKit.framework/Headers/NSResponder.h:9:
In file included from /System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:9:
In file included from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35:
In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:43:
In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:9:
In file included from /System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceAPI.h:13:
In file included from /System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceBase.h:30:
In file included from /usr/include/xpc/xpc.h:31:
/usr/include/xpc/base.h:105:13: error: expected value in expression
#if __OBJC__
            ^
In file included from /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_games_supertuxkart/supertuxkart/work/SuperTuxKart-1.4-src/lib/irrlicht/source/Irrlicht/MoltenVK.mm:8:
In file included from /System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:8:
In file included from /System/Library/Frameworks/AppKit.framework/Headers/NSResponder.h:9:
In file included from /System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:9:
In file included from /System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:35:
In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h:43:
In file included from /System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:9:
/System/Library/Frameworks/IOSurface.framework/Headers/IOSurfaceAPI.h:17:29: error: typedef redefinition with different types ('struct __IOSurface *' vs 'void *')
typedef struct __IOSurface *IOSurfaceRef;
                            ^
/opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_games_supertuxkart/supertuxkart/work/SuperTuxKart-1.4-src/lib/graphics_engine/include/vk_mvk_moltenvk.h:33:15: note: previous definition is here
typedef void *IOSurfaceRef;
              ^

comment:10 Changed 12 months ago by mascguy (Christopher Nielsen)

Resolution: fixed
Status: closedreopened

comment:11 Changed 12 months ago by evanmiller (Evan Miller)

Resolution: fixed
Status: reopenedclosed

In fb028dfb6fa248019a3cd1b85e3babae578e93dd/macports-ports (master):

supertuxkart: fix build on 10.8-10.10

Closes: #67263

Note: See TracTickets for help on using tickets.