Compile protobuf with Xcode 5 using CocoaPods - xcode

I am trying to add GoogleProtobuf (2.5.0) to my application. From what I have read, the best way is to use CocoaPods. So I went through a tutorial for getting started with CocoaPods. I got all the way to where I ran pod install in my project folder and it created the project workspace. I open the project workspace and try to clean/build and I receive the following error:
I'm a newb at this. Does this mean anything to anyone?
Wow! That's a little picture.
Let me see if I can copy the info in:
Resolving target dependencies
Pods was rejected as an implicit dependency for 'libPods.a' because its architectures 'arm64' didn't contain all required architectures 'armv7'
Write auxiliary files
Ld /Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Products/Debug-iphoneos/Demo.app/Demo normal armv7
cd "/Users/pdl/Development/Application-Demos/iPhone_Demos/Demo"
export IPHONEOS_DEPLOYMENT_TARGET=7.0
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk -L/Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Products/Debug-iphoneos -L/Library/FlurryAnalytics/Flurry_iPhone_SDK_viPhone_4/Flurry-iOS-4.3.1/Flurry -F/Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Products/Debug-iphoneos -F/Library/OpenCV -F/Users/pdl/Library/Developer/Xcode/DerivedData/QlmMobileDeviceSample-cuzqlikbteeedbeaonfqofugyyql/Build/Products/Release-iphoneos -F/Users/pdl/Library/Developer/Xcode/DerivedData/Dummy-iOS-gumpxuupcpajbvamflgypgfwjshp/Build/Products/Release-iphoneuniversal -filelist /Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Intermediates/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/armv7/Demo.LinkFileList -dead_strip -ObjC -lstdc++ -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=7.0 -framework Dummy-iOS-1.1.0 -lFlurry_4.3.1 -framework QlmLicenseMobile -lc++ -framework opencv2 -framework AdSupport -lz -lxml2.2 -framework Security -framework SystemConfiguration -framework AssetsLibrary -framework CoreGraphics -framework UIKit -framework Foundation -lPods -Xlinker -dependency_info -Xlinker /Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Intermediates/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/armv7/Demo_dependency_info.dat -o /Users/pdl/Library/Developer/Xcode/DerivedData/Demo-ggwchkzudvcbibdmaknlspphbkbr/Build/Products/Debug-iphoneos/Demo.app/Demo
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My Podfile contains this:
platform :ios, '7.0'
pod 'GoogleProtobuf', '~> 2.5.0'
When I ran the install, this is the output:
pdl-mbp:Demo pdl$ pod install
Analyzing dependencies
CocoaPods 0.32.1 is available.
Downloading dependencies
Installing GoogleProtobuf (2.5.0)
Generating Pods project
Integrating client project
[!] From now on use `Demo.xcworkspace`.
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
[!] The target `Demo [Debug]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target `Demo [Debug - Release]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The target `Demo [Debug - Release - Ad Hoc Distribution]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
pdl-mbp:Demo pdl$

Okay, so I found s lot of information at the two links provided in my last two comments. Especially this answer to the SO Question.
My issue ended up being that my Pods Valid Architectures had to be the same as the Valid Architectures are in my project.
I spent all day on this and the minute I posted the question, I found an answer that helped me figure out my problem.
I hope this helps somebody else! :-)

Check all libraries of projects. If you see anyone missing (red color) , update it specifically. Or you can thoroughly update all libraries with command "pod update" with going into the projects directory. It solved my problem.

Related

XCode - ld: library not found for -lfile_vacuum

I added a CocoaPod (SwiftySandboxFileAccess) to my project and now I'm getting the following error:
Ld /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug/FileVacuum.app/Contents/MacOS/FileVacuum normal x86_64 (in target 'FileVacuum' from project 'FileVacuum')
cd /Users/mike/Documents/Mikeumus/code/FileVacuum/menubar-filevacuum
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target x86_64-apple-macos10.15 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -L/Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug -L. -LCarthage -LFileVacuum -LFileVacuum.xcworkspace -LFileVacuumLauncher2 -LFileVacuumTests -LFileVacuumUITests -LMenubar-FileVacuumTests -LMenubar-FileVacuumUITests -LPods -LCarthage/Build -LCarthage/Checkouts -LFileVacuum/FileVacuum\ 2020-06-08\ 11-57-59 -LFileVacuum/FileVacuum.xcarchive -LFileVacuum/Pods -LFileVacuum.xcworkspace/xcshareddata -LFileVacuum.xcworkspace/xcuserdata -LPods/Headers -LPods/Local\ Podspecs -LPods/SwiftySandboxFileAccess -LPods/Target\ Support\ Files -LCarthage/Build/Mac -LCarthage/Build/iOS -LCarthage/Checkouts/AppReceiptValidator -LFileVacuum/FileVacuum.xcarchive/Products -LFileVacuum/FileVacuum.xcarchive/SwiftSupport -LFileVacuum/Pods/Headers -LFileVacuum/Pods/Local\ Podspecs -LFileVacuum/Pods/Target\ Support\ Files -LFileVacuum.xcworkspace/xcshareddata/swiftpm -LFileVacuum.xcworkspace/xcuserdata/mike.xcuserdatad -LPods/Headers/Public -LPods/SwiftySandboxFileAccess/SwiftySandboxFileAccess -LPods/Target\ Support\ Files/Pods-FileVacuum -LPods/Target\ Support\ Files/SwiftySandboxFileAccess -LCarthage/Build/Mac/AppReceiptValidator.framework.dSYM -LCarthage/Build/iOS/AppReceiptValidator.framework.dSYM -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator -LFileVacuum/FileVacuum.xcarchive/Products/Applications -LFileVacuum/FileVacuum.xcarchive/SwiftSupport/macosx -LPods/Headers/Public/SwiftySandboxFileAccess -LPods/SwiftySandboxFileAccess/SwiftySandboxFileAccess/Classes -LCarthage/Build/Mac/AppReceiptValidator.framework.dSYM/Contents -LCarthage/Build/iOS/AppReceiptValidator.framework.dSYM/Contents -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Demo\ iOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Demo\ macOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ iOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ macOS -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app -LCarthage/Build/Mac/AppReceiptValidator.framework.dSYM/Contents/Resources -LCarthage/Build/iOS/AppReceiptValidator.framework.dSYM/Contents/Resources -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/Supporting\ Files -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared/Test\ Assets -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared/Tools -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents -LCarthage/Build/Mac/AppReceiptValidator.framework.dSYM/Contents/Resources/DWARF -LCarthage/Build/iOS/AppReceiptValidator.framework.dSYM/Contents/Resources/DWARF -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/include-ios -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/include-macos -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/lib-ios -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/lib-macos -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/Supporting\ Files/iOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/Supporting\ Files/macOS -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared/Test\ Assets/Other\ Receipts -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents/Frameworks -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents/MacOS -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents/Resources -LFileVacuum/FileVacuum.xcarchive/Products/Applications/FileVacuum.app/Contents/_CodeSignature -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/include-ios/openssl -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator/OpenSSL/include-macos/openssl -LCarthage/Checkouts/AppReceiptValidator/AppReceiptValidator/AppReceiptValidator\ Tests\ Shared/Test\ Assets/Other\ Receipts/unparseable -L/Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug/SwiftySandboxFileAccess -F/Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug -F/Users/mike/Documents/Mikeumus/code/FileVacuum/menubar-filevacuum/Carthage/Build/Mac -filelist /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/FileVacuum.build/Debug/FileVacuum.build/Objects-normal/x86_64/FileVacuum.LinkFileList -Xlinker -rpath -Xlinker #executable_path/../Frameworks -Xlinker -object_path_lto -Xlinker /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/FileVacuum.build/Debug/FileVacuum.build/Objects-normal/x86_64/FileVacuum_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-link-runtime -fprofile-instr-generate -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -L/usr/lib/swift -Xlinker -add_ast_path -Xlinker /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/FileVacuum.build/Debug/FileVacuum.build/Objects-normal/x86_64/FileVacuum.swiftmodule -ObjC -lSwiftySandboxFileAccess -framework AppReceiptValidator -framework Automator -lfile_vacuum -lresolv -lPods-FileVacuum -Xlinker -dependency_info -Xlinker /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/FileVacuum.build/Debug/FileVacuum.build/Objects-normal/x86_64/FileVacuum_dependency_info.dat -o /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Products/Debug/FileVacuum.app/Contents/MacOS/FileVacuum -Xlinker -add_ast_path -Xlinker /Users/mike/Library/Developer/Xcode/DerivedData/FileVacuum-defywbakdmgzprcegfjrlcpktbta/Build/Intermediates.noindex/SwiftyStoreKit.build/Debug/SwiftyStoreKit.build/Objects-normal/x86_64/SwiftyStoreKit.swiftmodule
ld: library not found for -lfile_vacuum
clang: error: linker command failed with exit code 1 (use -v to see invocation)
pod install and pod update was giving the following warnings:
[!] The `FileVacuum [Debug]` target overrides the `LIBRARY_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-FileVacuum/Pods-FileVacuum.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `FileVacuum [Release]` target overrides the `LIBRARY_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-FileVacuum/Pods-FileVacuum.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
I changed the "Target" level LIBRARY_SEARCH_PATHS to $(inherited) and these warnings went away but I changed the "Project" level LIBRARY_SEARCH_PATHS and don't remember what it was before I changed it so I just set it to $(inherited), $(PROJECT_DIR) recursive
I have done the following:
Close the Xcode;
Run pod install and pod update;
Open the new .xcworkspace;
Clean and Build Project;
Here's some of app's settings:
LIBRARY_SEARCH_PATH setting is the same for the "Project" and "Target" levels:
"file_vacuum" doesn't result in a file/settings search:
In the screenshot above this one you can see I'm linking a libfile_vacuum.a, I don't know if this is the same file_vacuum causing the issue.
Podfile
platform :macos, '10.15'
target 'FileVacuum' do
pod 'SwiftySandboxFileAccess', '~> 2.0'
end
It looks like it is failing to locate file_vacuum library which is a static library based on your screenshots. Make sure you add the path for that file in your LIBRARY_SEARCH_PATH in your target Build Settings. You can also just search for search paths and find it there. In general, whenever there's an error about not finding a header file or an object, it's related to search paths and means Compiler isn't able to find information for that type / library.
Framework, Library, and Header search paths are the three types you can define and help the Compiler to find those files.

OSX application fails to compile after adding the Firebase Library

I'm building a windowless menubar application (agent) with a popover. This application requires an integration with Firebase to retrieve some data from this store. XCode version is 6.3.
After installing the latest version of cocoapods (0.38.2) and creating the Podfile as such:
# Uncomment this line to define a global platform for your project
platform :osx, '10.10'
pod 'Firebase', '>= 2.3.3'
target 'dTrain-osx-agent' do
end
target 'dTrain-osx-agentTests' do
end
I'm getting the following build failure error:
Ld /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug/dTrain-osx-agent.app/Contents/MacOS/dTrain-osx-agent normal x86_64
cd /Users/user/Projects/interop/dtrain_osx/dTrain-osx-agent
export MACOSX_DEPLOYMENT_TARGET=10.10
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -L/Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug -F/Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug -F/Users/user/Projects/interop/dtrain_osx/dTrain-osx-agent/Pods/Firebase -filelist /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Intermediates/dTrain-osx-agent.build/Debug/dTrain-osx-agent.build/Objects-normal/x86_64/dTrain-osx-agent.LinkFileList -Xlinker -rpath -Xlinker #executable_path/../Frameworks -mmacosx-version-min=10.10 -ObjC -lc++ -licucore -framework CFNetwork -framework Firebase -framework Security -framework SystemConfiguration -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx -Xlinker -add_ast_path -Xlinker /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Intermediates/dTrain-osx-agent.build/Debug/dTrain-osx-agent.build/Objects-normal/x86_64/dTrain_osx_agent.swiftmodule -lPods -Xlinker -dependency_info -Xlinker /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Intermediates/dTrain-osx-agent.build/Debug/dTrain-osx-agent.build/Objects-normal/x86_64/dTrain-osx-agent_dependency_info.dat -o /Users/user/Library/Developer/Xcode/DerivedData/dTrain-osx-agent-djvvfitvallgicbrsrwbnbhaxoqw/Build/Products/Debug/dTrain-osx-agent.app/Contents/MacOS/dTrain-osx-agent
ld: framework not found OpenGLES for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Edit:
XCode upgraded to 6.4 (6E35b) and still facing the problem
It looks like this issue is a result of some changes we made to how we build the Firebase SDK in 2.3.3. For now, can you pleas use the 2.3.2 version of the SDK, by modifying your Podfile as such:
pod 'Firebase', '2.3.2'
Meanwhile we'll investigate and try to get this fixed in a future version of the SDK. I'll update this answer once we do.
Note that if you're using Swift and Firebase SDK 2.3.2, you'll need to use a bridging header to import Firebase into a swift app.
To do that, create a new Objective-C file in your project. When prompted if you would like to include a bridging header, say “yes”. Then, delete the .m file that you created, keeping only the bridging-header.h file that was created for you. Add the following line to that file:
#import <Firebase/Firebase.h>
If you still getting errors after you have done the install and adding the #import .
Try this. Open Terminal, then cd to your project and type Pod Install, it will prompt you, says something like your project was edit by another application, if you want to Revert or Keep The XCode Version. Chose Revert.
This fixed my error. Hope will help others.

How does Xcode generate the list of framework directories used in the final linking step?

question:
How does Xcode generate the list of framework directories (-F flags in the call to ld) when building a Cocoa app? I keep getting a warning for an old directory which (I think) I have removed from the project settings.
details:
I moved a working Xcode project from one directory to another. I had to fix some broken references to frameworks that now have a different relative path. Everything appears to be working, except for a single warning on the final linker step:
ld: warning: directory '../Some/Path/To/Framework' following -F not found
../Some/Path/To/Framework is definitely part of the old setup. The external frameworks were stored in a directory that was one level up from the project file.
The full text of the call to ld looks something like this (lightly sanitized):
Ld /Volumes/Projects/Builds/Debug/MyApp.app/Contents/MacOS/MyApp normal i386
cd /Volumes/Projects/MyApp
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/gcc-4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk
-L/Volumes/Projects/Builds/Debug -F/Volumes/Projects/Builds/Debug
-F../Some/Path/To/Framework
-F/Correct/Path/To/Framework
-filelist /Volumes/Projects/Builds/MyApp.build/Debug/MyApp.build/
Objects-normal/i386/MyApp.LinkFileList
-mmacosx-version-min=10.6
-framework Cocoa
-framework FRAMEWORK
-framework Carbon
-framework Quartz
-o /Volumes/Projects/Builds/Debug/MyApp.app/Contents/MacOS/MyApp
The warning is triggered by that old value for -F. I have searched through all of the build settings, and everything points to /Correct/Path/To/Framework, not ../Some/Path/To/Framework. I have also cleaned the entire build, but to no avail.
Check your build settings. The framework search paths are under Framework Search Paths, or build variable FRAMEWORK_SEARCH_PATHS.

Duplicate symbol from single library in iOS4.1 SDK

I am developing an iPhone application. I am unfamiliar with Xcode, so please bear with me. I have the iOS 4.1 Device SDK. When I select "Simulator" in the "Active ..." drop-down box, my application compiles without errors and runs in the iPhone simulator.
When I select "Device" in the drop-down box, however, I get the following linker error regarding a duplicate symbol:
Ld build/PineCone.build/Debug-iphoneos/PineCone.build/Objects-normal/armv6/PineCone normal armv6
cd /Users/isaacsutherland/fydp/PineCone/PineCone
setenv IPHONEOS_DEPLOYMENT_TARGET 4.1
setenv PATH "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.1.sdk -L/Users/isaacsutherland/fydp/PineCone/PineCone/build/Debug-iphoneos -L/Users/isaacsutherland/fydp/PineCone/PineCone/../3rd/libGHUnitIPhone -F/Users/isaacsutherland/fydp/PineCone/PineCone/build/Debug-iphoneos -filelist /Users/isaacsutherland/fydp/PineCone/PineCone/build/PineCone.build/Debug-iphoneos/PineCone.build/Objects-normal/armv6/PineCone.LinkFileList -dead_strip -all_load -ObjC -miphoneos-version-min=4.1 -framework Foundation -framework UIKit -framework CoreGraphics /Users/isaacsutherland/fydp/PineCone/3rd/three20/Build/Products/Debug-iphoneos/libThree20.a /Users/isaacsutherland/fydp/PineCone/3rd/three20/Build/Products/Debug-iphoneos/libThree20Core.a /Users/isaacsutherland/fydp/PineCone/3rd/three20/Build/Products/Debug-iphoneos/libThree20Network.a /Users/isaacsutherland/fydp/PineCone/3rd/three20/Build/Products/Debug-iphoneos/libThree20Style.a /Users/isaacsutherland/fydp/PineCone/3rd/three20/Build/Products/Debug-iphoneos/libThree20UI.a /Users/isaacsutherland/fydp/PineCone/3rd/three20/Build/Products/Debug-iphoneos/libThree20UICommon.a /Users/isaacsutherland/fydp/PineCone/3rd/three20/Build/Products/Debug-iphoneos/libThree20UINavigator.a -framework QuartzCore -framework CFNetwork -framework MobileCoreServices -framework SystemConfiguration -lz.1.2.3 /Users/isaacsutherland/fydp/PineCone/ClientDal/build/Debug-iphoneos/libClientDal.a -lGHUnitIPhone4_0 -o /Users/isaacsutherland/fydp/PineCone/PineCone/build/PineCone.build/Debug-iphoneos/PineCone.build/Objects-normal/armv6/PineCone
ld: duplicate symbol _RedirectionLimit in /Users/isaacsutherland/fydp/PineCone/ClientDal/build/Debug-iphoneos/libClientDal.a(libASIHTTPRequest.a-armv6-master.o) and /Users/isaacsutherland/fydp/PineCone/ClientDal/build/Debug-iphoneos/libClientDal.a(libASIHTTPRequest.a-armv6-master.o)
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
The error is strange because it complains that _RedirectionLimit is found twice -- in the same file! libClientDal.a(libASIHTTPRequest.a-armv6-master.o) is the offending library. Can someone help me understand what is going on? How could this library have compiled properly in the first place? Or perhaps the linker is trying to include the same library twice?
The workaround provided in this similar question does not work for me.
If you need more information, I will gladly provide it -- as I said, I'm new to Xcode development.
When you have a web of projects that compile to static libraries and refer to one another, there are 2 distinct concerns you must consider:
A project's Direct Dependencies inform Xcode which projects depend on each other so it knows to recompile a project when its dependencies change.
A project's Linked Libaries actually get included in its object code.
In a nutshell, your web of direct dependencies can be as tangled as you want, but you must be careful to link each project's code into the application executable only once.
Basically, my problem was that I had 3 projects A, B, and C, and the dependencies looked like A=>B, A=>C, B=>C. I was linking libC.a into both A and B, so the linker complained about duplicate code.
The configuration stuff you need to change is on the Target Info page for each of your projects' targets.
This happened to me when I used the -all_load linker flag, which forces the linker to load all symbols from all libraries. The Three20 project says you should use it, because otherwise the Categories won't be loaded and you get a runtime exception. I removed that flag, and added the -force_load flag just for each library that needed it (the Three20 libraries). See also: What does the -all_load linker flag do?
I've several apps that need to embed a small custom library that makes use of ASI and TBXML. Some of this apps have their own version of that libraries. In order to avoid duplicate symbol issue, I duplicated the each library's target removing the .m files that causes the issue.
Hope it helps.

How can my XCode project files be exactly the same as a working project and still have build errors?

I'm following a tutorial from chapter 12 of the book "Beginning iPhone 3 Development." When I try to build the project I get an error. The book came with the project files, so I went through every file in my Classes directory and copied and pasted the code from the example project so that they are identical. This has solved my build errors in the past. I checked that the same frameworks were installed and the files in the Other Sources and Resources folder are identical. Still, when I try to build, I get the following build error:
Ld
build/Debug-iphonesimulator/GLFun.app/GLFun
normal i386 cd
/Users/gin/Documents/development/GLFun
setenv MACOSX_DEPLOYMENT_TARGET 10.5
setenv PATH
"/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2
-arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.3.sdk
-L/Users/gin/Documents/development/GLFun/build/Debug-iphonesimulator
-F/Users/gin/Documents/development/GLFun/build/Debug-iphonesimulator
-filelist /Users/gin/Documents/development/GLFun/build/GLFun.build/Debug-iphonesimulator/GLFun.build/Objects-normal/i386/GLFun.LinkFileList
-mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework
CoreGraphics -framework OpenGLES
-framework QuartzCore -o /Users/gin/Documents/development/GLFun/build/Debug-iphonesimulator/GLFun.app/GLFun
ld: duplicate symbol
.objc_class_name_GLFunView in
/Users/gin/Documents/development/GLFun/build/GLFun.build/Debug-iphonesimulator/GLFun.build/Objects-normal/i386/GLFunView-7A51E8797CBB3D72.o
and
/Users/gin/Documents/development/GLFun/build/GLFun.build/Debug-iphonesimulator/GLFun.build/Objects-normal/i386/GLFunView-7A51E8797CBB3D72.o
From what I can see my project is identical to the one supplied with the book, which I can build and run successfully. What could possibly still be different that is causing this error?
Use diff(1) between the two projects' project.pbxproj files and find out.
Clean the project then try again, sometimes strange things happen. Check the build configurations between the two projects to see if they have any differences (building for the same architecture, sdk, etc.). Since you have duplicate symbols my first guess would be that Clean will solve your issue.

Resources