AlexKMDev / WebRTC

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

Linker command failed with exit code 1 - only with WebRTC dependency #34

Closed TomasHubelbauer closed 7 years ago

TomasHubelbauer commented 7 years ago

I have created a brand new Swift 3 XCode 8.3.3. single view iOS project, ran pod init and pod install (with no dependencies) and verified the application runs as expected.

I have then added a WebRTC dependency: pod "WebRTC"

The project fails to build with this dependency added, the error is as follows:

Apple Mach-O Linker (ld) Error
  Linker command failed with exit code 1 (use -v to see invocation)

I ran xcodebuild -verbose in the directory of the project and found an error which says ld: framework not found Pods_{projectName}. Everything else in the output seems to be okay, although it should be noted the output is hard to read.

When I remove the WebRTC dependency and run pod install again (ending up with an empty, Pod-enabled project again), the project builds again using XCode, but running xcodebuild -verbose still fails in the project directory and for the same reason - may this have to do with caching?

Is this something I should fix or is this an issue with the dependency itself? This reproduces on a clean Swift 3 project in XCode 8.3.3, so I think this is a problem with the dependency.

souvickcse commented 7 years ago

Just tried it with xcode 8.3.3, it is working fine. Is there any warning message during the pod install? And just to confirm you add use_frameworks! in pod file and you are not opening .xcodeproj.

TomasHubelbauer commented 7 years ago

No errors when installing the WebRTC pod.

Here's the exact steps to reproduce:

When I remove the pod, leaving an empty Podfile again, it works, builds, deploys successfully.

I will upload the repro to GitHub and link it here later today if you are not able to reproduce.

souvickcse commented 7 years ago

Ok I will try to reproduce it tonight(right now I don't have xcode 8.3.3). And yes upload it I will try with it as well.

souvickcse commented 7 years ago

Done all the steps can't able to replicate the issue. I have to disable bitcode though it was giving me error else there is no issue.

TomasHubelbauer commented 7 years ago

Check out my repro repo here, please: https://gitlab.com/TomasHubelbauer/WebRTC-pod-fail/tree/master Please follow the commit history and README.md. I am able to reproduce it 100 %. Attached xcodebuild log file. We can diff ours and see if we find something. Please create a new application called myApp like I did, we should have identical code that way.

souvickcse commented 7 years ago

Did you disable bitcode after pod install?

TomasHubelbauer commented 7 years ago

Sorry I am somewhat new to iOS development and I didn't know what that was (for reference, you go to your project settings, find Build Settings tab, click All and search for Bitcode). I did it now and it helped! Will you accept a PR so I can add it to README.md?

souvickcse commented 7 years ago

It is already there in the ReadME in BOLD. :) And I don't have permission to accept PR.

TomasHubelbauer commented 7 years ago

Updated my PR because this should definitely be linked from the installation section. Also for a noobie the connection from linker errors to bitcode will not be there, so this is worth a callout. Thanks for your help!

souvickcse commented 7 years ago

And one more thing if you go to the error description it will show that bitcode is enable in the project that is why it is creating the issue.

TomasHubelbauer commented 7 years ago

A good point for more experienced developers, but again, a beginner will never make this connection so I believe the README.md file should mention this explicitly.