Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

113 duplicate symbols for architecture x86_64 #1972

Closed
5 tasks done
vipinsaini0 opened this issue Dec 7, 2021 · 15 comments
Closed
5 tasks done

113 duplicate symbols for architecture x86_64 #1972

vipinsaini0 opened this issue Dec 7, 2021 · 15 comments
Labels
bug fixed-in-main The fix has been committed to main but may not have been released yet
Milestone

Comments

@vipinsaini0
Copy link

Checklist before submitting a bug report

Xcode version

12.5.1

Facebook iOS SDK version

12.2.0

Dependency Manager

SPM

SDK Framework

Login

Goals

User login in my app by fb login.

Expected results

App run and get user profile details.

Actual results

app run (build) failed.

Steps to reproduce

update swift package from 12.1.0 to 12.2.0. once finished run the app, and getting failed the build.

Code samples & details

No response

@vipinsaini0
Copy link
Author

Hi @jawwad @KylinChang , Can you please check and help in it?

@jawwad
Copy link
Contributor

jawwad commented Dec 7, 2021

@vipinsaini0 - Hmm, that's weird, maybe a caching issue?

Could you try the following and let me know if it fixes it?

rm -rf ~/Library/Caches/org.swift.swiftpm
rm -rf ~/Library/Developer/Xcode/DerivedData

If not, could you share a bit more about your setup and what packages you are including?

@rromanchuk
Copy link

@jawwad just got this as well when pinning 12.2.0 with all the usual resolution steps to no avail. Let me dig in with trial and error. I have multiple targets and utilize FacebookAEM which i see some activity on the changelog. Going to unwind and just link Core then step through it.

@rromanchuk
Copy link

Just looking stdout looks like it's between FBSDKCoreKit and FBAEMKit such as FBSDKCoreKit.framework/FBSDKCoreKit(FBAEMAdvertiserMultiEntryRule.o) and FBAEMKit.framework/FBAEMKit(FBAEMAdvertiserMultiEntryRule.o)

./DerivedData/App/Build/Products/Debug-iphoneos/FBSDKCoreKit.framework/FBSDKCoreKit(FBAEMAdvertiserMultiEntryRule.o)
./DerivedData/App/Build/Products/Debug-iphoneos/FBAEMKit.framework/FBAEMKit(FBAEMAdvertiserMultiEntryRule.o)

@rromanchuk
Copy link

rromanchuk commented Dec 7, 2021

OK got it building again by selecting my target and adding only FacebookBasics and FacebookAEM which i just sort of guessed after looking at Package.swift#L160 and ignoring https://developers.facebook.com/docs/ios/getting-started (which i usually do)

Not it, if i change build target/device everything implodes. It certainly feels like an insidious module cache issue

PS broken links
https://developers.facebook.com/docs/app-ads/formats/mobile-ads (https://developers.facebook.com/docs/ios under ios features)
https://developers.facebook.com/docs/app-ads/measuring (https://developers.facebook.com/docs/app-events/best-practices first link)

@dejiapps
Copy link

dejiapps commented Dec 7, 2021

I am having this issue too.

@joesus
Copy link
Contributor

joesus commented Dec 7, 2021

Going to unwind and just link Core then step through it.

@rromanchuk what do you mean by this. Trying to reproduce the issue and coming up short. Can this be replicated in a minimal sample project?

@rromanchuk
Copy link

I'm going to remove everything and add back incrementally so i can at least step through compilation errors and pinpoint the moment it repos. It's hard to create a minimal project, because even on File -> New Project the diff on build settings is already a massive departure, which i wouldnt be surprised if i had some bespoke setting causing the issue.

Only consistent thing i have right now is a the dupe is between AEM and Core

❌ duplicate symbol 'OBJC_CLASS$_FBAEMAdvertiserMultiEntryRule' in

FBAEMKit(FBAEMAdvertiserMultiEntryRule.o)
FBSDKCoreKit(FBAEMAdvertiserMultiEntryRule.o)

@rromanchuk
Copy link

rromanchuk commented Dec 8, 2021

Ok, i got it building again by re-aligning some of build settings closer to what X-Code generates after a new ios/storyboard project. I don't have a great a control, because of how long purging cache + rebuild takes, but some of the changes i made are below. My guess is other linker flags.

  • removed linker flag -objc (N/A, old legacy requirement for for pre spm sdks)
  • Bump 13 up to 14.0 as my deployment target
  • explicit specify gnu/libc++ instead of compiler default
  • Always search user paths to NO

I've built to both targets, device, sim successfully 🤷

TLDR: To fix, grep the project file for OTHER_LDFLAGS = "-ObjC"; and remove it

