ld: 871 duplicate symbols for architecture armv7, clang: error: linker command failed with exit code 1 (use -v to see invocation) - iphone

I am using FastPDFKit in my iPhone app for displaying PDF. When I run the project on simulator, it works fine. However when I run the project on iPhone, it gives me below error.
duplicate symbol _value_map in:
/Users/alkandari/Desktop/iPhone Apps/MyTest002/MyTest002/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit)
duplicate symbol _writeUnicodeToUTF8Buffer in:
/Users/alkandari/Desktop/iPhone Apps/MyTest002/MyTest002/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit)
ld: 871 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: 871 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea why it is happening like this?
Error comes when I add FastPDFFramework in Configuration in Debug and Release section.

Here's a solution I found even after messing with the header/framework search paths, rebuilding, etc:
http://support.fastpdfkit.com/discussions/problems/443-i-am-unable-to-link-fastpdfkitembeddedframework
I removed the -all_load linker flag in my project and it compiled successfully. As a warning, make sure removing this flag is appropriate for your project. It was probably placed there for a reason

Can you try to clean up the FastPdfKit target and recompile it? It should generate a new framework ex-novo that you then should be able to add to you project, overwriting the one you are using. You can grab the new .embeddedframework in the FastPdfKit project root directory.
These line helped me from the link below.
http://support.fastpdfkit.com/discussions/problems/759-duplicate-symbols-for-architecture-armv7

there are another reason this error often happens is accidentally importing the .m file instead of the .h.
it's happened to me :)
link : https://stackoverflow.com/questions/12279622/duplicate-symbols-for-architecture-i386-clang

You have too many #include or #import directives in header files for the same things. Move to using #class in headers and only import/include in your .m files.
In all you just need to review where these are and reassess them.

I add my solution, as if you follow the readme, it will ask you to do:
Inherit the project options: select the Project an from info tab and configurations line choose **FastPdfKitFramework** from the drop down list;
I replace the FastPdfKitFramework target to None and now it work great.
As it is on the readme file, I never add .a in my project so download the recompile one don't help me as I do not want to restart all integration.
I hope it can be helpful for someone.

I tries removing -all_loads linker flag, and it worked for me without any problem in the project.

Related

Xcode 10 Error: linker command failed with exit code 1

I just updated my Xcode to Xcode 10 and now my project will not run and I get the error:
ld: library not found for -lstdc++.6
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I do not know what this means and how to fix it. I tried googling everywhere for the answer and came up with nothing. How can I fix this?
Open the projectname.xcworkspace if you are using cocoapods not the projectname.xcodeproj.
Alternatively, using terminal
$ open projectname.xcworkspace
Hope this helps.
I had this problem today in C++ using a newly upgraded Xcode 10 in a project that does not use pods, unlike the other answers.
When I clicked on the linker error there were no details given. This stumped me for a while and then I realised you can right-click the linker error and click "reveal in log".
In my case it was just a function that I had renamed-but-not-updated-all-the-references-to-it causing a linker error, but the real problem was that the linker error details were not being shown when the error occurred.
go to your project directory in the terminal
Type:
pod deintegrate
pod install
In your project, open the Project Navigator, and expand the Frameworks folder. You will see the file -lstdc++.6 highlighted in red, delete it, rebuild your project and you're good to go.
You can open the RN..xcworkspace, and expand the Frameworks folder. You will see the file highlighted in red, delete it,
Learn the build and rebuild the project,
This problem will be resolved. goog cluck!
please use cocoapods for dependency management, if you already using it then remove all pods and add it again / update all pods
https://stackoverflow.com/a/52050043/9978212

clang: error: linker command failed with exit code 1 (use -v to see invocation) Parse.com and Swift

so today I updated my code to Swift 2 and now my app won't run because apparently the Parse Frameworks I was using have expired or something. This is the message I get: ld:
'/Users/tripphillips1/Desktop/Spotter/Parse.framework/Parse(PFAnalytics.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
Does anyone know what this means and how i can fix it?
Thanks
Ok so I found a solution to my problem. You have to go into the Build Settings and disable the Bitcode. Simple as that. Now it runs fine.

library not found for -lstdc++ in Xcode

I am using the openCV2.framework in my application. It works fine in the simulator, but is not compiling for iOS devices. It get the following error
ld: library not found for -lstdc++
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I added other linking flag also...
Try using libc++ instead of stdc++. (lib)std++ went GPLv3, so Apple is pushing libc/c++ instead.
I am answer my own question. I solved this problem by add the go to Target -> BuildSettings ->search Path -> library Searchpath
give the correct path of added dynamic library Path .
Now it will work

Objective-C linker error in 2 libraries

I work with 2 libraries in the same project. One require setting key "Other Linker Flags", one don't require.
For the first library, "Other Linker Flags" must be set to "-ObjC" and "-all_load" to run properly. But if so, the second library go to compiled error:
ld: duplicate symbol _parseAdvertizeTag in /Users/Applehouse/working/joshibu/svn/B_SOURCE/ProGir/ProGir/CCIAd/libCCIMobile-Release.a(TagParser.o) and /Users/Applehouse/working/joshibu/svn/B_SOURCE/ProGir/ProGir/CCIAd/libCCIMobile-Debug.a(TagParser.o) for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The error occur only when I set the flags. If I don't use the first library, I set the setting "Other Linker Flags" as no values, there's no error, the second library run properly.
How do I fix it?
Thank you.
Look carefully at the error message. You are linking both the Debug (libCCIMobile-Debug.a) and Release (libCCIMobile-Release.a) version of the library at the same time.
Link only the debug version for your debug builds, and only the release version for your release builds.
You are included a two libraries at one target. That's is wrong.
Because in this two libraries a many same values. First is a _parseAdvertizeTag error.
You must use in 1 target only libCCIMobile-Release.a or libCCIMobile-Debug.a

GCC-4.2 Failed With Error Code 1

I am receiving the following error out of the blue after trying to build my iPhone Application onto my iPod Touch:
Command /Xcode3/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
I am also receiving the following warnings which I presume have something to do with this error, maybe a possible cause:
ld: warning: in /Users/Max/git/iTopCharts/iTopCharts/Classes/NSAdditions/libNSAdditions_Device.a, missing required architecture i386 in file
ld: warning: in /Xcode3/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/libSystem.dylib, missing required architecture i386 in file
ld: in /Xcode3/Platforms/iPhoneOS.platform/DeviceSupport/4.2.1 (8C148)/Symbols/usr/lib/libobjc.A.dylib, missing required architecture i386 in file
All help with this is extremely appreciated, as I have spent days making this application.
This error is caused by many different problems.
Sometimes it gets called, when some file has been deleted, but its reference is still in the Xcode.
OR
It might occurs, if you have copy-pasted data from some other project. In some cases, Xcode keeps the reference with it. (If this is the case, then you need to trace that variable, and rename it)
If none of above meets your case, then you need to look at the error in more details. For this,
In xcode, right click the error line and choose "Open These Latest Results as Transcript Text File". This will open the real xcode output log, which should contain a better description of the error then was previously seen.
EDIT:Be sure to search 'exit code 1' and the description will be right above the results.
I hope it helps