我正在尝试使用WebRTC本机库在Qt Creator中构建Mac desktiop,但始终会看到错误消息:
Undefined symbols for architecture x86_64:
"_NSOSStatusErrorDomain", referenced from:
rtc::DescriptionFromOSStatus(int) in libwebrtc.a(logging_mac.o)
"_OBJC_CLASS_$_NSError", referenced from:
objc-class-ref in libwebrtc.a(logging_mac.o)
"_OBJC_CLASS_$_NSObject", referenced from:
objc-class-ref in libwebrtc.a(thread_darwin.o)
"_OBJC_CLASS_$_NSThread", referenced from:
objc-class-ref in libwebrtc.a(thread_darwin.o)
"_objc_autoreleasePoolPop", referenced from:
(anonymous namespace)::InitCocoaMultiThreading() in libwebrtc.a(thread_darwin.o)
rtc::Thread::PreRun(void*) in libwebrtc.a(thread_darwin.o)
rtc::Thread::ProcessMessages(int) in libwebrtc.a(thread_darwin.o) ….
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [lib*******_WebRTCWrapper.1.0.0.dylib] Error 1
12:17:39: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project (kit: Desktop Qt 5.10.0 clang 64bit)
When executing step "Make"
初始参数:
在使用webrtc的编译选项后,我已经使用系统的clang编译并使用了libc ++。
我使用参数
构建了webRTC库gn gen out / x64 / Debug --args ='is_debug = true target_os =“mac”is_component_build = false rtc_include_tests = false target_cpu =“x64”'
export GYP_DEFINES =“build_with_libjingle = 1 build_with_chromium = 0 libjingle_objc = 1 clang = 1 clang_xcode = 1 use_system_libcxx = 1 OS = mac”
此外,经过大量谷歌搜索后,我在/ src / build /
中编辑了 common.gypi 文件'xcode_settings': {
'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
# (Equivalent to -fPIC)
'CLANG_CXX_LIBRARY': 'libc++',
# MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
}
'GCC_ENABLE_CPP_RTTI': 'YES', # -fno-rtti
'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror
'CLANG_CXX_LIBRARY': 'libc++', # -stdlib=libc++
但不幸的是,结果错误是相同的!!!