Reputation: 8115
I now have the same question with above title but have not found the right answer yet. I got the error:
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o)
duplicate symbol _OBJC_METACLASS_$_MoboSDK in:
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o
/Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o)
ld: 75 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help is appreciated.
Finally I find out the reason of this error cause I added -ObjC
to the Other Linker Flags
. After remove this value then I can build my project successfully, but I don't know why. Can anyone explain this?
Upvotes: 308
Views: 431084
Reputation: 54
When using swiftui swift package manager, remove @Main attribute from swiftui code.
Upvotes: 1
Reputation: 117
If you are still unable to resolve this issue, try Product > Clean Build Folder ...
That's the only thing that worked for me.
Upvotes: 0
Reputation: 27
My issue with this error was the Podfile. I'm using Firebase and one of their pods was the problem.
Upvotes: 0
Reputation: 15333
If you're coming here for a React Native
Project, then go to the following,
Targets -> <Your-App> -> Build Settings -> Dead Code Stripping
Change from No
to Yes
for Debug
.
P.S. This approach works for React Native projects, not sure if it will work for a native project too.
Upvotes: 4
Reputation: 35
So, I have solved this by deleting pods which is related to Fabric, because it was conflicting with Crashlitics pod, since they actually duplicate each other, because Fabric it's just old version of Crashlitics
Upvotes: 0
Reputation: 423
I got the same issue in Xcode 14. Cleaning the build folder worked for me.
Select "Clean Build Folder" option from "Product" menu.
Upvotes: 0
Reputation: 111
I am also faced this issue on FBReactNativeSpec, just made check on Run script - For install builds only
Upvotes: 0
Reputation: 1133
For me, this happened when mistakenly I defined two entry points for my APP
@main struct AppName: App { //Comment - @main
Or
@UIApplicationMain class AppDelegate //Comment - @UIApplicationMain
Upvotes: 3
Reputation: 61
Ive got this error after installed alamofire
s pod, but alamafire was already installed as package through xcode`s File/Add Packages.... error gone after I removed the package and also removed it from Targets/General/Frameworks...
Upvotes: 0
Reputation: 2471
For the case of React Native, the solution was simply deleting all of the libraries in: Target > Build Phases > Link Binary with Library.
I don't really know the cause, but I assume React Native already has the packages installed, creating duplicates.
Upvotes: 1
Reputation: 5686
My problem was that I had 5 duplicate symbols for architecture x86_64. After reading this post and their answers, I try with the common solution about change GCC_NO_COMMON_BLOCKS = YES
to NO
But, instead of working for me, I went from 5 duplicates to 1 duplicate...
So, I paid attention to that last error, and I realized what was my problem, and it was an "incompatibility" with these packages (I had both in package.json
):
rn-fetch-blob
react-native-blob-util
The message was clear about it, and I remove rn-fetch-blob
because I have not idea why it was in my project, but, I only used with jest and delete it, it wasn't a problem.
So, after removing that package, and run yarn
again, problem solved... And without changing the GCC_NO_COMMON_BLOCKS
Upvotes: 10
Reputation: 203
This Answer works with Xcode 12.5.1, worked for me on 2021
If you use swift you're done here jump to xcode and run the app or keep on if you're using flutter
flutter clean
.flutter pub get
.flutter run
. Don't forget to run the simulator before you use flutter run command.Congrats everything should work!
Upvotes: 1
Reputation: 590
I tried following this steps and It works for me now.
Open Xcode > Pods > Targets Support Files > Pods-{TARGET-NAME}
find "OTHER_LDFLAGS" and remove only "-ObjC" in these two files:
Pods-{TARGET-NAME}.release.xcconfig & Pods-{TARGET-NAME}.debug.xcconfig
Go to project main target > Build Settings > Other Linker Flags:
Make sure no "-ObjC" is left in the value
I deleted the build/Build folder in ios and run-ios again. It works now.
Upvotes: 1
Reputation: 1825
My mistake was having implemented functions in header files. There should be a clear separation between function definitions in header files, and function implementations in the code files.
For example, I had something like:
my_header.h
#ifdef my_header_h
#define my_header_h
int foo() { return 123; }
#endif // my_header_h
which should be:
#ifdef my_header_h
#define my_header_h
int foo();
#endif // my_header_h
Upvotes: 1
Reputation: 1239
If you have some common functions defined in a header file, change them into inline
.
Upvotes: 1
Reputation: 7613
Update answer for 2021, Xcode 12.X:
pod deintegrate
pod install
Hope this helps!
Upvotes: 11
Reputation: 1273
Open your project in XCode
you will see the sidebar now focus on the attached image.
Search your specific SDK or any dublicate file where you facing an issue.
You will see that you have added any file twice.
just remove that file and your issue will be resolved.
Note: you have to remove the file from that place where you add it wrongly.
Note: Just remove FBSDKCoreKit from Frameworks
Good Luck
Upvotes: 0
Reputation: 63
I've just had this error as well. Found that the problem was variables declared with global scope, with the same names, were being repeated throughout the files being compiled into the program. Once changing the global variables to local scope to the pseudo-main function the error was resolved.
Upvotes: 4
Reputation: 1555
1.Go to Build Phases
2.Search for the file name
3.Delete duplicate
-> Error will go away.
If it doesn't, try to search for "file.m", if you see any #import "file.m" , clear this line
Upvotes: 2
Reputation: 532
I simply just unistalled all my pods and reinstalled them. I also got rid of some pods i did not use.
Upvotes: 0
Reputation: 416
In my case, i changed the Build System to Legacy and it worked.
You can access this option in the menu:
File > Workspace Settings > Build System
Upvotes: -1
Reputation: 174
None of the above mentioned answer helped, as i had similar errors in pods and locally stored framework that looked like this,
duplicate symbol '_OBJC_METACLASS_$_EZAudioDevice' in:
/Users/(yourUserName)/Desktop/Source Code/(yourProjectName)/Pods/AudioKit/iOS/AudioKit.framework/AudioKit(EZAudioDevice.o)
/Users/(yourUserName)/Desktop/Source Code/(yourProjectName)/ChirpSDK.framework/ChirpSDK(EZAudioDevice.o)
So the fix was to locate /Users/(yourUserName)/Desktop/Source Code/(yourProjectName)/Pods
directory in project where you will find these two files namely,
In both of these files, you need to remove -ObjC
flag under OTHER_LDFLAGS = $(inherited)
, the rational for removing this is as same as already mention here
Upvotes: 0
Reputation: 175
just uninstall the pod which it is related to and reinstall them.
Upvotes: 0
Reputation: 2315
I just encoutered the problem. The pod deintegrate
or Removing podfile.lock
ways would be helpful for you, but try the following sequence , that may be more helpful than deintegrating the pod files
Podfile
pod install
, it will remove Pods
folder from the projectPodfile
pod install
Upvotes: 1
Reputation:
If you're using and think it might be your pods, try this:
pod deintegrate
pod install
Upvotes: 2
Reputation: 597
I experienced this issue after installing Cocoapods. Now happens everytime I update some pods. Solution I've found:
Go to terminal:
1) pod deintegrate
2) pod install
Also, check the item "Always Embed Swift Libraries" in your Build Settings. It should be "faded" indicating it is using the default configuration. If its set to a manual YES, hit delete over it to revert it to the default configuration. This stopped the behavior.
Upvotes: 24
Reputation: 414
Because I haven't seen this answer:
Uninstall and reinstall your podfiles! Remove or uninstall library previously added : cocoapods
I've run into this issue over 3 times building my app and every time this is what fixes it. :)
Upvotes: 4
Reputation: 263
The answers above didn't work for me. Here's how I got around it:
1) in finder, delete the entire Pods folder and Podfile.lock file 2) close the xcode project 3) run pod install in the terminal 4) open the xcode project, run the clean build command
Worked for me after that.
Upvotes: 4
Reputation: 3280
Sometimes, this happens when you have the wrong file in import like for ex.:
import "MenuItem.m"
Instead of
import "MenuItem.h"
this will throw that duplicate error duplicate symbols for architecture x86_64
Upvotes: 3