为iOS构建webrtc库时出错

时间:2015-10-12 16:04:06

标签: ios xcode webrtc libjingle ninja

我一直在尝试根据Google在http://www.webrtc.org/native-code/ios(以及相关链接)上的指示构建适用于iOS的webrtc。虽然我记得在过去我已经能够建立它的类似步骤已经不再是这样了。

以下是我所做的步骤:

  1. 下载先决条件:

    $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

    $ export PATH =`pwd` / depot_tools:“$ PATH”

  2. 下载回购:

    $ export GYP_DEFINES =“OS = ios”

    $ fetch webrtc_ios

  3. 准备构建:

    $ cd webrtc / src

    $ export GYP_DEFINES =“build_with_libjingle = 1 build_with_chromium = 0 libjingle_objc = 1”

    $ export GYP_DEFINES =“$ GYP_DEFINES OS = ios target_arch = armv7”

    $ export GYP_GENERATOR_FLAGS =“output_dir = out_ios”

    $ export GYP_CROSSCOMPILE = 1

    $ gclient runhooks

  4. 构建

    $ ninja -C out_ios / Debug-iphoneos AppRTCDemo

  5. 一切正常,直到用/ bin / sh失败的最后一个命令:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc:没有这样的文件或目录:

    ninja: Entering directory `out_ios/Debug-iphoneos'
    [3/1664] CC obj/chromium/src/third_party/boringssl/src/crypto/bio/boringssl.bio_mem.o
    FAILED: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc -MMD -MF obj/chromium/src/third_party/boringssl/src/crypto/bio/boringssl.bio_mem.o.d -DV8_DEPRECATION_WARNINGS -DCLD_VERSION=2 -DDISABLE_NACL -DCHROMIUM_BUILD -DCR_CLANG_REVISION=247874-1 -DUSE_LIBJPEG_TURBO=1 -DENABLE_CONFIGURATION_POLICY -DSYSTEM_NATIVELY_SIGNALS_MEMORY_PRESSURE -DDONT_EMBED_BUILD_METADATA -DFIELDTRIAL_TESTING_ENABLED -DDISABLE_FTP_SUPPORT=1 -DV8_USE_EXTERNAL_STARTUP_DATA -DBORINGSSL_IMPLEMENTATION -DBORINGSSL_NO_STATIC_INITIALIZER -DOPENSSL_NO_ASM -DUSE_LIBPCI=1 -DUSE_OPENSSL=1 -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -Igen -I../../chromium/src/third_party/boringssl/src/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk -O0 -gdwarf-2 -fvisibility=hidden -Wnewline-eof -miphoneos-version-min=7.0 -arch arm64 -Wendif-labels -Wno-unused-parameter -Wno-missing-field-initializers -Wno-selector-type-mismatch -Wheader-hygiene -Wno-char-subscripts -Wno-unneeded-internal-declaration -Wno-covered-switch-default -Wstring-conversion -Wno-c++11-narrowing -Wno-deprecated-register -Wno-inconsistent-missing-override -Wno-shift-negative-value -Wno-bitfield-width -Wno-unused-function -Wno-unused-variable -m32 -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/usr/include/ -m32 -arch i386 -pipe -no-cpp-precomp -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.0.sdk/usr/include/ -std=c99 -Xclang -load -Xclang /Volumes/store/code/webrtc/src/third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib -Xclang -add-plugin -Xclang find-bad-constructs -fcolor-diagnostics -fstack-protector-all -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare  -c ../../chromium/src/third_party/boringssl/src/crypto/bio/bio_mem.c -o obj/chromium/src/third_party/boringssl/src/crypto/bio/boringssl.bio_mem.o
    /bin/sh: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc: No such file or directory
    

    出于某种原因,忍者认为我们正在为模拟器建造,加上即使我们这样做也不是获得gcc的正确途径。请注意,我的系统已安装XCode 7.

    任何可能出错的想法或我如何解决这个问题?

    祝你好运, 安东尼

1 个答案:

答案 0 :(得分:1)

一年前,我还想用谷歌的指示建立图书馆,但我无法做到。发生了很多错误,我最终搜索了一些构建脚本。最后我找到了this script。进行以下步骤,您将成功构建它:

  • 安装命令行工具,但在终端中粘贴此命令:xcode-select --install
  • 克隆脚本:git clone https://github.com/lunastorm/webrtc-ios.git
  • 在终端中输入git repository并使用以下命令运行脚本:make -j4其中j4标记CPU核心数(如果我错了,请纠正我)。这可能需要一段时间,所以准备一杯咖啡
  • 构建将首次失败,但不要担心,只需删除脚本下载的文件夹。我会在编辑中写下哪些
  • 找到适用于构建iOS应用的代码签名标识。在终端中输入security find-identity。在Valid identities only
  • 下选择一个
  • 打开全局配置文件src / build / common.gypi并搜索文本“CODE_SIGN_IDENTITY”。将‘CODE_SIGN_IDENTITY[sdk=iphoneos*]‘: ‘iPhone Developer’替换为您的开发者信息,例如‘CODE_SIGN_IDENTITY[sdk=iphoneos*]‘: ‘iPhone Developer: Josip Bernat (2V3DKW6SDC)’
  • 使用make -j4再次运行脚本,希望它能为您构建WebRTC.framework