How to ensure macOS compatibility

Hi guys,

I’ve built a JUCE audio plugin with CMake, with this flag:

set(CMAKE_OSX_DEPLOYMENT_TARGET “10.14” CACHE STRING “Minimum OS X deployment target” FORCE)

Because I would like my plugin to run on older macOS version down to the 10.14. I’ve checked with otool and it seems ok:

minos 10.14
  sdk 14.0

But on macOS 10.14 my plugin crashes at startup because of a missing symbol: NSWorkspace.OpenConfiguration

I suppose that this symbol is used inside the JUCE library. The official Apple documentation says that this object has been introduced with macOS 10.15 .

How can I make sure that my executable will run on all macOS version from 10.14 to 14?

Thank you!

It looks like you’re building with Xcode 15. Are you using the -Wl,-ld-classic flag as described in the known issues section in the release notes?

Uhm actually I’m using the CMake extension for VSCode to build, that of course use the XCode SDK (with Clang 15.0.0). So basically I’m not directly writing the build command in the command line.

I guess that I need to add

add_compile_options(-Wl, -ld-classic)

Right?

Something like that, but you need the flag to be passed to the linker rather than to the compiler. You can do that with CMAKE_EXE_LINKER_FLAGS and/or target_link_options.

1 Like

Thank you! Yes, is link_options and not compile_options, my bad. I’ve added the flags and it seems fine, I’ll check on an older Mac.

For future users that may need the command:

if (APPLE)
   target_link_options(yourTarget PUBLIC -Wl -ld_classic)
endif()
3 Likes

Would these flags be set automatically by the latest Projucer when targeting 10.13 as the minimum Mac OS (I am guessing that’s a no)?
I am a little bit surprised that XCode would not already use the correct options (or provide a warning) if it sees the OS targeted is requiring that, but what really seems to be the case is that the out of the box (i.e. no special other tweaks) min supported OS for XCcode 15 is actually OS 12.0 according to the release notes and not 10.13.

No; this flag is only recognised by Xcode 15+, so setting it would break the build for people using older versions of Xcode.

1 Like

Are those flags still necessary in recent version of Xcode 15 (15.4) ?
Thanks !