XCode 10 beta 5 issue: -ObjC linker flag causing many duplicate symbol errors

Hi Apple,


I recently installed XCode 10 beta 5 and tried to compile a project that uses the -ObjC flag. It requires this flag, becuse some of the frameworks (via cocoapods) add static functions via categories.


I get a ton of duplicate symbol errors and cannot compile. Example:


duplicate symbol l086 in:
    /Users/Tim/iPhone-dev/Photobooth/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSFileManager.o)
    /Users/Tim/iPhone-dev/Photobooth/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(CLSInternalReport.o)

(that example is a Google framework: Fabric->Crashlytics)


This is the first time i've tried XCode 10 with this project, so I cannot tell if this is new in beta 5 or not.

This issue does NOT occur in XCode 9 newest version -- it compiles fine as it has for years.

I have also posted this issue on StackOverflow.


Full linker command is:

Ld /Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/appname.app/appname normal arm64 (in target: appname) cd /Users/Username/iPhone-dev/appname export IPHONEOS_DEPLOYMENT_TARGET=9.0 /Users/Username/Downloads/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch arm64 -isysroot /Users/Username/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.0.sdk -L/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/AFNetworking -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/Actions -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/AppAuth -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/Bluepeer -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/Bolts -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/CocoaAsyncSocket -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/CocoaLumberjack -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/Color-Picker-for-iOS -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/DNPWPSPrinter -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/DataCompression -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/EOSFTPServer -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/FBSDKCoreKit -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/FBSDKLoginKit -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/FastttCamera -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/FirebaseAuth -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/FirebaseCore -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/FirebaseDatabase -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/FirebaseStorage -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/GTMAppAuth -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/GTMSessionFetcher -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/Gloss -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/GoldRaccoon -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/GoogleToolboxForMac -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/HHServices -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/JPSVolumeButtonHandler -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/M13BadgeView -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/ObjectiveDropboxOfficial -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/PhoneNumberKit -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/Protobuf -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/TPCircularBuffer -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/leveldb-library -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/nanopb -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/upnpx -F/Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/xaphodObjCUtils -F/Users/Username/iPhone-dev/appname/Pods/Crashlytics/iOS -F/Users/Username/iPhone-dev/appname/Pods/Fabric/iOS -F/Users/Username/iPhone-dev/appname/Pods/FirebaseABTesting/Frameworks -F/Users/Username/iPhone-dev/appname/Pods/FirebaseAnalytics/Frameworks -F/Users/Username/iPhone-dev/appname/Pods/FirebaseDynamicLinks/Frameworks -F/Users/Username/iPhone-dev/appname/Pods/FirebaseInstanceID/Frameworks -F/Users/Username/iPhone-dev/appname/Pods/FirebaseRemoteConfig/Frameworks -F/Users/Username/iPhone-dev/appname/Pods/TwitterCore/iOS -F/Users/Username/iPhone-dev/appname/Pods/TwitterKit/iOS -F/Users/Username/iPhone-dev/appname/cascablecore-binaries/Binaries/iOS -filelist /Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Intermediates.noindex/appname.build/Debug-iphoneos/appname.build/Objects-normal/arm64/appname.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -Xlinker -rpath -Xlinker @executable_path/Frameworks -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Intermediates.noindex/appname.build/Debug-iphoneos/appname.build/Objects-normal/arm64/appname_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -L/Users/Username/Downloads/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos -Xlinker -add_ast_path -Xlinker /Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Intermediates.noindex/appname.build/Debug-iphoneos/appname.build/Objects-normal/arm64/appname.swiftmodule -ObjC -lc++ -licucore -lsqlite3 -lz -framework AFNetworking -framework AVFoundation -framework Accounts -framework Actions -framework AppAuth -framework AssetsLibrary -framework Bluepeer -framework Bolts -framework CFNetwork -framework CocoaAsyncSocket -framework CocoaLumberjack -framework Color_Picker_for_iOS -framework CoreData -framework CoreGraphics -framework CoreMedia -framework CoreText -framework Crashlytics -framework DNPWPSPrinter -framework DataCompression -framework EOSFTPServer -framework FBSDKCoreKit -framework FBSDKLoginKit -framework Fabric -framework FastttCamera -framework FirebaseABTesting -framework FirebaseAnalytics -framework FirebaseAuth -framework FirebaseCore -framework FirebaseCoreDiagnostics -framework FirebaseDatabase -framework FirebaseDynamicLinks -framework FirebaseInstanceID -framework FirebaseNanoPB -framework FirebaseRemoteConfig -framework FirebaseStorage -framework Foundation -framework GTMAppAuth -framework GTMSessionFetcher -framework Gloss -framework GoldRaccoon -framework GoogleToolboxForMac -framework HHServices -framework JPSVolumeButtonHandler -framework M13BadgeView -framework MessageUI -framework MobileCoreServices -framework ObjectiveDropboxOfficial -framework PhoneNumberKit -framework Protobuf -framework QuartzCore -framework SafariServices -framework Security -framework Social -framework StoreKit -framework SystemConfiguration -framework TPCircularBuffer -framework TwitterCore -framework TwitterKit -framework UIKit -framework leveldb -framework nanopb -framework upnpx -framework xaphodObjCUtils -weak_framework WebKit -ObjC -lc++ -licucore -lsqlite3 -lz -lctemplate-ios -letpan-ios -lxml2 -lsasl2 -liconv -ltidy -lz -lc++ -lresolv -stdlib=libc++ -ObjC /Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/libMailCore-ios.a -framework SafariServices -framework CascableCore -framework Security -framework CFNetwork -framework MessageUI -framework StoreKit -framework GameKit -framework StopKit -framework Pods_appname -Xlinker -dependency_info -Xlinker /Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Intermediates.noindex/appname.build/Debug-iphoneos/appname.build/Objects-normal/arm64/appname_dependency_info.dat -o /Users/Username/Library/Developer/Xcode/DerivedData/appname-lastnamepjksdzfewpftlvqzuglaxplu/Build/Products/Debug-iphoneos/appname.app/appname


