C++ Language Standard: Use Latest compiler/linker errors


#1

FYI:
W. JUCE 5.2

If I select C++ Language Standard Use Latest (c++1z / c++17) in Projucer 5.2.0 then I get the errors below when compiling in

  1. xcode 9.0.1 when compiling for iOS.
  2. Android Studio 3.0 w. gradle 4.1 and the latest tools.

(If I select C++ Language Standard C++14 in Projucer 5.2.0 compilation gives no errors)

Error messages:

  1. xcode 9.0.1 when compiling for Ios:

    Ld /Users/eks/Library/Developer/Xcode/DerivedData/guitarFineTune-blisxzlbojgtgcacchhksmgzacku/Build/Intermediates.noindex/guitarFineTune.build/Release-iphoneos/guitarFineTune\ -\ App.build/Objects-normal/armv7/guitarFineTune normal armv7
    cd /Users/eks/projects/juceProjs/guitarFineTune/Builds/iOS
    export IPHONEOS_DEPLOYMENT_TARGET=8.0
    export PATH=”/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk -L/Users/eks/projects/juceProjs/guitarFineTune/Builds/iOS/build/Release -F/Users/eks/projects/juceProjs/guitarFineTune/Builds/iOS/build/Release -filelist /Users/eks/Library/Developer/Xcode/DerivedData/guitarFineTune-blisxzlbojgtgcacchhksmgzacku/Build/Intermediates.noindex/guitarFineTune.build/Release-iphoneos/guitarFineTune\ -\ App.build/Objects-normal/armv7/guitarFineTune.LinkFileList -miphoneos-version-min=8.0 -dead_strip -fembed-bitcode-marker -stdlib=libc++ -framework Accelerate -framework AudioToolbox -framework AVFoundation -framework CoreAudio -framework CoreAudioKit -framework CoreGraphics -framework CoreImage -framework CoreMIDI -framework CoreText -framework Foundation -framework QuartzCore -framework UIKit -Xlinker -dependency_info -Xlinker /Users/eks/Library/Developer/Xcode/DerivedData/guitarFineTune-blisxzlbojgtgcacchhksmgzacku/Build/Intermediates.noindex/guitarFineTune.build/Release-iphoneos/guitarFineTune\ -\ App.build/Objects-normal/armv7/guitarFineTune_dependency_info.dat -o /Users/eks/Library/Developer/Xcode/DerivedData/guitarFineTune-blisxzlbojgtgcacchhksmgzacku/Build/Intermediates.noindex/guitarFineTune.build/Release-iphoneos/guitarFineTune\ -\ App.build/Objects-normal/armv7/guitarFineTune

