Problem with 64 bit Compile of juce_AU_wrapper in DemoPlugin

I am trying to compile the JuceDemoPlugin with Architectures set to Standard (32/64-bit Universal) on Mac OSX 10.6 using SDK 10.6 and Xcode 3.2.2 in Release configuration so that the x86_64 arch is built in addition to the x386 arch. There is a problem compiling the juce_AU_wrapper.mm. Several symbols such as AudioUnitCarbonViewEventListener are not defined because in AudioUnitCarbonView.h they are only defined if LP64 is undefined. This can presumably be gotten around by setting BUILD_AU_CARBON_UI to zero but this would mean the 32 bit versions in the Universal build would not run on older hosts which seems a shame. Do I need to build seperate bundles? How should one deal with this?

Good point. You could always just set BUILD_AU_CARBON_UI to 0 only if LP64 is defined. I should probably tweak it to turn off the carbon by default in a 64-bit build though, so you can leave the flag enabled.

Sure. Conditioning BUILD_AU_CARBON_UI on LP64 seems like the perfect and very easy solution. Thanks, I just wanted to know that I was on the right track and not missing some key insight, being a Juce newbie.

What’s the relation between BUILD_AU_CARBON_UI and JUCE_SUPPORT_CARBON ?

If I build the tip in 64bit with pretty much the same configuration as JuceProspector with JUCE_SUPPORT_CARBON=1 (in juce_Config.h), it fails to compile when in juce_mac_CarbonViewWrapperComponent.h whereas it works when JUCE_SUPPORT_CARBON=0. It seems logical because then this file isn’t included at all.

But then in 32bit with JUCE_SUPPORT_CARBON=0, VST support can’t be compiled because it needs Carbon Support. Why is the error raised in 32bit and not in 64bit mode?

If it requires Carbon, then how to fix the compilation error when JUCE_SUPPORT_CARBON is 1?

In file included from [juce]/Builds/MacOSX/../../src/audio/plugins/formats/juce_AudioUnitPluginFormat.mm:53: [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h: In member function 'virtual bool juce::CarbonViewWrapperComponent::getEmbeddedViewSize(int&, int&)': [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:67: error: 'HIViewGetBounds' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h: In member function 'void juce::CarbonViewWrapperComponent::createWindow()': [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:86: error: 'CreateNewWindow' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:98: error: 'HIViewGetRoot' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:109: error: 'kEventWindowDrawContent' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:115: error: 'GetWindowEventTarget' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h: In member function 'void juce::CarbonViewWrapperComponent::deleteWindow()': [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:134: error: 'DisposeWindow' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h: In member function 'void juce::CarbonViewWrapperComponent::setEmbeddedWindowToOurSize()': [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:177: error: 'HIViewSetFrame' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:188: error: 'SetWindowBounds' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:189: error: 'ShowWindow' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h: In static member function 'static void juce::CarbonViewWrapperComponent::recursiveHIViewRepaint(OpaqueControlRef*)': [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:219: error: 'HIViewSetNeedsDisplay' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:220: error: 'HIViewGetFirstSubview' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:225: error: 'HIViewGetNextView' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h: In member function 'virtual void juce::CarbonViewWrapperComponent::timerCallback()': [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:236: error: 'HIViewGetRoot' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h: In member function 'OSStatus juce::CarbonViewWrapperComponent::carbonEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*)': [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:244: error: 'ActivateWindow' was not declared in this scope [juce]/Builds/MacOSX/../../src/audio/plugins/formats/../../../native/mac/juce_mac_CarbonViewWrapperComponent.h:257: error: 'HIViewSetNeedsDisplay' was not declared in this scope

They were used for different purposes. I guess I should make sure that both are always disabled in a 64-bit build.

So if I understand well, 64-bit build implies no Carbon at all, thus no VST support?

Or should it be 2 different builds: 64bit, carbon support, vst support, no AU || 64bit, no carbon support, AU support, no vst ?

I think the most recent VST SDK might have support for 64-bit builds, but it’ll require some updates to support it, which I’ve not had time to look into yet.

When I try to compile the demo plugin from the tip as 64 bit intel I get loads of errors, starting with:

juce_mac_NSViewComponentPeer.mm:1667: error: ‘kUIModeAllSuppressed’ was not declared in this scope
juce_mac_NSViewComponentPeer.mm:1667: error: ‘kUIOptionAutoShowMenuBar’ was not declared in this scope
juce_mac_NSViewComponentPeer.mm:1667: error: ‘SetSystemUIMode’ was not declared in this scope
juce_mac_NSViewComponentPeer.mm:1672: error: ‘kUIModeNormal’ was not declared in this scope
juce_mac_NSViewComponentPeer.mm:1672: error: ‘SetSystemUIMode’ was not declared in this scope

I’m on 10.6.5 using latest XCode 3.2.5.

Universal Binary (32bit intel/ppc) builds alright, it’s when switching to 64Bit Intel that it doesn’t work. Tried setting JucePlugin_Build_VST = 0, no change. Didn’t touch any other flags, etc…

Damn, those used to work, but it looks like they’ve got rid of them in 10.6 - I’ll have to figure out what their replacement is. No harm in removing those calls from the codebase if you’re trying to get it to compile.

But there are around 55 other errors following… Maybe best is I wait until you check in a new version…
Also, what do you mean when you say “used to work (before)” ? I’ve tried with Base SDK 10.5, still getting the same errors.

From what I’ve read those Carbon calls should still be available in 10.6 64 bit builds but I think the 10.6+ replacement is [NSApplication setPresentationOptions] with the Cocoa reference http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html#//apple_ref/occ/instm/NSApplication/setPresentationOptions:

Yep, I’ve got a replacement for them now that it can use if your minimum deployment target is 10.6. Will check-in shortly.

I don’t think this has anything to do with Base SDK or deployment target. As a matter of fact I’ve both settings set to 10.5 here. And it doesn’t work.

It certainly does relate to the SDK, because the [NSApplication setPresentationOptions] is only available in 10.6 - in older SDKs the only way to do this was with the old carbon functions, so Apple said that they would still be available to 64-bit apps.

But then, why doesn’t changing Base SDK and deployment target to 10.5 change anything here (and sorry if this is a stupid question)?

I really don’t know, but you do seem to be having a whole bunch of strange problems that nobody else has ever had!

TBH I’m still using XCode 3.2.3, so I should probably update in case they’ve changed something…

I’ve got XCode 3.2.5, not 3.2.2 (that was a typo, sorry). Let me know when you’ve commited your changes, I will try again then.

I committed them yesterday - I’ve not tried a 64-bit plugin, but 64-bit apps are fine.

the previous errors disappeared (but stay as soon as I switch both base sdk & deployment target to 10.5). left are 55 other errors:

juce_AU_Wrapper.mm:1185: error: ‘AudioUnitCarbonViewEventListener’ does not name a type
juce_AU_Wrapper.mm:1227: error: ‘SizeControl’ was not declared in this scope
juce_AU_Wrapper.mm:1229: error: ‘HIViewGetWindow’ was not declared in this scope
juce_AU_Wrapper.mm:1261: error: ‘GetWindowEventTarget’ was not declared in this scope
juce_AU_Wrapper.mm:1326: error: ‘SizeControl’ was not declared in this scope

etc…

ps: the juce demo builds perfectly here in 64bit, too. but why try that when I am specifically telling you that I get 60 errors while compiling an AU ???

Any ideas?