Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
738 stars 186 forks source link

[BUG]: EntryPointNotFoundException on MacOS #993

Closed noxowl closed 8 months ago

noxowl commented 8 months ago

Package version

Others

Environment

* OS: MacOS Ventura 13.4.1
* Unity version: Unity 2022.3.8.f1

Steps To Reproduce

  1. Manual build and put 74627ff217019b11936c2eba016f876276b52d33 or 17cbc6e2f93c2f81ea29e61d86af4c86a6db4c4d
  2. Execute new RTCPeerConnection();

Current Behavior

We are currently developing a WebRTC application for research that allows connection between Android(Magic Leap 2, Generic android phone for test) devices and PCs (Macs).

Due to issues with ML2 devices, all clients except those in the server role use the plugin we build manually from the latest commit in this repository.

We used 74627ff217019b11936c2eba016f876276b52d33 as the currently available pre6 is not available for android devices, and confirmed that it works on ML2 and android phones (but green frames on android phones, sometimes normal frames)

However, the above commit doesn't work on Mac, so using pre6 and 0b3447258313fbe6e4a21c3ddb1f30c8ad9e71ed will work fine, but not on Android devices.

ML2 devices use a separate repository, so this hasn't been a problem yet, but for use on test devices, we're swapping between the two binaries to match environments.

The error log is below.

