MacOS AU compatibility

My plugin in Audio Unit format is compiled on MacOS 14 and runs fine but crashes when opened in MacOS Ventura (13.4). When opened in logic it gives the following error:

Also when running auval auval -a, auval crashes immediately with the following output:
zsh: bus error auval -a

When i compile the plugin on a VM with Ventura 13.4.1 the plugin also runs fine. But when compiled on MacOS 14 it immediately crashes when opened in MacOS 13. Is there some kind of backward compatibility thing i should take into account?

I also tried debugging with pluginval on the VM with Ventura which crashed here (juce_AudioUnitPluginFormat.mm):

static void createAudioUnit (VersionedAudioComponent versionedComponent, AudioUnitCreationCallback callback)
{
    if (versionedComponent.isAUv3)
    {
        AudioComponentInstantiate (versionedComponent.audioComponent,
                                   kAudioComponentInstantiation_LoadOutOfProcess,
                                   ^(AudioComponentInstance audioUnit, OSStatus err)
                                   {
                                       callback (audioUnit, err);
                                   });

        return;
    }

    AudioComponentInstance audioUnit;
    auto err = AudioComponentInstanceNew (versionedComponent.audioComponent, &audioUnit);
    callback (err != noErr ? nullptr : audioUnit, err);
}

Where it crashes on line:

auto err = AudioComponentInstanceNew (versionedComponent.audioComponent, &audioUnit);

The thread backtrace is showing me the following output:

* thread #1, name = 'JUCE v8.0.3: Message Thread', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x10b26abf8)
  * frame #0: 0x0000000198337e28 libobjc.A.dylib`map_images_nolock + 5400
    frame #1: 0x000000019833688c libobjc.A.dylib`map_images + 100
    frame #2: 0x000000019838cb20 dyld`dyld4::RuntimeState::notifyLoad(std::__1::span<dyld4::Loader const*, 18446744073709551615ul> const&) + 656
    frame #3: 0x00000001983b6d4c dyld`dyld4::APIs::dlopen_from(char const*, int, void*) + 1428
    frame #4: 0x00000001987df3e0 CoreFoundation`_CFBundleDlfcnLoadBundle + 192
    frame #5: 0x00000001988549f4 CoreFoundation`_CFBundleLoadExecutableAndReturnError + 328
    frame #6: 0x000000019a3e6d28 AudioToolboxCore`APComponent_FromBundle_Loadable::ResolveFactoryFunction() + 68
    frame #7: 0x000000019a3e5d1c AudioToolboxCore`APComponent::newInstance(unsigned int, bool, void (OpaqueAudioComponentInstance*, int) block_pointer) + 324
    frame #8: 0x000000019a4e9f3c AudioToolboxCore`instantiate(OpaqueAudioComponent*, unsigned int, bool, void (OpaqueAudioComponentInstance*, int) block_pointer) + 428
    frame #9: 0x000000019a4ea45c AudioToolboxCore`__AudioComponentInstanceNew_block_invoke + 120
    frame #10: 0x000000019a35f7f0 AudioToolboxCore`Synchronously + 132
    frame #11: 0x000000019a4ea1e0 AudioToolboxCore`AudioComponentInstanceNew + 248
    frame #12: 0x00000001003f3c4c pluginval`juce::createAudioUnit(versionedComponent=(audioComponent = 0x00000000815db048, isAUv3 = false), callback=juce::AudioUnitCreationCallback @ 0x000000016fdfd568)>) at juce_AudioUnitPluginFormat.mm:520:16

Any tips on debugging this further or what the cause of the error might be?

Have you set the deployment target? For example, you can set the deployment target to 10.13:

# This must be set before the project() call
# see: https://cmake.org/cmake/help/latest/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13" CACHE STRING "Support macOS down to High Sierra")
2 Likes

That was it!

I was unaware of this CMake variable. Thanks!