SDK 3.6.7 and XCode 6 Issues/Errors/Fixes

SDK for VST 3 audio plug-in and host development.
Post Reply
willpirkle
Posts: 67
Joined: Tue Jun 21, 2016 12:53 pm

SDK 3.6.7 and XCode 6 Issues/Errors/Fixes

Post by willpirkle »

I'm having multiple issues with the SDK3.6.7 + XCode 6 on MacOS. This includes a failure with xcodebuild (after CMake) as well as multiple failures in XCode. I was able to fix the issues and get a complete build, but I wanted to make sure the steps I took are OK, as well as detail the errors/fixes for others with XCode 6.

My setup for MacOS is:

MacOS: 10.9.5
XCode: 6.2
CMake: 3.7.2

Running CMake works properly.

However, running xcodebuild fails:

/Users/willpirkle/Documents/VST367/VST3_SDK/public.sdk/source/vst/hosting/module_mac.mm:244:19: error:
static_cast from 'CFURLRef' (aka 'const __CFURL *') to 'NSURL *' is not
allowed
auto bundleUrl = static_cast<NSURL*> (CFBundleCopyBundleURL (bundle));
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


This causes the ALL_BUILD to fail as well as trying individual projects (again or noteexpressionsynth)

It fails due to the above code in module_mac.mm:

void getApplicationModules (Module::PathList& result)
{
auto bundle = CFBundleGetMainBundle ();
if (!bundle)
return;
auto bundleUrl = static_cast<NSURL*> (CFBundleCopyBundleURL (bundle));

I can fix this by changing the offending line of code and removing the cast:

auto bundleUrl = (CFBundleCopyBundleURL (bundle));

However, this generates a warning on code a few lines down:

auto resUrl = [bundleUrl URLByAppendingPathComponent:@"Contents"];

The warning is:

/Users/willpirkle/Documents/VST367/VST3_SDK/public.sdk/source/vst/hosting/module_mac.mm:249:17: Receiver type 'const __CFURL *' is not 'id' or interface pointer, consider casting it to 'id'

Just want to check and make sure this is OK to do.

ALL_BUILD failure #2:

Trying ALL_BUILD again, it fails due to problems in the editorhost/Source Files/window.mm file

There are 3 failures, all the same, with the following functions:
- (NSSize)windowWillResize:(nonnull NSWindow*)sender toSize:(NSSize)frameSize
- (void)windowDidResize:(nonnull NSNotification*)notification
- (void)windowWillClose:(nonnull NSNotification*)notification

The problem is with the nonnull specifier and the Error message is "Expected a type"

This is fixed by adding this define to the top of the file:

#if !defined(__clang_major__) || __clang_major__ < 7
#define nonnull
#endif

Trying ALL_BUILD again results in another error, this time in editorhost/Source Files/platform.mm

void Platform::quit ()
{
if (quitRequested)
return;
quitRequested = true;

dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t) (0.1 * NSEC_PER_SEC)),
dispatch_get_main_queue (), ^{
@autoreleasepool
{
for (NSWindow* window in NSApp.windows) <--- ERROR HERE
[window close];
}

application = nullptr;
[NSApp terminate:nil];
});
}

This is fixed by using (older) Objective C nomenclature:

for (NSWindow* window in [NSApp windows] )
[window close];


So, with the above modifications, I can get the vstsdk project to compile in XCode 6. If these modifications are going to cause issues, please let me know. Otherwise, I hope this helps others with XCode 6.

One thing to note: the Products in XCode are all in red font, as if they are not available. However, they are found in the ../VST3_SDK/build/VST3/Debug and ../VST3_SDK/build/bin/Debug folders (or Release, if compiling for that).

-- Will

User avatar
ygrabit
Posts: 179
Joined: Fri Jun 17, 2016 7:52 am
Location: Hamburg
Contact:

Re: SDK 3.6.7 and XCode 6 Issues/Errors/Fixes

Post by ygrabit »

did you try this? (not test it here...)

NSURL* bundleUrl = CFBundleCopyBundleURL (bundle);

without auto...
YVan Grabit

willpirkle
Posts: 67
Joined: Tue Jun 21, 2016 12:53 pm

Re: SDK 3.6.7 and XCode 6 Issues/Errors/Fixes

Post by willpirkle »

Hi YVan

That does not work, however this does (also) compile:

CFURLRef bundleUrl = CFBundleCopyBundleURL (bundle);

The warning that is generated a few lines below can be removed by casting the CFURLRef as id:

auto resUrl = [(id)bundleUrl URLByAppendingPathComponent:@"Contents"];

Best,

- Will

Arne Scheffler
Posts: 383
Joined: Mon Jun 20, 2016 7:53 am

Re: SDK 3.6.7 and XCode 6 Issues/Errors/Fixes

Post by Arne Scheffler »

Hi Will,
the new editorhost is c++11 only.
Never the less your fixes seems to be working fine.

Cheers
Arne

willpirkle
Posts: 67
Joined: Tue Jun 21, 2016 12:53 pm

Re: SDK 3.6.7 and XCode 6 Issues/Errors/Fixes

Post by willpirkle »

Hi Arne

Thanks for the reply - I forgot to mention that I did set the editorhost project to C++11. I am thinking this is XCode6 related.
Screen Shot 2017-03-23 at 8.55.27 AM.png
- Will
You do not have the required permissions to view the files attached to this post.

Arne Scheffler
Posts: 383
Joined: Mon Jun 20, 2016 7:53 am

Re: SDK 3.6.7 and XCode 6 Issues/Errors/Fixes

Post by Arne Scheffler »

Ah, then it's the new Obj-C syntax which is not available in clang of Xcode 6.

willpirkle
Posts: 67
Joined: Tue Jun 21, 2016 12:53 pm

Re: SDK 3.6.7 and XCode 6 Issues/Errors/Fixes

Post by willpirkle »

That makes sense - ugh - now I need to get a new Mac... :(

Post Reply