How to fix the error "duplicate symbol _LOG_BUFFER_LENGTH" - ios

I have a Unity project embedded into Swift 4 and when I build the project I get an error from a plugin named FFmpeg (used to record the screen) and the error is next:
duplicate symbol _LOG_BUFFER_LENGTH in:
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/cmdutils.o
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/ffmpeg.o
duplicate symbol _LOG_BUFFER_LENGTH in:
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/cmdutils.o
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/ffmpeg_wrapper.o
duplicate symbol _LOG_BUFFER_LENGTH in:
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/cmdutils.o
/Users/developers/Library/Developer/Xcode/DerivedData/DemoApp-bszfgmzljpyourbdjoxkdabtilki/Build/Intermediates.noindex/DemoApp.build/Debug-iphoneos/DemoApp.build/Objects-normal/arm64/intercept.o
ld: 3 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I want to specify that if I export the project from Unity to Xcode without to embed it is working perfectly with this Plugin.
What can be the problem with this error ?
Until now I tried next thing to remove the error but none helped me:
I checked if I have "-ObjC" in Xcode in "Other Linker Flags" and I don't have.
I removed a duplicate library (“libil2cpp.a”) from "Link Binary With Libraries" (XCODE)
I changed 'No Common Blocks' from Yes to No (under Targets->Build Settings->Apple LLVM - Code Generation )
At the end I have the same error.
Here is a print screen:
Thank you so much if you spend your time to read this and any idea will be helpful.

For me this helped:
Step 1: Go to TARGETS -> Build Settings -> No Common Blocks -> No
Step 2: Go to TARGETS -> Build Settings -> enable testability -> No
Additionally you can check Build Phases -> Compile Source. Check duplications.

Related

duplicate symbol with a third party lib for arm64. ok with armv7

I am trying to integrate an ad network called 'adsmogo' http://adsmogo.com/.
I got duplicate symbol error for arm64, but it's ok with armv7.
I checked all similar questions on stackoverflow, but no one solved my problem.
duplicate symbol l108 in:
/Users/xxxxxx/Desktop/mm/mm/AdsMoGoLib/AdsMoGoSDK/libAdsMogo.a(AdMoGoView.o)
/Users/xxxxx/Desktop/mm/mm/AdsMoGoLib/AdsMoGoSDK/libAdsMogo.a(AdsMogoMraidJSBridge.o)
ld: 403 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Solution 1
You need to do this:
Click on your project (targets)
Click on Build Settings
Under Library Search Paths, delete the paths
May be this will help you.
Solution 2
You have duplicate symbol method which means there are duplicate file in project
In your Target's Build Phase, under "Compile Sources" check if there are duplicate file and delete one if you have duplication.
Hope this will help you.

Duplicate sybmol [SOAPEngine-iOS]

what is the problem here, it builds with real iphone device but when I want to build/run it with iPhone Simulator it show like this
duplicate symbol _DictionaryForNode in:
/Users/**/Library/Developer/Xcode/DerivedData/**-gfeynokufbufhkgjzjzwlijxekpb/Build/Intermediates/**.build/Debug-iphonesimulator/**.build/Objects-normal/i386/XPathQuery.o
/Users/**/Downloads/SOAPEngine-master/SOAPEngine64.framework/SOAPEngine64(SOAPXPathQuery.o)
duplicate symbol _PerformXPathQuery in:
/Users/**/Library/Developer/Xcode/DerivedData/**-gfeynokufbufhkgjzjzwlijxekpb/Build/Intermediates/**.build/Debug-iphonesimulator/**.build/Objects-normal/i386/XPathQuery.o
/Users/**/Downloads/SOAPEngine-master/SOAPEngine64.framework/SOAPEngine64(SOAPXPathQuery.o)
ld: 2 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
FYI: there is no .m import or duplicate files in Build Phase
Select the target and check out Build Phases. Make sure the same file isn't listed more than once.
if you have XPathQuery.h/m in your project, in SOAPEngine it is already integrated, you need to remove only XPathQuery.m from your project, leave only XPathQuery.h, in the next version of SOAPEngine we'll fix this problem, please open an issue on GitHub for it.

Linker command failed: duplicate symbol for architecture i386

