Hello,
I submitted this through the Cycling 74 support, and they asked me to also post this here.
I’m struggling to get RNBO plugins to properly compile for Unity Android. I’ve been able to compile for Mac and PC (on respective platforms) but am unable to compile the same patches for Unity Android. I’ve been following along with the github docs but keep running into the same issue where it appears as though all of the files are created properly in the initial step, but then when building I get a number of errors that appear to be related to the RNBOWrapper.cpp. I’ve included the output errors below, which hopefully you can make sense of. I also fully understand that this repo is still in an experimental stage, so mainly want to draw attention to the issues and see if there is a current solution, or if perhaps there was some issue with my approach.
Thanks!
steps : Following the build steps on the RNBO Unity Audio Plugin repo, specifically for Android building
notes : This is console output, including the commands I inputted to start the build process:
PS E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build> cmake .. -DANDROID_ABI=arm64-v8a -DCMAKE_TOOLCHAIN_FILE="C:\Program Files\Unity\Hub\Editor\2022.2.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\build\cmake\android.toolchain.cmake" -DPLUGIN_NAME="MyChorus" -DANDROID_PLATFORM=29 -DPLUGIN_UNITY_PLATFORM_NAME=Android
-- Building for: Visual Studio 17 2022
-- Android: Targeting API '29' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The CXX compiler identification is unknown
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Unity/Hub/Editor/2022.2.0f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
-- building for Android with bit depth 64 for CPU ARM64
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done (3.2s)
-- Generating done (0.0s)
-- Build files have been written to: E:/Repos/RNBO Unity Plugins/RNBO Build SRC/build
PS E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build> cmake --build .
MSBuild version 17.5.0+6f08c67f3 for .NET Framework
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk
ANT_HOME=
JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08
NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c
Checking Build System
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk
ANT_HOME=
JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08
NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c
Building Custom Rule E:/Repos/RNBO Unity Plugins/RNBO Build SRC/CMakeLists.txt
RNBOWrapper.cpp
In file included from :380:
(1,9): warning : 'ANDROID_API' macro redefined [-Wmacro-redefined] [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
#define ANDROID_API 29
^
(370,9): note: previous definition is here
#define ANDROID_API ANDROID_MIN_SDK_VERSION
^
In file included from E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp:7:
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\export\rnbo\src\3rdparty\readerwriterqueue/readerwriterqueue.h(93,6): error : cannot use 'throw' with exceptions disabled [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\R
NBOUnityPlugin.vcxproj]
throw std::bad_alloc();
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\export\rnbo\src\3rdparty\readerwriterqueue/readerwriterqueue.h(108,5): error : cannot use 'throw' with exceptions disabled [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build
RNBOUnityPlugin.vcxproj]
throw std::bad_alloc();
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(22,23): error : no type named 'shared_mutex' in namespace 'std'; did you mean 'timed_mutex'? [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityP
lugin.vcxproj]
using rw_mutex = std::shared_mutex;
timed_mutex
C:\\Microsoft\AndroidNDK\android-ndk-r23c\sources\cxx-stl\llvm-libc++\include\mutex(235,24): note: 'timed_mutex' declared here
class _LIBCPP_TYPE_VIS timed_mutex
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(23,42): error : no template named 'shared_mutex' in namespace 'std'; did you mean 'shared_ptr'? [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUni
tyPlugin.vcxproj]
using write_lock = std::unique_lock<std::shared_mutex>;
~~~~~^~~~~~~~~~~~
shared_ptr
C:\\Microsoft\AndroidNDK\android-ndk-r23c\sources\cxx-stl\llvm-libc++\include\memory(3698,28): note: 'shared_ptr' declared here
class _LIBCPP_TEMPLATE_VIS shared_ptr
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(23,42): error : use of class template 'std::shared_ptr' requires template arguments [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcx
proj]
using write_lock = std::unique_lock<std::shared_mutex>;
^
C:\\Microsoft\AndroidNDK\android-ndk-r23c\sources\cxx-stl\llvm-libc++\include\memory(3698,28): note: template is declared here
class _LIBCPP_TEMPLATE_VIS shared_ptr
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(24,24): error : no template named 'shared_lock' in namespace 'std' [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
using read_lock = std::shared_lock<std::shared_mutex>;
~~~~~^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(24,41): error : no template named 'shared_mutex' in namespace 'std'; did you mean 'shared_ptr'? [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUni
tyPlugin.vcxproj]
using read_lock = std::shared_lock<std::shared_mutex>;
~~~~~^~~~~~~~~~~~
shared_ptr
C:\\Microsoft\AndroidNDK\android-ndk-r23c\sources\cxx-stl\llvm-libc++\include\memory(3698,28): note: 'shared_ptr' declared here
class _LIBCPP_TEMPLATE_VIS shared_ptr
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(246,33): error : copying variable of type 'std::atomic<Callback *>' invokes deleted constructor [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUni
tyPlugin.vcxproj]
static std::atomic<Callback *> globalTransportCallback = nullptr;
^ ~~~~~~~
C:\\Microsoft\AndroidNDK\android-ndk-r23c\sources\cxx-stl\llvm-libc++\include\atomic(1774,7): note: copy constructor of 'atomic<(anonymous namespace)::Callback *>' is implicitly deleted because base class '__atomic
_base<(anonymous namespace)::Callback *>' has a deleted copy constructor
: public __atomic_base<_Tp*>
^
C:\\Microsoft\AndroidNDK\android-ndk-r23c\sources\cxx-stl\llvm-libc++\include\atomic(1649,5): note: '__atomic_base' has been explicitly marked deleted here
__atomic_base(const __atomic_base&) = delete;
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(254,49): error : copying member subobject of type 'std::atomic<Callback *>' invokes deleted constructor [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build
\RNBOUnityPlugin.vcxproj]
std::atomic<Callback *> mTransportCallback = nullptr;
^~~~~~~
C:\\Microsoft\AndroidNDK\android-ndk-r23c\sources\cxx-stl\llvm-libc++\include\atomic(1774,7): note: copy constructor of 'atomic<(anonymous namespace)::Callback *>' is implicitly deleted because base class '__atomic
_base<(anonymous namespace)::Callback *>' has a deleted copy constructor
: public __atomic_base<_Tp*>
^
C:\\Microsoft\AndroidNDK\android-ndk-r23c\sources\cxx-stl\llvm-libc++\include\atomic(1649,5): note: '__atomic_base' has been explicitly marked deleted here
__atomic_base(const __atomic_base&) = delete;
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(373,5): error : unknown type name 'write_lock' [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
write_lock wlock(instances_mutex);
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(409,4): error : unknown type name 'write_lock' [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
write_lock wlock(instances_mutex);
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(508,3): error : use of undeclared identifier 'read_lock'; did you mean 'realloc'? [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxpr
oj]
read_lock rlock(RNBOUnity::instances_mutex);
^~~~~~~~~
realloc
C:\\Microsoft\AndroidNDK\android-ndk-r23c\toolchains\llvm\prebuilt\windows-x86_64\sysroot\usr\include\malloc.h(61,7): note: 'realloc' declared here
void* realloc(void* __ptr, size_t __byte_count) __BIONIC_ALLOC_SIZE(2) __wur;
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(508,12): error : expected ';' after expression [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
read_lock rlock(RNBOUnity::instances_mutex);
^
;
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(508,3): warning : expression result unused [-Wunused-value] [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
read_lock rlock(RNBOUnity::instances_mutex);
^~~~~~~~~
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(508,13): error : use of undeclared identifier 'rlock' [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
read_lock rlock(RNBOUnity::instances_mutex);
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(525,2): error : unknown type name 'write_lock' [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
write_lock wlock(RNBOUnity::instances_mutex);
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(549,2): error : unknown type name 'write_lock' [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
write_lock wlock(RNBOUnity::instances_mutex);
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(581,7): error : use of class template 'std::lock_guard' requires template arguments [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcx
proj]
std::lock_guard guard(localmutex);
^
C:\\Microsoft\AndroidNDK\android-ndk-r23c\sources\cxx-stl\llvm-libc++\include\__mutex_base(80,1): note: template is declared here
lock_guard
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(587,3): error : cannot use 'try' with exceptions disabled [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
try {
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(625,4): error : cannot use 'try' with exceptions disabled [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
try {
^
CLANGCOMPILE : fatal error : too many errors emitted, stopping now [-ferror-limit=] [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
2 warnings and 20 errors generated.
system : Windows 10, Dell G5 Desktop, MaxMSP 8.5.4
expected : Should produce an arm64 android plugin for Unity
actual : Several errors are thrown in relation to eh RNBOWrapper.cpp (included below)
Hello,
I submitted this through the Cycling 74 support, and they asked me to also post this here.
I’m struggling to get RNBO plugins to properly compile for Unity Android. I’ve been able to compile for Mac and PC (on respective platforms) but am unable to compile the same patches for Unity Android. I’ve been following along with the github docs but keep running into the same issue where it appears as though all of the files are created properly in the initial step, but then when building I get a number of errors that appear to be related to the RNBOWrapper.cpp. I’ve included the output errors below, which hopefully you can make sense of. I also fully understand that this repo is still in an experimental stage, so mainly want to draw attention to the issues and see if there is a current solution, or if perhaps there was some issue with my approach.
Thanks!
steps : Following the build steps on the RNBO Unity Audio Plugin repo, specifically for Android building
notes : This is console output, including the commands I inputted to start the build process:
PS E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build> cmake .. -DANDROID_ABI=arm64-v8a -DCMAKE_TOOLCHAIN_FILE="C:\Program Files\Unity\Hub\Editor\2022.2.0f1\Editor\Data\PlaybackEngines\AndroidPlayer\NDK\build\cmake\android.toolchain.cmake" -DPLUGIN_NAME="MyChorus" -DANDROID_PLATFORM=29 -DPLUGIN_UNITY_PLATFORM_NAME=Android
-- Building for: Visual Studio 17 2022
-- Android: Targeting API '29' with architecture 'arm64', ABI 'arm64-v8a', and processor 'aarch64'
-- Android: Selected unified Clang toolchain
-- The CXX compiler identification is unknown
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Unity/Hub/Editor/2022.2.0f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe - skipped
-- building for Android with bit depth 64 for CPU ARM64
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done (3.2s)
-- Generating done (0.0s)
-- Build files have been written to: E:/Repos/RNBO Unity Plugins/RNBO Build SRC/build
PS E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build> cmake --build .
MSBuild version 17.5.0+6f08c67f3 for .NET Framework
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk
ANT_HOME=
JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08
NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c
Checking Build System
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk
ANT_HOME=
JAVA_HOME=C:\Program Files\Android\jdk\jdk-8.0.302.8-hotspot\jdk8u302-b08
NDK_ROOT=C:\Microsoft\AndroidNDK\android-ndk-r23c
Building Custom Rule E:/Repos/RNBO Unity Plugins/RNBO Build SRC/CMakeLists.txt
RNBOWrapper.cpp
In file included from :380:
(1,9): warning : 'ANDROID_API' macro redefined [-Wmacro-redefined] [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityPlugin.vcxproj]
#define ANDROID_API 29
^
(370,9): note: previous definition is here
#define ANDROID_API ANDROID_MIN_SDK_VERSION
^
In file included from E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp:7:
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\export\rnbo\src\3rdparty\readerwriterqueue/readerwriterqueue.h(93,6): error : cannot use 'throw' with exceptions disabled [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\R
NBOUnityPlugin.vcxproj]
throw std::bad_alloc();
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\export\rnbo\src\3rdparty\readerwriterqueue/readerwriterqueue.h(108,5): error : cannot use 'throw' with exceptions disabled [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build
RNBOUnityPlugin.vcxproj]
throw std::bad_alloc();
^
E:\Repos\RNBO Unity Plugins\RNBO Build SRC\src\RNBOWrapper.cpp(22,23): error : no type named 'shared_mutex' in namespace 'std'; did you mean 'timed_mutex'? [E:\Repos\RNBO Unity Plugins\RNBO Build SRC\build\RNBOUnityP
lugin.vcxproj]
using rw_mutex = std::shared_mutex;