EntryPointNotFoundException: DataChannelRegisterOnError assembly:<unknown assembly> type:<unknown type> member:(null)
Unity.WebRTC.Context.DataChannelRegisterOnError (System.IntPtr channel, Unity.WebRTC.DelegateNativeOnError callback) (at Assets/WebRTC-74627ff/Runtime/Scripts/Context.cs:271)
Unity.WebRTC.RTCDataChannel..ctor (System.IntPtr ptr, Unity.WebRTC.RTCPeerConnection peerConnection) (at Assets/WebRTC-74627ff/Runtime/Scripts/RTCDataChannel.cs:251)
Unity.WebRTC.RTCPeerConnection.CreateDataChannel (System.String label, Unity.WebRTC.RTCDataChannelInit options) (at Assets/WebRTC-74627ff/Runtime/Scripts/RTCPeerConnection.cs:645)
O2M.AppleCider.Network.WebRTC.WebRtcPeer.InitPeer (Unity.WebRTC.RTCConfiguration& configuration, System.Int32 id) (at Assets/Scripts/Network/WebRTC/WebRtcPeer.cs:38)
O2M.AppleCider.Network.WebRTC.WebRtcConnector.GeneratePeer (System.Int32 referenceId) (at Assets/Scripts/Network/WebRTC/WebRtcConnector.cs:337)
O2M.AppleCider.Network.WebRTC.WebRtcConnector+<>c__DisplayClass27_0.<StartNewConnection>b__2 (System.Boolean _) (at Assets/Scripts/Network/WebRTC/WebRtcConnector.cs:302)
UniRx.Observer+Subscribe`1[T].OnNext (T value) (at Assets/Plugins/UniRx/Scripts/Observer.cs:165)
UniRx.Operators.WhereObservable`1+Where[T].OnNext (T value) (at Assets/Plugins/UniRx/Scripts/Operators/Where.cs:90)
UniRx.Operators.FromMicroCoroutineObservable`1+FromMicroCoroutine[T].OnNext (T value) (at Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs:124)
UniRx.ObserveExtensions+<>c__DisplayClass2_1`2[TSource,TProperty].<ObserveEveryValueChanged>b__1 (System.IObserver`1[T] observer, System.Threading.CancellationToken cancellationToken) (at Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObserveExtensions.cs:102)
UniRx.Operators.FromMicroCoroutineObservable`1[T].SubscribeCore (System.IObserver`1[T] observer, System.IDisposable cancel) (at Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs:94)
UniRx.Operators.OperatorObservableBase`1[T].Subscribe (System.IObserver`1[T] observer) (at Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs:34)
UniRx.Operators.WhereObservable`1[T].SubscribeCore (System.IObserver`1[T] observer, System.IDisposable cancel) (at Assets/Plugins/UniRx/Scripts/Operators/Where.cs:57)
UniRx.Operators.OperatorObservableBase`1[T].Subscribe (System.IObserver`1[T] observer) (at Assets/Plugins/UniRx/Scripts/Operators/OperatorObservableBase.cs:34)
UniRx.ObservableExtensions.Subscribe[T] (System.IObservable`1[T] source, System.Action`1[T] onNext) (at Assets/Plugins/UniRx/Scripts/Observer.cs:414)
O2M.AppleCider.Network.WebRTC.WebRtcConnector.StartNewConnection (System.Int32 referenceId) (at Assets/Scripts/Network/WebRTC/WebRtcConnector.cs:298)
O2M.AppleCider.Network.WebRTC.WebRtcConnector.<Start>b__25_3 (O2M.AppleCider.Network.IO2MMessage message) (at Assets/Scripts/Network/WebRTC/WebRtcConnector.cs:112)
UniRx.Observer+Subscribe`1[T].OnNext (T value) (at Assets/Plugins/UniRx/Scripts/Observer.cs:165)
UniRx.Subject`1[T].OnNext (T value) (at Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs:62)
O2M.AppleCider.Network.WorkerNetworkManager.OnDataHandler (O2M.AppleCider.Network.IO2MMessage message, System.Int32 connectionId) (at Assets/Scripts/Network/Worker/WorkerNetworkManager.cs:117)
O2M.AppleCider.Network.CommonNetworkManager.OnData (System.ArraySegment`1[T] data, System.Int32 connectionId) (at Assets/Scripts/Network/CommonNetworkManager.cs:33)
O2M.AppleCider.Network.WorkerNetworkManager.<Awake>b__18_0 (System.ArraySegment`1[T] data) (at Assets/Scripts/Network/Worker/WorkerNetworkManager.cs:45)
Telepathy.Client.Tick (System.Int32 processLimit, System.Func`1[TResult] checkEnabled) (at Assets/Telepathy/Client.cs:342)
O2M.AppleCider.Network.WorkerNetworkManager.<Awake>b__18_1 (UniRx.Unit _) (at Assets/Scripts/Network/Worker/WorkerNetworkManager.cs:46)
UniRx.Observer+Subscribe`1[T].OnNext (T value) (at Assets/Plugins/UniRx/Scripts/Observer.cs:165)
UniRx.Subject`1[T].OnNext (T value) (at Assets/Plugins/UniRx/Scripts/Subjects/Subject.cs:62)
UniRx.Triggers.ObservableUpdateTrigger.Update () (at Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Triggers/ObservableUpdateTrigger.cs:14)

Expected Behavior

No EntryPointNotFoundException on Execute new RTCPeerConnection();

Anything else?

When we build on OSX, we build with CMAKE_OSX_DEPLOYMENT_TARGET to 10.13 (in Plugin~/CMakeLists.txt) and target_sources (WebRTCLib PRIVATE ../libcxx/debug.cpp) commented out(in Plugin~/WebRTCPlugin/CMakeLists.txt) due to a minor error.

Also, below is a crash log when using 0b3447258313fbe6e4a21c3ddb1f30c8ad9e71ed on an Android phone. (The test Android phone is a ZTE 901ZT, Android 10.) (Do I need to create a separate issue ticket for this as well? This is not a problem with ML2.)

10-13 16:17:51.626 14223 14642 E CRASH   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-13 16:17:51.626 14223 14642 E CRASH   : Version '2022.3.8f1 (b5eafc012955)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
10-13 16:17:51.626 14223 14642 E CRASH   : Build fingerprint: 'Ymobile/P450A01/P450A01:10/QKQ1.200517.002/20211012.161058:user/release-keys'
10-13 16:17:51.626 14223 14642 E CRASH   : Revision: '0'
10-13 16:17:51.626 14223 14642 E CRASH   : ABI: 'arm64'
10-13 16:17:51.626 14223 14642 E CRASH   : Timestamp: 2023-10-13 16:17:51.626162866+0900
10-13 16:17:51.626 14223 14642 E CRASH   : pid: 14223, tid: 14642, name: EncoderQueue  >>> jp.ac.jaist.yuizonolab.o2mtestworker <<<
10-13 16:17:51.626 14223 14642 E CRASH   : uid: 10005
10-13 16:17:51.626 14223 14642 E CRASH   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr --------
10-13 16:17:51.626 14223 14642 E CRASH   : Cause: null pointer dereference
10-13 16:17:51.626 14223 14642 E CRASH   :     x0  0000000000000000  x1  0000007c86781d48  x2  0000007c866b5de0  x3  0000000000000000
10-13 16:17:51.626 14223 14642 E CRASH   :     x4  0000000000000000  x5  0000000000000009  x6  0000000000000002  x7  747865745f565559
10-13 16:17:51.626 14223 14642 E CRASH   :     x8  0000000000000002  x9  0000007b102e3d18  x10 0000000000000001  x11 0000000000000000
10-13 16:17:51.626 14223 14642 E CRASH   :     x12 0000000000000000  x13 0000000000000000  x14 0000000000000000  x15 00000000b1f824fe
10-13 16:17:51.626 14223 14642 E CRASH   :     x16 0000007b48d449e0  x17 0000007d227d6928  x18 0000007ae5148000  x19 0000007c902af3c0
10-13 16:17:51.626 14223 14642 E CRASH   :     x20 0000007aeedc23a0  x21 0000007aeee10300  x22 0000007aea996150  x23 0000007aea997020
10-13 16:17:51.626 14223 14642 E CRASH   :     x24 0000000000000001  x25 0000000000000038  x26 0000000000000001  x27 0000000000000001
10-13 16:17:51.626 14223 14642 E CRASH   :     x28 0000007aea996158  x29 0000007aea996080
10-13 16:17:51.626 14223 14642 E CRASH   :     lr  0000007b4854298c  sp  0000007aea996080  pc  0000007b4854298c  pst 0000000020000000
10-13 16:17:51.626 14223 14642 E CRASH   :
10-13 16:17:51.626 14223 14642 E CRASH   : backtrace:
10-13 16:17:51.626 14223 14642 E CRASH   :       #00 pc 000000000057b98c  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (webrtc::(anonymous namespace)::SetRawImagePlanes(vpx_image*, webrtc::VideoFrameBuffer*)+72)
10-13 16:17:51.626 14223 14642 E CRASH   :       #01 pc 000000000057aab8  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (webrtc::LibvpxVp8Encoder::PrepareBuffers(rtc::scoped_refptr<webrtc::VideoFrameBuffer>)+692)
10-13 16:17:51.626 14223 14642 E CRASH   :       #02 pc 000000000057a504  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (webrtc::LibvpxVp8Encoder::Encode(webrtc::VideoFrame const&, std::__ndk1::vector<webrtc::VideoFrameType, std::__ndk1::allocator<webrtc::VideoFrameType> > const*)+656)
10-13 16:17:51.626 14223 14642 E CRASH   :       #03 pc 000000000012a3cc  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (unity::webrtc::UnityVideoEncoder::Encode(webrtc::VideoFrame const&, std::__ndk1::vector<webrtc::VideoFrameType, std::__ndk1::allocator<webrtc::VideoFrameType> > const*)+84)
10-13 16:17:51.626 14223 14642 E CRASH   :       #04 pc 00000000005481d0  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (webrtc::VideoStreamEncoder::EncodeVideoFrame(webrtc::VideoFrame const&, long)+1676)
10-13 16:17:51.626 14223 14642 E CRASH   :       #05 pc 0000000000549398  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (webrtc::VideoStreamEncoder::OnBitrateUpdated(webrtc::DataRate, webrtc::DataRate, webrtc::DataRate, unsigned char, long, double)+960)
10-13 16:17:51.626 14223 14642 E CRASH   :       #06 pc 00000000003685ac  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (webrtc::(anonymous namespace)::TaskQueueLibevent::OnWakeup(int, short, void*)+240)
10-13 16:17:51.626 14223 14642 E CRASH   :       #07 pc 000000000036a318  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (event_base_loop+1176)
10-13 16:17:51.626 14223 14642 E CRASH   :       #08 pc 0000000000368e1c  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (std::__ndk1::__function::__func<webrtc::(anonymous namespace)::TaskQueueLibevent::TaskQueueLibevent(std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, rtc::ThreadPriority)::$_0, std::__ndk1::allocator<webrtc::(anonymous namespace)::TaskQueueLibevent::TaskQueueLibevent(std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, rtc::ThreadPriority)::$_0>, void ()>::operator()()+76)
10-13 16:17:51.626 14223 14642 E CRASH   :       #09 pc 000000000040e048  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (std::__ndk1::__function::__func<rtc::PlatformThread::SpawnThread(std::__ndk1::function<void ()>, std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, rtc::ThreadAttributes, bool)::$_0, std::__ndk1::allocator<rtc::PlatformThread::SpawnThread(std::__ndk1::function<void ()>, std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, rtc::ThreadAttributes, bool)::$_0>, void ()>::operator()()+220)
10-13 16:17:51.626 14223 14642 E CRASH   :       #10 pc 000000000040de50  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-3FTwvCfPs2HVUajANL-D0Q==/lib/arm64/libwebrtc.so (rtc::(anonymous namespace)::RunPlatformThread(void*)+20)
10-13 16:17:51.626 14223 14642 E CRASH   :       #11 pc 00000000000e6900  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36) (BuildId: 596462ba33c607448e0776eb2ca6d48e)
10-13 16:17:51.627 14223 14642 E CRASH   :       #12 pc 0000000000084b6c  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 596462ba33c607448e0776eb2ca6d48e)
karasusan commented 8 months ago

@noxowl Please try this package. This package is built by 0b34472.

noxowl commented 8 months ago

@karasusan Thank you for your quick response. We have confirmed that it works fine on MacOS and ML2 devices, but the crash on the ZTE 901ZT device is the same. Would you recommend creating a new ticket for this issue?

karasusan commented 8 months ago

@noxowl Thanks for checking. We have already recognized the crash issue which is occurred on several Android devices. I would like to ask a question about the project settings. Which graphics api are you using? gles3 or vulkan?

noxowl commented 8 months ago

@karasusan We are using Vulkan on ML2, and GLES3 on Android phones. We've also found that selecting Vulkan or Auto on the Android phone doesn't run at all. The codecs used are all fixed to VP8.

karasusan commented 8 months ago

@noxowl Thanks. Is it a crash on Android when selecting Vulkan?

noxowl commented 8 months ago

@karasusan I don't know if it's just a problem with this model, but when I run a build with Vulkan selected, it crashes immediately. However, when using 0b3447258313fbe6e4a21c3ddb1f30c8ad9e71ed with GLES3, it crashes after WebRTC initialisation.

The log attached above is the crash when using 0b3447258313fbe6e4a21c3ddb1f30c8ad9e71ed and it is with GLES3. When using 74627ff217019b11936c2eba016f876276b52d33 with GLES3, it sends a green frame and does not crash. I don't know about crash logs when it's Vulkan because I don't collect it, but I'd be happy to grab and attach it if you need them for troubleshooting.

noxowl commented 8 months ago

@karasusan I tried the Vulkan build with pre7 that you provided before. The immediate termination issue that existed previously does not appear to be reproduced. Hopefully this will help us solve our problem.

10-16 15:23:40.802 11519 11596 E CRASH   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-16 15:23:40.802 11519 11596 E CRASH   : Version '2022.3.8f1 (b5eafc012955)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
10-16 15:23:40.802 11519 11596 E CRASH   : Build fingerprint: 'Ymobile/P450A01/P450A01:10/QKQ1.200517.002/20211012.161058:user/release-keys'
10-16 15:23:40.803 11519 11596 E CRASH   : Revision: '0'
10-16 15:23:40.803 11519 11596 E CRASH   : ABI: 'arm64'
10-16 15:23:40.803 11519 11596 E CRASH   : Timestamp: 2023-10-16 15:23:40.803021427+0900
10-16 15:23:40.803 11519 11596 E CRASH   : pid: 11519, tid: 11596, name: UnityGfxDeviceW  >>> jp.ac.jaist.yuizonolab.o2mtestworker <<<
10-16 15:23:40.803 11519 11596 E CRASH   : uid: 10005
10-16 15:23:40.803 11519 11596 E CRASH   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr --------
10-16 15:23:40.803 11519 11596 E CRASH   : Cause: null pointer dereference
10-16 15:23:40.803 11519 11596 E CRASH   :     x0  0000007c38861880  x1  0000000000000000  x2  0000007b70557880  x3  0000000000000020
10-16 15:23:40.803 11519 11596 E CRASH   :     x4  0000000000000001  x5  0000000000000008  x6  0000007c90b0dec0  x7  00000000840080d2
10-16 15:23:40.803 11519 11596 E CRASH   :     x8  0000000000000000  x9  0000007b47add9d4  x10 0000000000000000  x11 0000007b95182d04
10-16 15:23:40.803 11519 11596 E CRASH   :     x12 0000000000000000  x13 0000007b477f7854  x14 0000007b478c5a30  x15 0000000000000000
10-16 15:23:40.803 11519 11596 E CRASH   :     x16 0000000000000000  x17 0000000000000000  x18 0000007b46cf0000  x19 0000007c90ba0340
10-16 15:23:40.803 11519 11596 E CRASH   :     x20 0000007b70557880  x21 0000007c389595a0  x22 0000007c90ba0340  x23 0000007b70557880
10-16 15:23:40.803 11519 11596 E CRASH   :     x24 0000000000000039  x25 0000007b477d87f8  x26 0000007b48754000  x27 0000007b48754000
10-16 15:23:40.803 11519 11596 E CRASH   :     x28 0000007c389595d8  x29 0000007b477d86c0
10-16 15:23:40.803 11519 11596 E CRASH   :     lr  0000007b47ae0c24  sp  0000007b477d86b0  pc  0000007b47add9d4  pst 0000000060000000
10-16 15:23:40.803 11519 11596 E CRASH   :
10-16 15:23:40.803 11519 11596 E CRASH   : backtrace:
10-16 15:23:40.803 11519 11596 E CRASH   :       #00 pc 00000000001319d4  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libwebrtc.so (unity::webrtc::VulkanGraphicsDevice::CopyResourceFromNativeV(unity::webrtc::ITexture2D*, void*))
10-16 15:23:40.803 11519 11596 E CRASH   :       #01 pc 0000000000134c20  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libwebrtc.so (unity::webrtc::GpuMemoryBufferFromUnity::CopyBuffer(void*)+44)
10-16 15:23:40.803 11519 11596 E CRASH   :       #02 pc 000000000012ea3c  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libwebrtc.so (unity::webrtc::GpuMemoryBufferPool::GetOrCreateFrameResources(void*, unity::webrtc::Size const&, UnityRenderingExtTextureFormat)+364)
10-16 15:23:40.803 11519 11596 E CRASH   :       #03 pc 000000000012e6e0  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libwebrtc.so (unity::webrtc::GpuMemoryBufferPool::CreateFrame(void*, unity::webrtc::Size const&, UnityRenderingExtTextureFormat, webrtc::Timestamp)+44)
10-16 15:23:40.803 11519 11596 E CRASH   :       #04 pc 0000000000117d68  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libwebrtc.so (OnBatchUpdateEvent(int, void*)+432)
10-16 15:23:40.803 11519 11596 E CRASH   :       #05 pc 0000000000d7c11c  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libunity.so (GfxDeviceVK::InsertCustomMarkerCallbackAndDataWithFlags(void (*)(int, void*), int, CustomMarkerCallbackFlags, void*, unsigned long)+360) (BuildId: 52b50c65a1cb8819)
10-16 15:23:40.803 11519 11596 E CRASH   :       #06 pc 0000000000eb81c0  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libunity.so (GfxDeviceWorker::RunCommand(ThreadedStreamBuffer&)+32216) (BuildId: 52b50c65a1cb8819)
10-16 15:23:40.803 11519 11596 E CRASH   :       #07 pc 0000000000eb0380  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libunity.so (GfxDeviceWorker::RunExt(ThreadedStreamBuffer&)+84) (BuildId: 52b50c65a1cb8819)
10-16 15:23:40.803 11519 11596 E CRASH   :       #08 pc 0000000000eb0320  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libunity.so (GfxDeviceWorker::Run()+140) (BuildId: 52b50c65a1cb8819)
10-16 15:23:40.803 11519 11596 E CRASH   :       #09 pc 0000000000eb00a4  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libunity.so (GfxDeviceWorker::RunGfxDeviceWorker(void*)+4) (BuildId: 52b50c65a1cb8819)
10-16 15:23:40.803 11519 11596 E CRASH   :       #10 pc 000000000073b76c  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-nzZcfvssv-3vHBiBM-7ROQ==/lib/arm64/libunity.so (Thread::RunThreadWrapper(void*)+1048) (BuildId: 52b50c65a1cb8819)
10-16 15:23:40.803 11519 11596 E CRASH   :       #11 pc 00000000000e6900  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36) (BuildId: 596462ba33c607448e0776eb2ca6d48e)
10-16 15:23:40.803 11519 11596 E CRASH   :       #12 pc 0000000000084b6c  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 596462ba33c607448e0776eb2ca6d48e)
karasusan commented 8 months ago

@noxowl I created a PR to fix the Android crash.

noxowl commented 8 months ago

@karasusan Thank you for the fix. From what we've just checked, it's working normally until the WebRTC connection is made (the preview frame shows a normal camera capture). However, once the WebRTC connection is made and it starts sending frames to the peer, the same crash occurs. At least the other peer seems to have successfully received the first frame (because it was displayed).

10-17 16:24:45.522 21799 22003 E CRASH   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-17 16:24:45.522 21799 22003 E CRASH   : Version '2022.3.8f1 (b5eafc012955)', Build type 'Development', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
10-17 16:24:45.522 21799 22003 E CRASH   : Build fingerprint: 'Ymobile/P450A01/P450A01:10/QKQ1.200517.002/20211012.161058:user/release-keys'
10-17 16:24:45.522 21799 22003 E CRASH   : Revision: '0'
10-17 16:24:45.522 21799 22003 E CRASH   : ABI: 'arm64'
10-17 16:24:45.522 21799 22003 E CRASH   : Timestamp: 2023-10-17 16:24:45.522754622+0900
10-17 16:24:45.522 21799 22003 E CRASH   : pid: 21799, tid: 22003, name: EncoderQueue  >>> jp.ac.jaist.yuizonolab.o2mtestworker <<<
10-17 16:24:45.522 21799 22003 E CRASH   : uid: 10005
10-17 16:24:45.522 21799 22003 E CRASH   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr --------
10-17 16:24:45.522 21799 22003 E CRASH   : Cause: null pointer dereference
10-17 16:24:45.522 21799 22003 E CRASH   :     x0  0000000000000000  x1  0000007c86781d48  x2  0000007c866b5de0  x3  0000000000000000
10-17 16:24:45.522 21799 22003 E CRASH   :     x4  0000000000000000  x5  0000000000000009  x6  0000000000000002  x7  747865745f565559
10-17 16:24:45.522 21799 22003 E CRASH   :     x8  0000000000000002  x9  0000007c914487d8  x10 0000000000000001  x11 0000000000000000
10-17 16:24:45.522 21799 22003 E CRASH   :     x12 0000000000000000  x13 0000000000000000  x14 0000000000000000  x15 00000000b1f824fe
10-17 16:24:45.522 21799 22003 E CRASH   :     x16 0000007b4904a9e0  x17 0000007d227d6928  x18 0000007ad55ac000  x19 0000007c3887d5c0
10-17 16:24:45.523 21799 22003 E CRASH   :     x20 0000007c910e7980  x21 0000007b421d4800  x22 0000007c4370b150  x23 0000007c4370c020
10-17 16:24:45.523 21799 22003 E CRASH   :     x24 0000000000000001  x25 0000000000000038  x26 0000000000000001  x27 0000000000000001
10-17 16:24:45.523 21799 22003 E CRASH   :     x28 0000007c4370b158  x29 0000007c4370b080
10-17 16:24:45.523 21799 22003 E CRASH   :     lr  0000007b4884898c  sp  0000007c4370b080  pc  0000007b4884898c  pst 0000000020000000
10-17 16:24:45.523 21799 22003 E CRASH   :
10-17 16:24:45.523 21799 22003 E CRASH   : backtrace:
10-17 16:24:45.523 21799 22003 E CRASH   :       #00 pc 000000000057b98c  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (webrtc::(anonymous namespace)::SetRawImagePlanes(vpx_image*, webrtc::VideoFrameBuffer*)+72)
10-17 16:24:45.523 21799 22003 E CRASH   :       #01 pc 000000000057aab8  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (webrtc::LibvpxVp8Encoder::PrepareBuffers(rtc::scoped_refptr<webrtc::VideoFrameBuffer>)+692)
10-17 16:24:45.523 21799 22003 E CRASH   :       #02 pc 000000000057a504  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (webrtc::LibvpxVp8Encoder::Encode(webrtc::VideoFrame const&, std::__ndk1::vector<webrtc::VideoFrameType, std::__ndk1::allocator<webrtc::VideoFrameType> > const*)+656)
10-17 16:24:45.523 21799 22003 E CRASH   :       #03 pc 000000000012a3cc  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (unity::webrtc::UnityVideoEncoder::Encode(webrtc::VideoFrame const&, std::__ndk1::vector<webrtc::VideoFrameType, std::__ndk1::allocator<webrtc::VideoFrameType> > const*)+84)
10-17 16:24:45.523 21799 22003 E CRASH   :       #04 pc 00000000005481d0  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (webrtc::VideoStreamEncoder::EncodeVideoFrame(webrtc::VideoFrame const&, long)+1676)
10-17 16:24:45.523 21799 22003 E CRASH   :       #05 pc 0000000000549398  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (webrtc::VideoStreamEncoder::OnBitrateUpdated(webrtc::DataRate, webrtc::DataRate, webrtc::DataRate, unsigned char, long, double)+960)
10-17 16:24:45.523 21799 22003 E CRASH   :       #06 pc 00000000003685ac  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (webrtc::(anonymous namespace)::TaskQueueLibevent::OnWakeup(int, short, void*)+240)
10-17 16:24:45.523 21799 22003 E CRASH   :       #07 pc 000000000036a318  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (event_base_loop+1176)
10-17 16:24:45.523 21799 22003 E CRASH   :       #08 pc 0000000000368e1c  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (std::__ndk1::__function::__func<webrtc::(anonymous namespace)::TaskQueueLibevent::TaskQueueLibevent(std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, rtc::ThreadPriority)::$_0, std::__ndk1::allocator<webrtc::(anonymous namespace)::TaskQueueLibevent::TaskQueueLibevent(std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, rtc::ThreadPriority)::$_0>, void ()>::operator()()+76)
10-17 16:24:45.523 21799 22003 E CRASH   :       #09 pc 000000000040e048  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (std::__ndk1::__function::__func<rtc::PlatformThread::SpawnThread(std::__ndk1::function<void ()>, std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, rtc::ThreadAttributes, bool)::$_0, std::__ndk1::allocator<rtc::PlatformThread::SpawnThread(std::__ndk1::function<void ()>, std::__ndk1::basic_string_view<char, std::__ndk1::char_traits<char> >, rtc::ThreadAttributes, bool)::$_0>, void ()>::operator()()+220)
10-17 16:24:45.523 21799 22003 E CRASH   :       #10 pc 000000000040de50  /data/app/jp.ac.jaist.yuizonolab.o2mtestworker-NsaQuwGdWE-iVULqGFpPcQ==/lib/arm64/libwebrtc.so (rtc::(anonymous namespace)::RunPlatformThread(void*)+20)
10-17 16:24:45.523 21799 22003 E CRASH   :       #11 pc 00000000000e6900  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36) (BuildId: 596462ba33c607448e0776eb2ca6d48e)
10-17 16:24:45.523 21799 22003 E CRASH   :       #12 pc 0000000000084b6c  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 596462ba33c607448e0776eb2ca6d48e)
karasusan commented 8 months ago

@noxowl This PR contains a patch which apply to a code in libwebrtc. I have already uploaded libraries applied the patch here. You need to download libraries from the above link.

noxowl commented 8 months ago

@karasusan Of course, we knew the patch was added in the commit, so we built libwebrtc (build_libwebrtc_android.sh and build_libwebrtc_mac.sh) and then used libwebrtc_android.zip and libwebrtc_mac.zip to build the plugin (replaces the library download part of the build script with a pre-built file). As you replied, when we re-built to use the latest M116 and not our own build file, there was no problem after the WebRTC connection was made.

Is there anything else we should be looking at when building libwebrtc ourselves? I'm a little concerned that we didn't get the same results.

We have no further questions about this issue except for the above, so you can close the issue if you're comfortable doing so.

Thank you for the fix!

karasusan commented 8 months ago

@noxowl I'm glad to hear that. I have provided build scripts for developers to customize native code easily. If you find issues in scripts, please tell me.

noxowl commented 8 months ago

@karasusan I am quite embarrassed to report that when the above problem occurred, I had built from main without moving to the fix branch (because it was a clean build from the build machine). 😅

There's not a specific problem with the build script, but when building libwebrtc for Android on OSX, it fails to build due to a case issue in the directory name. Also, when building the plugin on Ventura 13.4.1 + cmake 3.24.4, I have the following problem:

Preset CMake variables:

  CMAKE_OSX_ARCHITECTURES="arm64;x86_64"

-- Configuring done
-- Generating done
-- Build files have been written to: /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos
2023-10-19 14:31:35.516 xcodebuild[33030:38503636] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project webrtc.xcodeproj clean -target ALL_BUILD -parallelizeTargets -configuration Release -hideShellScriptEnvironment

User defaults from command line:
    HideShellScriptEnvironment = YES
    IDEPackageSupportUseBuiltinSCM = YES

warning: Refusing to delete `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos` because it contains one of the projects in this workspace: `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/webrtc.xcodeproj`.
error: Could not delete `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin` because it was not created by the build system.
    note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true '/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin'` when it is created.
error: Could not delete `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin` because it was not created by the build system.
    note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true '/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin'` when it is created.
error: Could not delete `/Users/noxowl/repository/com.unity.webrtc/Runtime/Plugins/macOS` because it was not created by the build system.
    note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true /Users/noxowl/repository/com.unity.webrtc/Runtime/Plugins/macOS` when it is created.
error: Could not delete `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/_deps/googletest-build/googletest` because it was not created by the build system.
    note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true '/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/_deps/googletest-build/googletest'` when it is created.
error: Could not delete `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/_deps/googletest-build/googlemock` because it was not created by the build system.
    note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true '/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/_deps/googletest-build/googlemock'` when it is created.
error: Could not delete `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/_deps/googletest-build/googletest` because it was not created by the build system.
    note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true '/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/_deps/googletest-build/googletest'` when it is created.
error: Could not delete `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPluginTest` because it was not created by the build system.
    note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true '/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPluginTest'` when it is created.
error: Could not delete `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/_deps/googletest-build/googlemock` because it was not created by the build system.
    note: To mark this directory as deletable by the build system, run `xattr -w com.apple.xcode.CreatedByBuildSystem true '/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/_deps/googletest-build/googlemock'` when it is created.
warning: Refusing to delete `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos` because it contains one of the projects in this workspace: `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/webrtc.xcodeproj`.

** CLEAN FAILED **

2023-10-19 14:31:36.157 xcodebuild[33032:38503669] DVTCoreDeviceEnabledState: DVTCoreDeviceEnabledState_Disabled set via user default (DVTEnableCoreDevice=disabled)
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project webrtc.xcodeproj build -target WebRTCPlugin -parallelizeTargets -configuration Release -hideShellScriptEnvironment

User defaults from command line:
    HideShellScriptEnvironment = YES
    IDEPackageSupportUseBuiltinSCM = YES

Computing target dependency graph and provisioning inputs

Create build description
Build description signature: ecf70ff6ea2a0f399c92c282db1a3c1c
Build description path: /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/build/XCBuildData/ecf70ff6ea2a0f399c92c282db1a3c1c.xcbuilddata

note: Building targets in dependency order
CreateBuildDirectory /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/EagerLinkingTBDs/Release
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/webrtc.xcodeproj
    builtin-create-build-directory /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/EagerLinkingTBDs/Release

note: Run script build phase 'Generate CMakeFiles/ZERO_CHECK' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ZERO_CHECK' from project 'webrtc')
PhaseScriptExecution Generate\ CMakeFiles/ZERO_CHECK /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/webrtc.build/Release/ZERO_CHECK.build/Script-557D0503153F5C8F9E3A6A50.sh (in target 'ZERO_CHECK' from project 'webrtc')
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~
    /bin/sh -c /Users/noxowl/repository/com.unity.webrtc/Plugin\\\~/out/build/macos/webrtc.build/Release/ZERO_CHECK.build/Script-557D0503153F5C8F9E3A6A50.sh
make: `/Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/CMakeFiles/cmake.check_cache' is up to date.

CreateBuildDirectory /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/Release
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/webrtc.xcodeproj
    builtin-create-build-directory /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/Release

ClangStatCache /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-stat-cache /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk /var/folders/cr/9hr6yk9s4b92qfk5xkh90hm40000gn/C/com.apple.DeveloperTools/14.3.1-14E300c/Xcode/SDKStatCaches.noindex/macosx13.3-22E245-.sdkstatcache
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/webrtc.xcodeproj
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-stat-cache /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -o /var/folders/cr/9hr6yk9s4b92qfk5xkh90hm40000gn/C/com.apple.DeveloperTools/14.3.1-14E300c/Xcode/SDKStatCaches.noindex/macosx13.3-22E245-.sdkstatcache

WriteAuxiliaryFile /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/x86_64/WebRTCLib.LinkFileList (in target 'WebRTCLib' from project 'webrtc')
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~
    write-file /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/x86_64/WebRTCLib.LinkFileList

WriteAuxiliaryFile /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/arm64/WebRTCLib.LinkFileList (in target 'WebRTCLib' from project 'webrtc')
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~
    write-file /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/arm64/WebRTCLib.LinkFileList

ProcessProductPackaging "" /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCPlugin.build/libwebrtc.dylib.xcent (in target 'WebRTCPlugin' from project 'webrtc')
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~

    Entitlements:

    {
    "com.apple.application-identifier" = "";
}

    builtin-productPackagingUtility -entitlements -format xml -o /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCPlugin.build/libwebrtc.dylib.xcent

ProcessProductPackagingDER /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCPlugin.build/libwebrtc.dylib.xcent /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCPlugin.build/libwebrtc.dylib.xcent.der (in target 'WebRTCPlugin' from project 'webrtc')
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~
    /usr/bin/derq query -f xml -i /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCPlugin.build/libwebrtc.dylib.xcent -o /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCPlugin.build/libwebrtc.dylib.xcent.der --raw

CompileC /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/arm64/debug.o /Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'WebRTCLib' from project 'webrtc')
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -ivfsstatcache /var/folders/cr/9hr6yk9s4b92qfk5xkh90hm40000gn/C/com.apple.DeveloperTools/14.3.1-14E300c/Xcode/SDKStatCaches.noindex/macosx13.3-22E245-.sdkstatcache -target arm64-apple-macos10.13 -fmessage-length\=221 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-implicit-atomic-properties -Wno-objc-interface-ivars -Wno-arc-repeated-use-of-weak -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -Wno-c++11-extensions -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Release\" -DWEBRTC_MAC -DWEBRTC_POSIX -DOBJC_OLD_DISPATCH_PROTOTYPES\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/Release/include -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/WebRTCPlugin -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/sdk/objc -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/sdk/objc/base -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/unity/include -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/third_party/abseil-cpp -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/third_party/jsoncpp/source/include -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/third_party/jsoncpp/generated -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/third_party/libyuv/include -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/DerivedSources-normal/arm64 -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/DerivedSources/arm64 -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/DerivedSources -F/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/Release -fno-lto -fno-rtti -x objective-c++ -DNDEBUG -fvisibility\=hidden -fvisibility-inlines-hidden -Werror -Wall -Wextra -Wformat\=2 -Wno-unused-parameter -std\=c++17 -MMD -MT dependencies -MF /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/arm64/debug.d --serialize-diagnostics /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/arm64/debug.dia -c /Users/noxowl/repository/com.unity.webrtc/Plugin\~/libcxx/debug.cpp -o /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/arm64/debug.o
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:37:13: error: use of undeclared identifier '__libcpp_debug_info'
std::string __libcpp_debug_info::what() const {
            ^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:47:53: error: unknown type name '__libcpp_debug_info'
_LIBCPP_NORETURN void __libcpp_abort_debug_function(__libcpp_debug_info const& info) {
                                                    ^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:54:1: error: unknown type name '_LIBCPP_SAFE_STATIC'
_LIBCPP_SAFE_STATIC __libcpp_debug_function_type
^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:54:49: error: expected ';' after top level declarator
_LIBCPP_SAFE_STATIC __libcpp_debug_function_type
                                                ^
                                                ;
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:57:63: error: expected ')'
bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) {
                                                              ^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:57:33: note: to match this '('
bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) {
                                ^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:57:70: error: expected ';' after top level declarator
bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) {
                                                                     ^
                                                                     ;
6 errors generated.

CompileC /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/x86_64/debug.o /Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'WebRTCLib' from project 'webrtc')
    cd /Users/noxowl/repository/com.unity.webrtc/Plugin\~
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -ivfsstatcache /var/folders/cr/9hr6yk9s4b92qfk5xkh90hm40000gn/C/com.apple.DeveloperTools/14.3.1-14E300c/Xcode/SDKStatCaches.noindex/macosx13.3-22E245-.sdkstatcache -target x86_64-apple-macos10.13 -fmessage-length\=221 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -Wno-trigraphs -fpascal-strings -O3 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-implicit-atomic-properties -Wno-objc-interface-ivars -Wno-arc-repeated-use-of-weak -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wno-undeclared-selector -Wno-deprecated-implementations -Wno-c++11-extensions -Wno-implicit-fallthrough -DCMAKE_INTDIR\=\"Release\" -DWEBRTC_MAC -DWEBRTC_POSIX -DOBJC_OLD_DISPATCH_PROTOTYPES\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/Release/include -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/WebRTCPlugin -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/sdk/objc -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/sdk/objc/base -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/unity/include -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/third_party/abseil-cpp -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/third_party/jsoncpp/source/include -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/third_party/jsoncpp/generated -isystem /Users/noxowl/repository/com.unity.webrtc/Plugin\~/webrtc/include/third_party/libyuv/include -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/DerivedSources-normal/x86_64 -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/DerivedSources/x86_64 -I/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/DerivedSources -F/Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/Release -fno-lto -fno-rtti -x objective-c++ -DNDEBUG -fvisibility\=hidden -fvisibility-inlines-hidden -Werror -Wall -Wextra -Wformat\=2 -Wno-unused-parameter -std\=c++17 -MMD -MT dependencies -MF /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/x86_64/debug.d --serialize-diagnostics /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/x86_64/debug.dia -c /Users/noxowl/repository/com.unity.webrtc/Plugin\~/libcxx/debug.cpp -o /Users/noxowl/repository/com.unity.webrtc/Plugin\~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/x86_64/debug.o
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:37:13: error: use of undeclared identifier '__libcpp_debug_info'
std::string __libcpp_debug_info::what() const {
            ^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:47:53: error: unknown type name '__libcpp_debug_info'
_LIBCPP_NORETURN void __libcpp_abort_debug_function(__libcpp_debug_info const& info) {
                                                    ^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:54:1: error: unknown type name '_LIBCPP_SAFE_STATIC'
_LIBCPP_SAFE_STATIC __libcpp_debug_function_type
^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:54:49: error: expected ';' after top level declarator
_LIBCPP_SAFE_STATIC __libcpp_debug_function_type
                                                ^
                                                ;
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:57:63: error: expected ')'
bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) {
                                                              ^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:57:33: note: to match this '('
bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) {
                                ^
/Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp:57:70: error: expected ';' after top level declarator
bool __libcpp_set_debug_function(__libcpp_debug_function_type __func) {
                                                                     ^
                                                                     ;
6 errors generated.

note: Run script build phase 'CMake PostBuild Rules' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'WebRTCPlugin' from project 'webrtc')
** BUILD FAILED **

The following build commands failed:
    CompileC /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/arm64/debug.o /Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp normal arm64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'WebRTCLib' from project 'webrtc')
    CompileC /Users/noxowl/repository/com.unity.webrtc/Plugin~/out/build/macos/WebRTCPlugin/webrtc.build/Release/WebRTCLib.build/Objects-normal/x86_64/debug.o /Users/noxowl/repository/com.unity.webrtc/Plugin~/libcxx/debug.cpp normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'WebRTCLib' from project 'webrtc')
(2 failures)

I have to comment out debug.cpp to build it.

The current build script for OSX assumes homebrew is installed, but it would be nice if it also took macports environments - it's not a major issue, so if I have time to write a PR for it, I'll contribute it at a later time.