Compiling juce plugin with OSX 10.7 AU libs


#1

I recently upgraded to OSX 10.7 and had to take some steps to get my plugins to compile. Anyway, thought it would be fun to share since I have seen a few posts with issues around this topic.

Steps -

  • download latest git, open plugin demo project

  • note the AU wrapper files drop out if you have OSX 10.7 (/Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits does not exist)

  • so … replace those files with the new AudioUnit libs for 10.7 downloaded from Apple.

  • note that the new AudioUnit wrapper files will NOT compile with OSX 10.6 base SDK, so switch to 10.7 (or you will get a bunch of errors when compiling ComponentBase.h if the base SDK is set to 10.6).

  • One final linker error _vDSP_vsma referenced from … indicates we must include the accelerate framework. You’ll have to dig that up, and/or download it from the Apple website.

Voila! SUCCESS … now a few changes, notes, etc …

  • Since I don’t want to continue supporting carbon (it goes away with Mac OSX 10.8 this summer by the way), I now set the #define BUILD_AU_CARBON_UI flag to 0 in AppConfig.h.

  • I can now remove a bunch of the AudioUnit files that have to do with Carbon as well.

CARBON NOTE:

  • note that the .r files in the wrapper are needed for Carbon support … those are resource files from a bygone era - only relevant for carbon resources. Sometimes you get this screwy “resource fork not written” error regarding these files, but if you remove them from the codebase, clean, recompile, then readd them … it will generally work. Never understood that myself, but it happens.

So far, so good …

Now, I also want to make this 64 bit … so I change the Architecture and recompile. Now I have a small problem though, since the plugin doesn’t show up in any of my (32 bit) AudioUnit hosts (including the latest ableton and Apple’s own AULab).

Luckily I have a copy of Reaper which can be run in 64 bit mode, and then see’s the plugin as expected.

I also compiled the Juce plugin host in 64 bit mode, but oddly it doesn’t seem to see 64 bit plugins (would you expect it to host 64 bit plugs … not sure).

Anyway, that’s my adventures for the last few days, just thought I’d share.


#2

Does your plugin runs on 10.6 and 10.5?

I had to replace the CoreAudio/AudioUnits folder to the 10.6 version in order for it to run on 10.6. 10.5 is still not working.
I guess this is not the proper way to do it so I’m still looking for a better way.

Apple says in regard to AU & 10.7:

But they don’t say it will run on 10.5

They also say:

[quote]Mac OS X Lion introduces a new plug-in model called AUPlugIn which is no longer based on the Component Manager. The AUPlugIn model has a new dispatch mechanism requiring the inclusion of two new dispatch helper files called AUPlugInDispatch.h and AUPlugInDispatch.cpp respectively.

A new AUDIOCOMPONENT_ENTRY() macro has been added to ComponentBase.h and by using this macro audio unit entry points are created for both the audio unit plug-in for Mac OS X Lion and the Component Manager component for backwards compatibility with Mac OS X v10.6.x.

Because audio units no longer use the Component Manager on Mac OS X Lion or newer, AUPlugIn based audio units do not use resource files (.r files) or the ‘thng’ resource to define properties such as kComponentType, kComponentSubType, and kComponentManufactureType. These properties are now specified in the project’s Info.plist file for the audio unit. You can continue to include the Component Manager resource file in the project for backwards compatibility with Mac OS X v10.6.x.

The new AUPlugIn entry point generated by the AUDIOCOMPONENT_ENTRY() macro is required and must be added to the exports file (.exp). You can leave the Component Manager entry point in the exports file to provide backwards compatibility with Mac OS X v10.6.x.[/quote]

http://developer.apple.com/library/mac/#technotes/tn2276/_index.html#//apple_ref/doc/uid/DTS40011031


#3

mine does run not in 10.6.

Tried the steps above, but including the resource file gets me a rez error (AUResource.r Rez fails with code 2).

If anyone gets backward compatibility, please drop a line here. Otherwise, I’m just gonna support 10.7 + and not try for it I think.


#4

Hi Aaron,

Where would I find the new AudioUnit libs please? I’m new to programming and don’t know where to find them.

Just to be certain I understand what you mean, should I delete the AUPublic folder and put the new libs in place?

Also, I wonder if this is definitely the correct solution for me. I can build AU’s and VSTs, for example the Audio Plugin Demo, but the AU does not show up in my DAW (Ableton Live). Does this mean running Lion is the problem or something else?

Thanks in advance if you have the time to answer me.

Dave :slight_smile:


#5

No need to reply. I updated XCode and everything works fine.