OSD won't compile on SITL (on Mac OSX)

I’m trying to get OSD running in SITL on my Mac M1. I got the latest 2.5.1 SFML libraries for ARM, but when I try to run SITL, the build failes with this error:

In file included from ../../libraries/AP_Notify/Display.cpp:21:
../../libraries/AP_Notify/Display_SITL.h:46:5: fatal error: use of undeclared identifier 'sf'
    sf::RenderWindow *w;
    ^

sf seems to be a namespace defined in Graphics.hpp, but since the code is including Graphics.h (I think), the namespace is not defined. Any suggestions how I would fix this?

This was resolved by:

  1. using HomeBrew SFML
    brew install sgml
  2. making sure the homebrew lib and include directories are found by the compiler
LDFLAGS=-L/opt/homebrew/lib
CPPFLAGS=-I/opt/homebrew/include
  1. Applying the patch from @rhys which fixes a Max OSX limitation that the OSD needs

Thanks to @ntamas and @rhys (Discord IDs) for the help