@rromanchuk
Copy link

rromanchuk commented Dec 8, 2021

@joesus OK, i got the repro for you https://github.com/rromanchuk/fb-duplicate-syms

It's 100% -ObjC. File -> new project -> swift/storyboard -> add the linker flag and you can repro the same error. That makes a little more sense, especially since older projects are likely to have this legacy cruft sitting around from popular SDKs like firebase on cocoapods

// AppDelegate.swift
import UIKit
import FacebookCore
import FacebookLogin
import FacebookShare
// ....

@vipinsaini0
Copy link
Author

rm -rf ~/Library/Developer/Xcode/DerivedData

@vipinsaini0 - Hmm, that's weird, maybe a caching issue?

Could you try the following and let me know if it fixes it?

rm -rf ~/Library/Caches/org.swift.swiftpm
rm -rf ~/Library/Developer/Xcode/DerivedData

If not, could you share a bit more about your setup and what packages you are including?

After run this two command, still same error.
I used coreKit and LoginKit libraries.
If I downgrade 12.2.0 -> 12.1.0 then no error show.

  • Now I tried with pods after run this two command then run successfully.

but getting error log -

-canOpenURL: failed for URL: "fbapi:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

@vipinsaini0
Copy link
Author

rm -rf ~/Library/Developer/Xcode/DerivedData

@vipinsaini0 - Hmm, that's weird, maybe a caching issue?
Could you try the following and let me know if it fixes it?

rm -rf ~/Library/Caches/org.swift.swiftpm
rm -rf ~/Library/Developer/Xcode/DerivedData

If not, could you share a bit more about your setup and what packages you are including?

After run this two command, still same error. I used coreKit and LoginKit libraries. If I downgrade 12.2.0 -> 12.1.0 then no error show.

  • Now I tried with pods after run this two command then run successfully.

but getting error log -

-canOpenURL: failed for URL: "fbapi:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"

By adding below fb notification, now working fine. Thank you!

NotificationCenter.default.addObserver(forName: .AccessTokenDidChange, object: nil, queue: OperationQueue.main) { (notification) in }

@joesus
Copy link
Contributor

joesus commented Dec 8, 2021

Seems like there were two issues here:

  1. Including the linker flag OTHER_LDFLAGS = "-ObjC"; caused a duplicate symbol failure. This is something to explore since I'm not entirely sure why this would happen. In either case we can add a note to changelog about this.

  2. The warning:

NotificationCenter.default.addObserver(forName: .AccessTokenDidChange, object: nil, queue: OperationQueue.main) { (notification) in }

This seems like a separate issue. My guess is that the SDK isn't being initialized correctly. That observer is added when the FBSDKAccessTokenExpirer is created FBSDKAccessTokenExpirer.m#L30 by the initializer for FBSDKApplicationDelegate see: FBSDKApplicationDelegate.m#L212.

Please open a new issue if initializing the SDK according to the getting started instructions does not resolve the issue. You should not need to add that observer yourself.

Closing since it seems like the issue is resolved. Thank you for bringing this up and for helping provide a useful repro sample!!!

@joesus joesus closed this as completed Dec 8, 2021
@joesus
Copy link
Contributor

joesus commented Dec 8, 2021

On second thought. Will leave this open for now and work on a patch fix since this is definitely a breaking change.

@joesus joesus reopened this Dec 8, 2021
facebook-github-bot pushed a commit that referenced this issue Dec 8, 2021
Summary: Relevant information in the changelog.

Reviewed By: samodom

Differential Revision: D32954165

fbshipit-source-id: 171bbb35e5243f13d14b9bdeb48ec61143e062e5
facebook-github-bot pushed a commit that referenced this issue Dec 8, 2021
Summary: Relevant information in the changelog.

Reviewed By: samodom

Differential Revision: D32954165

fbshipit-source-id: 9cc512b8ec6c79be557fa54440fdb2528f830b34
@jawwad jawwad assigned jawwad and unassigned jawwad Dec 10, 2021
@jawwad jawwad added this to the v12.2.1 milestone Dec 10, 2021
@jawwad
Copy link
Contributor

jawwad commented Dec 10, 2021

@vipinsaini0, @rromanchuk, @dejiapps - We just released v12.2.1 which should fix this issue.

Special thanks to @rromanchuk for troubleshooting and providing a sample project and to @joesus for fixing the issue!

@jawwad jawwad added the fixed-in-main The fix has been committed to main but may not have been released yet label Dec 10, 2021
@jawwad jawwad closed this as completed Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed-in-main The fix has been committed to main but may not have been released yet
Projects
None yet
Development

No branches or pull requests

5 participants