open-webrtc-toolkit / owt-client-native

Open WebRTC Toolkit client SDK for native Windows/Linux/iOS applications.
https://01.org/open-webrtc-toolkit
Apache License 2.0
384 stars 180 forks source link

build for iOS reports error: ABSL_HAVE_THREAD_LOCAL should be defined for MacOS / iOS Targets #737

Closed Always17365 closed 6 months ago

Always17365 commented 7 months ago

Hi! I kept getting errors when build the iOS version of owt-client-native on Mac. The error message is as follows:

build parameters : python scripts/build.py --sio_root="/Users/user/owt-project/Library/iOS"

FAILED: obj/third_party/webrtc/sdk/audio_session_objc/RTCAudioSession.o ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF obj/third_party/webrtc/sdk/audio_session_objc/RTCAudioSession.o.d -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DCR_XCODE_VERSION=1501 -DCR_CLANG_RE VISION=\"llvmorg -16-init-6578-g0d30e92f-1\" -D_DEBUG -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWEBRTC_ENABLE_PROTOBUF=0 -DWEBRTC_INCLUDE_INTERNAL_AUDIO_DEVICE -DRTC_ENABLE_VP9 -DRTC_DAV1D_IN_INTERNAL_DECODER_FACTORY -DWEBRTC _HAVE_SCTP -DHAVE_WEBRTC_VIDEO -DLOGGING_INSIDE_WEBRTC -DWEBRTC_ARCH_ARM64 -DWEBRTC_HAS_NEON -DWEBRTC_LIBRARY_IMPL -DWEBRTC_ENABLE_SYMBOL_EXPORT -DWEBRTC_ENABLE_OBJC_SYMBOL_EXPORT -DWEBRTC_ENABLE_AVX2 -DWEBRTC_NON_STATICTRACE EVENT_HANDLERS=1 -DWEBRTC_POSIX -DWEBRTC_MAC -DWEBRTC_IOS -DABSL_ALLOCATOR_NOTHROW=1 -I../.. -Igen -I../../third_party/webrtc -Igen/third_party/webrtc -I../../third_party/abseil-cpp - I../../third_party/webrtc/sdk/objc -I../../third_party/webrtc/sdk/objc/base -Wall -Werror -Wextra -Wimplicit-fallthrough -Wextra-semi -Wunreachable-code- aggressive -Wthread-safety -Wunguarded-availability -Wundeclared-selector -Wno-missing-field-initializers -Wno-unused-parameter -Wloop-analysis -Wno-unneeded-internal-declaration -Wenum-compare-conditional -Wno-psabi - Wno-ignored-pragma-optimize -Wno-deprecated-builtins -Wno-bitfield-constant-conversion -Wshadow -fno-delete-null-pointer-checks -fno-ident -fno-strict-aliasing -fstack-protector-strong - fcolor-diagnostics -fmerge-all-constants -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -ffp-contract=off -target arm64-apple -ios12.0 -Wno-builtin-macro-redefined -DDATE= -DTIME= -DTIMESTAMP= -no-canonical-prefixes -ftrivial-auto-var-init=pattern -O0 -fno-omit-frame-pointer -g2 - gdwarf-aranges -Xclang -debug-info-kind=limited -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk -Wheader-hygiene -Wstring-conversion - Wtautological-overlap-compare -Wexit-time-destructors -Wglobal-constructors -Wno-shadow -Wctad-maybe-unsupported -Wimplicit-retain-self -Wstrict-overflow -Wmissing-field-initializers -Wimplicit-retain-self -Wno- undefined-bool-conversion -Wno-tautological-undefined-compare -std=c++20 -Wno-trigraphs -fobjc-call-cxx-cdtors -fno-exceptions -fno-rtti -fobjc-arc -c ../. ./third_party/webrtc/sdk/objc/components/audio/RTCAudioSession.mm -o obj/third_party/webrtc/sdk/audio_session_objc/RTCAudioSession.o ../../third_party/webrtc/sdk/objc/components/audio/RTCAudioSession.mm:26:2: error: ABSL_HAVE_THREAD_LOCAL should be defined for MacOS / iOS Targets.

error ABSL_HAVE_THREAD_LOCAL should be defined for MacOS / iOS Targets.

I hope any warriors who have the same problem can tell me where the problem is.

jianjunz commented 7 months ago

I guess the issue is caused by __ENVIRONMENT_OS_VERSION_MIN_REQUIRED__ not defined. This macro was introduced earlier this year. However, the clang version we're using is older. It could possibly be resolved by upgrading clang to a newer version, or use an old version of iOS SDK.