Hey all. I’m getting an error when building my iOS project, but only in specific circumstances. Specifically, if I build in Debug or Release for the Simulator (running iOS 11), I have no problems. If I build in Debug mode for my iPhone SE (iOS 11), no problems. If I build in Release mode for my iPhone SE, I get the following build error:
Aligned allocation function of type 'void *(std::size_t, std::align_val_t)' is only available on iOS 11 or newer.
and Aligned deallocation function of type 'void (void *, std::align_val_t) noexcept' is only available on iOS 11 or newer.
Coming from the following block in juce_Singleton.h:
Type* getWithoutChecking()
{
if (instance == nullptr)
{
auto newObject = new Type(); // I think it's the `new` right here causing the problem
instance = newObject;
}
return instance;
}
I can get around the problem and successfully build in Release mode for my device if I set the iOS Deployment Target option in Projucer to 11.0 for my Release configuration, but I find it interesting that this is only happening when I try to build for my device, and not when I build for Simulator. Also, ideally, I would like to support more than iOS 11+.
What are my options here? Is this a bugfix in JUCE? Or a constraint on my end that I just have to deal with? Thanks!
This problem is solved for me when I manually change the target to iOS 11 in Xcode. however, it makes me wonder how I’m supposed to target devices that don’t have iOS 11 installed yet.
I had to tell ProJucer to use C++17, LLVM libc++. the folks in #iphonedev on FreeNode said its because aligned allocation is a new thing in c++17, so it’s understandable that there is minimal hardware support, especially on iOS.