library not found for -lxml2 - ios

I had a 'libxml/xmlversion.h' file not found build error in my iOS Xcode 5.x based project.
Then when i searched in net, I found i need to give the header search path like below.
/usr/include/libxml2
After giving this path, I am getting following Apple Mach-O linker error,
library not found for -lxml2
In the header search path, I found I have given the following path also,
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/libxml2
I have libxml2.dylib in the link binary section.
Could someone help how to solve this issue and make the build successfully?

i think the path should look like this
$SDKROOT/usr/include/libxml2
that should resolve the problem. $SDKROOT is the key to the right path.
edit:
sample project:
and project explanation

Related

ld: library not found for -lPayPalMobile ios

i am working with xcode 6.1 on paypal integration.
i am getting following error each time when i open the project.
ld: library not found for -lPayPalMobile
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
every time i have to remove library search paths value and remove reference of paypal folder and again import it to project.
what is the problem i don't know please tell me what to do?
Edited
one thing more that if project name is "This is test" then what will be difference?
because i can see in library search paths that in first row "This" is coming in second row only "is" is there and in last (i.e. 3rd row) "test" is there.
Thank you.
Follow Below steps,
(1) Add Static library in Your project bundle.
(2) Add it in "link binary with libraries"
You need to go to your Target -> Build phase -> link binary with libraries.
as attached in below image.
(3) Give proper header search path for your linked library.
i.e. ($PROJECT_DIR)/Your path.
You can also read the steps that given in GitHub link of PayPal,
which give you proper direction.
Feel free to ask if you need more help regarding this.
As #Anuj mentioned this can be a problem related with Library Search Paths. Cocoa Pods sometimes gets a mess when updating it, or installing it again if you have it or not under Source Control.
I solved this problem right now by adding this flag under Library Search Paths:
$(inherited)
Hope it helps you
This is usually Header or Library Search Paths. It's better to use CocoaPods to manage your project dependancies. CocoaPods is the dependency manager for Objective-C projects. It has thousands of libraries and can help you scale your projects elegantly. You can import any static library using simple Podfile and command line.
Once you start using CocoaPods, you won't have to worry about header or library search paths. PayPal also has a spec in the CocoaPods Spec repository.

libxml/xmlversion.h file not found

I am using Xcode 5.0.1.
I have "libxml2.dylib" under the following path.
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib
This path is set in my project HEADER SEARCH PATHS.
I have included this libxml2.dylib library in Xcode project.
When I build xcode project, it is throwing error as
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/libxml2/libxml/tree.h:17:10: 'libxml/xmlversion.h' file not found
I also tried setting /usr/include/libxml2 but in this case it is showing linker error as library not found for -lxml2
It may be a repeating question, but my issue is strange, whatever the solution is mentioned in internet, nothing works.
Could someone advise me to fix this ?

Getting compilation errors & warnings after install Soundcloud API through CocoaPods in Xcode

Having problems with the Soundcloud API.
I'm getting multiple Warnings & issues and I don't know what can I do to fix that.
Have I to change header search paths & other link flags? I tried the Terminal version of Installation as well and I got warnings & compilation errors
Appreciate your helping, I'm stuck trying to run propertly the Soundcloud API without warnings and I'm not able to do that.
I attach some screenshots.
Thanks
This looks a lot like a duplicate of XCode - iOS: Can't resolve conflict between CocoaLibSpotify and Parse framework.
I'm making a guess here, but are you doing -all_load?
Remove -ObjC and -all_load
Add -force_load <SoundCloudAPI library path> to load only libSoundCloudAPI.
After reading the github page, you may not need -force_load at all.
You may also need to adjust your warning level because of all the deprecated APIs.
It's working!!! Thanks for your help!! I'm very happy :D I was forcing the loading of the libraries without the prefix libPods that is added installing the project through CocoaPods. The trick to hidden the Deprecated functions was really helpful. After one day trying different settings, its running.
These are the linker flags I put in "Other Linker Flags"
-force_load $(BUILT_PRODUCTS_DIR)/libPods-OHAttributedLabel.a
-force_load $(BUILT_PRODUCTS_DIR)/libPods-CocoaSoundCloudUI.a
-force_load $(BUILT_PRODUCTS_DIR)/libPods-CocoaSoundCloudAPI.a
-force_load $(BUILT_PRODUCTS_DIR)/libPods-NXOAuth2Client.a
In "Header Search Paths" I put "./**"

Adding Chartboost in cocos2dx

I am adding chartboost in cocos2dx project i have downloaded a chartboost wrapper for cocos2dx and when i am adding libraries like QuartzCore, SystemConfiguration, and CoreGraphics frameworks, and weak-link (set as Optional) the AdSupport and StoreKit.
I am getting this error.
ld: library not found for -lcurl clang: error: linker command failed
with exit code 1 (use -v to see invocation)
I havnt done anything just adding libraries and getting this error.
EDIT :
This wrapper i am using
https://github.com/wenbin1989/Chartboost-x
Its not Chartboost problem. Add library search path for libCurl.
Drag this folder to your library search path in Xcode.
cocos2dx/platform/third_party/ios/libraries
which Xcode Vesrion you are using ?
you don't need to add QuartzCore and CoreGraphics , they are by default added.The problem you are getting might not be by adding these frameworks , but by adding Chartboost files in the project.Any ways do one thing
Before adding the frameworks and chartboost files. Note down the contents of Header search path and Link Library search path in a notepad and after adding them again check these paths and see if the already existing paths are changed. Most probably now you will be seeing these paths with in \" \", back slash is escape character here. so either replace these modified paths with the actual one you noted or just remove \" from path. It should work
EDIT: Please let me know which wrapper you are using

Google Analytics and ShareKit

I've been trying to integrate Sharekit to a project that already has google analytics.
I followed the installation guide on the sharekit git wiki which told me to include the 'other linker flags' "-ObjC" and "-all_load"
However when I try compiling I am getting duplicate symbol errors in google analytics, such as:
duplicate symbol _OBJC_IVAR_$_OAServiceTicket.data in:
/Users/x3ro/Library/Developer/Xcode/DerivedData/APPNAME-bgfudbwainndvsdmvtafsrwfryvz/Build/Intermediates/APPNAME.build/Debug-iphonesimulator/APPNAME.build/Objects-normal/i386/OAServiceTicket.o
/Users/x3ro/APPNAME/Developer/Xcode/DerivedData/APPNAME-bgfudbwainndvsdmvtafsrwfryvz/Build/Products/Debug-iphonesimulator/libShareKit.a(OAServiceTicket.o)
Removing the flags solves these errors, however I know this isn't a good idea and I'll very likely run into issues down the line. Any help in getting the flags and both libraries to work together would be really appreciated.
Use the linker flag "-force_load" with the path to Sharekit.
It look like something like this:
-force_load $(BUILT_PRODUCTS_DIR)/libRestKit.a
From Apple Documentation:
-all_load forces the linker to load all object files from every archive it sees, even those without Objective-C code. -force_load is available in Xcode 3.2 and later. It allows finer grain control of archive loading. Each -force_load option must be followed by a path to an archive, and every object file in that archive will be loaded.
You can find others answers with this related post:
Using the force_load linker flag with RestKit (iOS)

Resources