Undefined symbols for architecture armv7:
“operator new(unsigned long, std::align_val_t)”, referenced from:
juce::var::VariantType_Method::createCopy(juce::var::ValueUnion&, juce::var::ValueUnion const&) const in lto.o
"operator delete(void*, std::align_val_t)", referenced from:
juce::var::VariantType_Method::cleanUp(juce::var::ValueUnion&) const in lto.o
juce::var::VariantType_Method::createCopy(juce::var::ValueUnion&, juce::var::ValueUnion const&) const in lto.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
"

  1. Android Studio 3.0 w. gradle 4.1 and the latest tools:
    "
    [27/27] Linking CXX shared library …\build\intermediates\cmake\release_\release\obj\x86\libjuce_jni.so
    FAILED: cmd.exe /C “cd . && D:\Users\eks\Library\Android\sdk\ndk-bundle\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=i686-none-linux-android --gcc-toolchain=D:/Users/eks/Library/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64 --sysroot=D:/Users/eks/Library/Android/sdk/ndk-bundle/sysroot -fPIC -isystem D:/Users/eks/Library/Android/sdk/ndk-bundle/sysroot/usr/include/i686-linux-android -D__ANDROID_API__=14 -g -DANDROID -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mstackrealign -Wa,–noexecstack -Wformat -Werror=format-security -std=c++11 -fexceptions -frtti -fsigned-char -std=c++1z -O2 -DNDEBUG -Ofast -Wl,–exclude-libs,libgcc.a --sysroot D:/Users/eks/Library/Android/sdk/ndk-bundle/platforms/android-14/arch-x86 -Wl,–build-id -Wl,–warn-shared-textrel -Wl,–fatal-warnings -LD:/Users/eks/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86 -Wl,–no-undefined -Wl,-z,noexecstack -Qunused-arguments -Wl,-z,relro -Wl,-z,now -shared -Wl,-soname,libjuce_jni.so -o …\build\intermediates\cmake\release_\release\obj\x86\libjuce_jni.so CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/aboutPage.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/displayControlComponent.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/displayControlViewPort.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/eksNotModalProgressWindow.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/eksNotModalProgressWindowCallBacks.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/eksTabbedComponent.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/eksThreadWithProgressWindow.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/guitarFineTuneFirstClass.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/guitarStringSoundsControl.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/Main.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/tuneComponent.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/Source/xmlGuitarFineTuneConfig.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/BinaryData.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_audio_basics.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_audio_devices.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_audio_formats.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_audio_processors.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_audio_utils.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_core.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_data_structures.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_events.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_graphics.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_gui_basics.cpp.o CMakeFiles/juce_jni.dir/D_/projects/juceProjs/guitarFineTune/JuceLibraryCode/include_juce_gui_extra.cpp.o -llog -landroid -lGLESv2 -lEGL libcpufeatures.a -lm “D:/Users/eks/Library/Android/sdk/ndk-bundle/sources/cxx-stl/llvm-libc++/libs/x86/libc++.a” && cd .”
    …/…/…/…/…/…/…/…/JUCE/modules\juce_audio_processors/format/juce_AudioPluginFormat.cpp:193: error: undefined reference to ‘operator new(unsigned int, std::align_val_t)’
    …/…/…/…/…/…/…/…/JUCE/modules\juce_audio_processors/format/juce_AudioPluginFormat.cpp:193: error: undefined reference to ‘operator delete(void*, std::align_val_t)’
    …/…/…/…/…/…/…/…/JUCE/modules\juce_audio_processors/format/juce_AudioPluginFormatManager.cpp:153: error: undefined reference to ‘operator new(unsigned int, std::align_val_t)’
    …/…/…/…/…/…/…/…/JUCE/modules\juce_audio_processors/format/juce_AudioPluginFormatManager.cpp:153: error: undefined reference to ‘operator delete(void*, std::align_val_t)’
    …/…/…/…/…/…/…/…/JUCE/modules\juce_audio_processors/utilities/juce_AudioProcessorParameters.cpp:59: error: undefined reference to ‘operator delete(void*, std::align_val_t)’
    …/…/…/…/…/…/…/…/JUCE/modules\juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp:199: error: undefined reference to ‘operator new(unsigned int, std::align_val_t)’
    …/…/…/…/…/…/…/…/JUCE/modules\juce_audio_processors/utilities/juce_AudioProcessorValueTreeState.cpp:199: error: undefined reference to ‘operator delete(void*, std::align_val_t)’
    …/…/…/…/…/…/…/…/JUCE/modules\juce_core/containers/juce_Variant.cpp:452: error: undefined reference to 'operator new(unsigned int, std::align_val_t)'
    clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.
    "

Kind Regards
Eigil


#2

Haven’t tried Android, but I can’t reproduce that when building the juce demo for iOS… Does it only go wrong with your own project?

It’s an odd error, as the code is fine, and it seems to be complaining about a missing destructor. Does it go away if you add a destructor declaration to the var::VariantType_Method class, i.e.

~VariantType_Method() noexcept {}

?


#3

It also goes wrong with the JUCE 5.2 Demo for iOS, But ONLY if I Archive (=Build for Release), not if I Build for Debug.

~VariantType_Method() noexcept {} Did not help.


Eigil


#4

It’s possible to use C++1z if you set the iOS deployment target to 11.0


#5

Yeah, I tried that and it works fine for me. Same version of Xcode etc. Are you sure you didn’t just accidentally type into a source file or something?


#6

You are right about iOS 11.0!!

Kind Regards
Eigil


#7

Hi @eigilS,

Unfortunately, this is a known android bug. You’ll need to download the latest beta (r16) of the NDK to fix this bug.

If you are using Android Studio you’ll need to temporarily switch to the canary branch:

click “apply”, and then in “Android SDK”, update to the latest NDK version

Then make sure to switch back to the stable branch! Even after switching to the stable branch, the NDK version will remain r16.


#8

Right now it builds.

Just one more thing. I get this message independent of the c++ language standard:
“Error:All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

I can fix it by inserting this line in Builds\Android\app\build.gradle:
flavorDimensions “xxx”

Kind Regards
Eigil


#9

Yes this is with android studio 3.0. We have a fix for Android 3.0 on a branch which is perfectly well tested and ready to go out. We are just waiting on Google to fix one slightly super, annoying bug:

Once this is fixed we will push out Android Studio 3.0 support to develop.


#10

OK. Google has fixed this bug now! Android Studio 3.0 is now supported on develop with commits 00d7938 and 1cb3511.


#11

Great, thanks @fabian!
Projects generated with Projucer from development now satisfies the named flavor dimension requirement!
(at first I thought it was not from projucer, as I also named it “default” in my patch :slight_smile: )