I added the XYPieChart folder into my Swift project on XCode 6 but now I'm getting this "Apple Mach-O Linker Error":
duplicate symbol _main in:
/Users/ansariha/Library/Developer/Xcode/DerivedData/Juxta-bjrfrzoyetsowibjdgpcxtesgwtg/Build/Intermediates/Juxta.build/Debug-iphonesimulator/Juxta.build/Objects-normal/i386/AppDelegate-EE692B7EDFB39C7A.o
/Users/ansariha/Library/Developer/Xcode/DerivedData/Juxta-bjrfrzoyetsowibjdgpcxtesgwtg/Build/Intermediates/Juxta.build/Debug-iphonesimulator/Juxta.build/Objects-normal/i386/main.o
ld: 1 duplicate symbol for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Below that it says "1 duplicate symbol for architecture i386" and then below that, the error: "Linker command failed with exit code 1 (use -v to see invocation)".
Has anyone ever seen this before?
Go to your project Bundle in xcode -> Build Phases -> Compile Sources
Check whether one of the files are added twice or not. This might be the case where such things happen.
Your AppDelegate might be added twice. Remove one of them.
Updated:
Some time you accidentally importing the .m file instead of the .h due to which this error comes. Please check and If this is not the reason, then perform the following steps
1- Check Build phases in Target settings.
2- Go to compile source section.
3- Check if any file exists twice or once.
4- If file exist twice delete one.
5- Build again.
This error occurs duplication of file in your project. click on The Project Navigator and search Duplicate file. in your project duplication of Appdelegate class or main. Remove one of file from your project.

Apple Mach-O Linker Error with the introduction of SocketRocket

I'm using Xcode Version 6.0.1 (6A317)and stuck with Apple Mach-O error for a long time. I get this error once I introduce SocketRocket project.
duplicate symbol _OBJC_IVAR_$_AppDelegate._window in:
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-113CA4C4B5D4CC68.o
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-D68FF7E1CDB59174.o
duplicate symbol _OBJC_METACLASS_$_AppDelegate in:
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-113CA4C4B5D4CC68.o
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-D68FF7E1CDB59174.o
duplicate symbol _OBJC_CLASS_$_AppDelegate in:
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-113CA4C4B5D4CC68.o
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/AppDelegate-D68FF7E1CDB59174.o
duplicate symbol _OBJC_CLASS_$_ViewController in:
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-7B952F801D984E6D.o
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-99529767CD55CC78.o
duplicate symbol _OBJC_METACLASS_$_ViewController in:
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-7B952F801D984E6D.o
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/ViewController-99529767CD55CC78.o
duplicate symbol _main in:
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/main-B74D1ABF07758C74.o
/Users/anuradhavasudeva/Desktop/Buzz/Complete/CWPAYou/Build/Intermediates/CWPAYou.build/Debug-iphonesimulator/CWPAYou.build/Objects-normal/i386/main-F48A7B3907D55170.o
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have made sure to follow the steps given in https://github.com/square/SocketRocket
the only exception I see is SocketRocket.framework was showing red when I tried adding it under + Link Binary with libraries.
I have added the following libraries:
Security.Framework
CFNetwork.Framework
UIKit.Framework
Foundation.Framework
libicucore.dylib
libsocketrocket.a
libresolv.dylib
I've set other linker flags to -ObjC
Build Active Architecture only - No, because setting it to Yes throws an error : Check dependencies. No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=i386).
Valid Architectures - armv64 armv7 armv7s
This issue is really killing my time. I tried to follow other posts but nothing could help me solve the issue!
1.- Are you importing a .m file inside another .m file instead of the Header? It happens by mistake some times and causes that issue.
2.- Check in your Compile Sources under Build Phases that you are not including same file 2 times although from the looks of it this doesn't seem the problem.
3.- If all else fails. Clean DerivedData folder for the project in Organizer. Clean and re-build.

how to fix these errors in xcode?

I finished my game but when I hit run, i'm getting these errors:
I need to change "JohnsPC" to my name!
ld: warning: directory not found for option '-L/Users/JohnsPC/Desktop/Logo Mania?/Code/Yeah/PuzzleGame'
ld: library not found for -lChartboost
clang: error: linker command failed with exit code 1 (use -v to see invocation)
And the second error I have no Clue
How do I fix these?
check the target - Build Settings -> Library Search Path and set proper path for library on your mac
also use macro $(SOURCE_ROOT) to avoid this kind of problem
Try this :
Go to Targets -> Build Phases -> Link Binary With Libraries
Click on + symbol & press Add Other
Select your library

Resources