I read through the release notes for XCode 10 but didn't see anything applicable.

I tried cleaning the build folder, restarting XCode, didn't help.


Thanks for any help, i'm blocked on this.

Replies

Update: on the stackoverflow post (link in original post), people are saying that this is new in beta 5 (ie. beta 4 works for them)

I have same problem.

In Armv7 mtch-o file works fine.

But in arm64 the issue show up.

I found out in arm64 __objc_classrefs is name such as "lXXX".

May the linker in Xcode10 beta5 messed up....

Same thing happening for me in XCode 10 beta 5

Giving a lot of "duplicate symbol" error. It was working fine in previous XCode 10 beta versions.


duplicate symbol l031 in:

/Users/bilalhafeez/Documents/IOS/Pods/Crashlytics/iOS/Crashlytics.framework/Crashlytics(ANSCrashEvent.o)

Same here! I tried a new test project with only the following 3rd party libs, which gives compile error.

"Fabric"

"Crashlytics"

"GoogleAnalytics"


It works fine with iOS12 Simulaotrs, but not real devices.

For iOS 12 devices, it says: "duplicate symbols for architecture arm64"

For iOS 11 devices, it says: "symbol(s) not found for architecture armv7"

Using the same exact frameworks and getting the same duplicate symbol error. Did not have this problem using Xcode 10 beta 4.

@Apple:


This is a big big problem because apps with these pods- which many apps use- now can't be built and tested.


In the mean time, does anyone know how I can download Xcode 10 Beta 4 again?


Thanks,

Daniel

This is a big big problem …

DevForums is not the right place to report “big big problems”. Rather, in situations like this you should report the problem officially by filing a bug report.

Having said that, it seems that numerous other folks have filed bugs about this issue (r. 42155133). I’m hoping it will be fixed soon but, as always, I can’t speculate about The Future™. However, if the bug persists in the next seeded version of Xcode 10, please follow-up here and I’ll take another look. [See below.]

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I’ve been talking to the linker folks about this issue and it seems that I misinterpreted the resolution of this bug. Specifically, the bug in question (r. 42155133) is actually fixed in Xcode 10.0b5. However, this fix is not interoperable with broken static libraries that were built with older Xcode 10.0 betas.

The best way to fix this problem is to do a full rebuild of your project with Xcode 10.0b5. However, this won’t work if you’re dependent on a static library from a third-party vendor for which you don’t have source code. In that case I don’t have a specific recommendation right now, but I’m actively researching this and I’ll update this thread when I know more.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

>However, this fix is not interoperable with broken static libraries that were built with older Xcode 10.0 betas.


This doesn't seem to jibe with my experience. I had issues with getting the latest Fabric (1.7.9) & Crashlytics (3.10.5) frameworks to link for device on Xcode 10 beta 5, exactly as the original poster describes. From their framework plist files, I see:


<key>DTXcodeBuild</key>

<string>9F2000</string>


This suggests that they were built with Xcode 9.4.1, rather than an Xcode 10 beta. I guess they could be doing something wacky with a mixed version toolchain, but that seems unlikely. Filed a bug with a reproducible case here: rdar://43008690

This doesn't seem to jibe with my experience.

Yeah, I’ve seen similar reports from other folks (r. 42783758). At this point I’m going to re-instate the advice that I struck out from my 3 Aug post: If the problem persists in the next seeded version of Xcode 10, please follow-up here and I’ll take another look.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

For me, this issue has been fixed by Xcode 10b6 (just released this morning).

For me, this issue has been fixed by Xcode 10b6 (just released this morning).

Excellent news. Thanks for confirming!

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Xcode 10 beta 6 fix this issue.