AlexKMDev / WebRTC

Unofficial builds of Google WebRTC iOS Framework
https://webrtc.org/native-code/ios/
Other
292 stars 76 forks source link

Updated Build info in Readme? #6

Closed kohenkatz closed 8 years ago

kohenkatz commented 8 years ago

In the README, it says that you use the script in webrtc/build/ios/build_ios_libs.sh. However, as of September 14th, that script no longer works (at least for me).

What are you using now?

AlexKMDev commented 8 years ago

I'm still using this build script, but there is blocking error in the upstream which prevents me from building the latest revision.

https://bugs.chromium.org/p/webrtc/issues/detail?id=6433

kohenkatz commented 8 years ago

That is by design, and will not be fixed, which is why I asked the question in the first place.

WebRTC has officially moved from GYP to GN, and the old GYP build process is broken.

x3mall1986 commented 8 years ago

@Anakros mb this will help you https://groups.google.com/d/msg/discuss-webrtc/dUTlrJefNak/McRbMqqpCQAJ

kohenkatz commented 8 years ago

@x3mall1986 that has nothing to do with the issue here. That discussion was before the changes that caused the issue being discussed here.

AlexKMDev commented 8 years ago

@kohenkatz OK, I didn't know about GYP deprecation and about the build process in depth. Just tried to generate build files using GN as described at https://webrtc.org/native-code/ios/:

gn gen out/Debug-sim64 --args='target_os="ios" target_cpu="x64" is_component_build=false'

Then running ninja on rtc_sdk_framework_objc target and it generates the dynamic framework, but only for specified architecture (for now).

/V/H/w/src> ninja -C out/Debug-sim64 rtc_sdk_framework_objc
ninja: Entering directory `out/Debug-sim64'
[2152/2152] STAMP obj/webrtc/sdk/rtc_sdk_framework_objc.stamp
/V/H/w/src> lipo -info out/Debug-sim64/WebRTC.framework/WebRTC
Architectures in the fat file: out/Debug-sim64/WebRTC.framework/WebRTC are: x86_64
kohenkatz commented 8 years ago

I will look at this more when I get to work. I am in the middle of working on this there.

kohenkatz commented 8 years ago

I have found the following command works to build a combined framework for armv7 and arm64.

gn gen out/Debug-device --args='target_os="ios" target_cpu="arm64" is_component_build=false additional_target_cpus=["arm"] enable_dsyms=true'

I am still working on how to get it to include the simulator version - right now I'm getting errors when I try to add the x64 architecture to the additional_target_cpus array.

kohenkatz commented 8 years ago

The following command appears to work to build for the simulator and for devices:

gn gen out/Debug-device --args='target_os="ios" target_cpu="x64" is_component_build=false additional_target_cpus=["arm", "arm64"] enable_dsyms=true'
ninja -C out/Debug rtc_sdk_framework_objc

This produces a fat library like the old build script did:

lipo -info out/Debug/WebRTC.framework/WebRTC 
Architectures in the fat file: out/Debug/WebRTC.framework/WebRTC are: x86_64 armv7 arm64 

For additional ease of building, the following options can be added:

kohenkatz commented 8 years ago

Note that I did not include the 32-bit simulator in the above command, because there's no need for it anymore. All simulators can be run as 64-bit.

AlexKMDev commented 8 years ago

Thanks! I tried other combinations, but with no success, I thought just to merge two builds using lipo. Will try to build with your command now.

antoniotuzzi commented 8 years ago

Hello friends, I'm trying to use this command but I keep getting

Pythoning //build/config/ios/find_signing_identity.py took 271ms identity and could not detect one automatically either. TIP: Simulator builds don't require code signing... ERROR at //build/config/ios/ios_sdk.gni:104:5: Assertion failed.

the find_signing_identity.py script is failing

kohenkatz commented 8 years ago

@antoniotuzzi You need to add the ios_enable_code_signing = false argument and it will work.

antoniotuzzi commented 8 years ago

👍

AlexKMDev commented 8 years ago

When I tried to test things with new framework, I got this:

Undefined symbols for architecture x86_64:
  "_RTCInitializeSSL", referenced from:
      test.ViewController.viewDidLoad () -> () in ViewController.o
ld: symbol(s) not found for architecture x86_64

This is a function from RTCSSLAdapter.h Same for armv7. Not sure what could be wrong, but I building with is_debug argument set to false.

AlexKMDev commented 8 years ago

But another sample code works:

print(UIDevice.string(for: UIDevice.deviceType()))

let factory = RTCPeerConnectionFactory()
let config = RTCConfiguration()
config.tcpCandidatePolicy = .disabled

let constraints = RTCMediaConstraints(mandatoryConstraints: nil, optionalConstraints: nil)
let connection = factory.peerConnection(with: config, constraints: constraints, delegate: nil)

Maybe this function was removed recently, but not from headers, I'm not sure.

antoniotuzzi commented 8 years ago

you more expert than me, but where is now RTCSessionDescriptionDelegate" ? when did they change ?

AlexKMDev commented 8 years ago

@antoniotuzzi Please ask for help in discussion group, there are more experienced people and they have more free time to help. This issue is for solving recent problems with the compilation of the framework.

RTCSessionDescriptionDelegate was removed, you should set local/remote description like this:

func inputRemoteOffer(sdp: String) {
    let d = RTCSessionDescription(type: .Offer, sdp: sdp)

    connection.setRemoteDescription(d) { (err) in
        if let err = err {
            print("failed to set remote offer", err)
        } else {
            self.connection.answerForConstraints(self.offerConstraints(), completionHandler: { (description, err) in
                if let e = err {
                    print("failed to create offer", e)
                }

                if let d = description {
                    self.connection.setLocalDescription(d, completionHandler: { (err) in
                        print("failed to set local answer")
                    })
                }
            })
        }
    }
}
x3mall1986 commented 8 years ago

@kohenkatz try this for support simulator & devices when combining all those architectures (arm, arm64, x86, x64) you must to specify x64 as target_cpu (and the rest as additional)

gn gen out/Release-universal --args='target_os="ios" target_cpu="x64" additional_target_cpus=["arm", "arm64", "x86"] is_component_build=false is_debug=false'

ninja -C out/Release-universal rtc_sdk_framework_objc

Hope this helps!

Discuss of this solution is here -> https://groups.google.com/forum/#!topic/discuss-webrtc/rh9YqNNH23Q

kohenkatz commented 8 years ago

@x3mall1986 That's exactly the same solution that I posted above 8 days ago.

AlexKMDev commented 8 years ago

WebRTC team has updated build_ios_libs.sh script and it seems that it generates a working framework.

AlexKMDev commented 8 years ago

Published new release https://github.com/Anakros/WebRTC-iOS/releases/tag/14604.0.0-master

x3mall1986 commented 8 years ago

pod update 'webrtc' command doesn't update to 14604 version

AlexKMDev commented 8 years ago

@x3mall1986 you need to specify version condition as described in the README.md if you want to use unstable version.