4

I've been trying to build webrtc for iOS following Google's directions at http://www.webrtc.org/native-code/ios (and related links). Although I recall that with similar steps I've been able to build it in the past this is no longer the case.

Here's the steps I did:

  1. Download prerequisites:

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

    $ export PATH=`pwd`/depot_tools:"$PATH"

  2. Download repo:

    $ export GYP_DEFINES="OS=ios"

    $ fetch webrtc_ios

  3. Prepare build:

    $ 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. Build:

    $ ninja -C out_ios/Debug-iphoneos AppRTCDemo

Everything is ok, until the last command that fails with /bin/sh: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc: No such file or directory:

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

For some reason ninja thinks we are building for the Simulator, plus even if we did this would not be the right path to get gcc. Notice that my system has XCode 7 installed.

Any ideas what might be wrong or how I could work around this?

Best regards, Antonis

atsakiridis
  • 1,002
  • 5
  • 19
  • Can you try this script in your src directory? webrtc/build/ios/build_ios_libs.sh. Also I see that "gclient sync" is missing from steps. Please check if you are doing the same. – manishg Jan 29 '17 at 02:38
  • Thanks for the comment. Notice though that its been a long while since I posted this question. Right now I'm building without issues using Google's official guide at: https://webrtc.org/native-code/ios/ – atsakiridis Jan 30 '17 at 08:25

1 Answers1

1

A year ago I also wanted to build library using Google's instructions but I was unable to. Many errors occurred and I ended up googling for some build script. In the end I found this script. Make following steps and you will build it successfully:

  • Install Command Line Tools but pasting this command in terminal: xcode-select --install
  • Clone script: git clone https://github.com/lunastorm/webrtc-ios.git
  • Enter git repository in Terminal and run script with following command: make -j4 where j4 marks number of CPU cores (correct me if I'm wrong). This can take a while so prepare your self a cup of coffee
  • Build will fail for the first time but don't worry, just delete the folders which script downloaded. I will write which ones in edit
  • Find your code signing identity which is valid for building iOS apps. Type security find-identity in terminal. Pick one under Valid identities only
  • Open the global configuration file src/build/common.gypi and search for the text ‘CODE_SIGN_IDENTITY’. Replace ‘CODE_SIGN_IDENTITY[sdk=iphoneos*]‘: ‘iPhone Developer’ with your developer information i.e. ‘CODE_SIGN_IDENTITY[sdk=iphoneos*]‘: ‘iPhone Developer: Josip Bernat (2V3DKW6SDC)’
  • Run the script again using make -j4 and hopefully it will build you WebRTC.framework
Josip B.
  • 2,434
  • 1
  • 25
  • 30
  • Thanks a lot for your reply Josib B. This morning I too managed to build using a similar solution to what you are suggesting without problems (https://github.com/pristineio/webrtc-build-scripts). So my imminent problem fixed, but I'm still wondering what is wrong with the official facilities. I'm generally trying to avoid using wrapper build scripts as they tend to have issues and usually lag behind webrtc official build facilities. – atsakiridis Oct 13 '15 at 11:15