Library not found for -lXXX - iphone

If your trying to run an iphone project downloaded from the internet in Xcode and you encounter "Library not found for -lxxx", where -xxx is some third party library where would you look to set the library path? I am not sure where this is setup, in the SCM->library path is blank and everything else seems to match the configuration window for other working projects
When I look at the build log i see the following in the linker output:
-ObjC -ljson
How can i configure the project to not try to link in that library at build time?

if using cocoapods and getting this error, try updating the cococapods$ sudo gem update cocoapods Then update the pod for the project$ pod updateI don't know the exact reason but I think it was because the old version didn't set the libraries properly for the new XCode.Hope this helps.

Within the build tab of project settings there is a field for linker options, I removed the -ljson from here to solve the issue.

Either you need to add that library to add your project or you can remove from the project and delete all the reference.
This may help you, just click on the library and change the 'required' option.

This might be helpful in some cases:
Xcode > Preferences > Locations > Locations > Advanced, select Unique.
I was facing a similar issue and chaging to "unique" from "legacy" solved the problem

Related

No such module 'IQKeyboardManagerSwift'

New to Xcode (dabble a little). I paid a developer to build an iOS app for me. He sent me the source code and I have opened it in Xcode 13.2.1. I needed to edit the info.plist to include a description why location was required (got this done). When I try to run the build, I get the error 'no such module 'IQKeyboardManagerSwift'. In AppDelegate, I see 'import IQKeyboardManagerSwift --- No such module 'IQKeyboardManagerSwift'. I went to the Podfile directory and ran 'pod install'. Output says:
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There are 7 dependencies from the Podfile and 8 total pods installed.
I'm still getting the error when trying to run the build. I tried cleaning the build folder and running the build again but still, same error. What am I missing?
I'm not sure why this happens, but one way to solve your issue is to go into your build settings and define the Framework Search Paths to a folder that contains the frameworks in question. If the frameworks are placed in your project directory, simply set the framework search path to $(SRCROOT) and set it to recursive.
Is the codebase completely in Swift?, else you will have to include import in the Bridging header file
If in swift you can try:
Select project name -> Select Build Settings(tab) and search Framework Search Paths double click and set the desired path($(SRCROOT)) to recursive
The missing module handles a number of keyboard behaviors so you don't have to reinvent that wheel. Check out the developer's website and get it for yourself. I've been using it for years. The developer has helped me more than once get past some obstacles.

FBLPromises Framework not found

I am tryin to install Firebase using cocoapods so I may send push-notifications to user devices. However, everytime I follow the instructions step by step, I get this error that says "framework not found FBLPromises". Anyone have any ideas how to fix? Everything I have looked up online does not work.
The following worked for me:
What probably happened (for anyone still looking) is that after running
pod install
in your project's directory, you are still building the ".xcodeproj" file instead of running the newly created ".xcworkspace" from the pod install. Remember, after pod installing, you MUST do edits on and work with the .xcworkspace instead.
Go to your Pod target and add arm64 in Excluded Architecture
I was having the same issue, and I solved it by going to Product > Scheme > Edit Scheme... and selecting Find Implicit Dependencies. After that, the project was able to build correctly.
Probably late but I managed to fix it by linking FBL promises in my podfile to the rest of the project!
Click on the project > Targets. Select your target. Then click on Build Settings. Find "Runpath searches path" and add "$(PODS_CONFIGURATION_BUILD_DIR)/PromisesObjC". It worked for me, but it gave me another error dealing with another missing lib, so I had to do it again until all libs were found.
Go to your Pod target and set Build Active Architecture Only = YES For Debug Environments
Simply setting Build Active Architecture: Debug - Yes, Release - No fixed this for me. I had it set to No, No before. I think this matches the setting in the Pods project.
Open Podfile by typing the command open Podfile in the folder of the project using the terminal.
Type pod Promises
Done

Xcode upgrade: PBXContainerItemProxy missing containerPortal key

I just upgraded my Xcode, now when I try to open my project, I get this error:
Project /Users/xxx/xxxx/xxxxx/xxxxxx/xxxxxxxx.xcodeproj cannot be opened: PBXContainerItemProxy (xxxxxxxxxxxxxxxxx) is missing a containerPortal key
I have searched the web and stackoverflow, but cannot get anything relevent to come up at all regarding this.
I do have Three20 as part of my project, I don't know if that matters. I just upgraded to xcode 4.4.1
Thanks for any insight.
-D
the project icon which we see i.e projectname.xcodeproj, is actually a directory, you do this
1. in terminal do cd yourproject.xcodeproj
2.ls
3.vi project.pbxproj
4. scroll down till /* Begin PBXContainerItemProxy section */
5.there you will see all sections check for the section which is missing a portal key edit it and save it :wq it will work
in image if you see the first section is missing container portal key.just pic it from other section and replace it..
it will work :D see this link
Now I should start with that I do not know the actual error, never seen it before, but I did find a reference to a "PBXContainerProxy"-error in this post (As soon as I add a project to XCode 4.0.2 it crashes) and thought you might try the solutions from there?
"Apparently this is due to the new version of XCodeProjects. I found a
work around by pre-compiling the library that was causing the issue
and then using the linker to link to the .a file. I also had to copy
the .a library into the DerivedData path.
The real solution was to remove the project and replace it with an
updated project for the new version of XCode."
Hope that helps somewhat :)
Never saw that error either, but if you're upgrading directly from XCode 3.X I'd suggest you to go to https://developer.apple.com/downloads/index.action?name=Xcode
and download/install a previous version of Xcode somewhere else. (You can have several different copies installed on your machine, just google it if you don't know how but just remember to use xcode-select to pick the one you want to use). Repeat with all the versions back to 4.0.1 until (hopefully) it works. I know it's tedious but it might help.
If it does, validate the project settings and try to open it with 4.4.1. That should work.
Good luck

Linker command failed with exit code 1 error in Xcode project

I was working on my project and suddenly after editing the code and compiling gave this error:
ld: warning: directory not found for option '-
L/Users/mani/Documents/Classes/Twitter+OAuth/Libraries & Headers' ld:
duplicate symbol _OBJC_CLASS_$_playSiew in
/Users/mani/Library/Developer/Xcode/DerivedData/learn-aktrtiwswclovoatyweyquoxmypa/Build/Intermediates/learn.build/Debug-iphonesimulator/learn.build/Objects-normal/i386/playSiew.o
and
/Users/mani/Library/Developer/Xcode/DerivedData/learn-aktrtiwswclovoatyweyquoxmypa/Build/Intermediates/learn.build/Debug-iphonesimulator/learn.build/Objects-normal/i386/Thumb.o
for architecture i386 clang: error: linker command failed with exit
code 1 (use -v to see invocation)
I never touched the project settings, just edited the code.
What's more strange is that I took out last revised code from svn but still I got the the same error.
You may be accidentally #import'ing a .m file instead of a .h. Use Cmd+Shift+F and search for ".m" (without quotes). It will most likely lie in one of the classes mentioned in the warning. If not, clean and run again.
I was also having same issue and I did following and issue is gone.
Go to Product -> Clean and re-run the project.
I hope it might be useful for some other developers.
After running into this problem a few minutes ago (yes, I know it's been 7 months since the original thread) I found that the root of my issue was due to me dragging & dropping files into my project within XCode instead of right-clicking and choosing Add Files to Project.
Check playSiew.m is in Compile Sources section. isn't it?
You can find Compile Sources section follow this step
Select YourProjectName
Select TARGETS
Select Build Phases
If don't have playSiew.m in this section . You must to add it to this section.
As I said the problem wasn't the code but some settings. So what I did was copying the code from my friends' Mac (it was working fine), and installed a fresh copy of the project to my Mac. It worked.
I was importing a library in a test case which I had specified in my pod file for the main target but not for the test target.
I also got this error because I had accidentally included two versions of the same source file. Deleted the wrong one and the problem went away...
If you're working in Unity and export to iOS and you are using a plugin, go to Xcode Build Settings and set ENABLE BITCODE = NO. I'm guessing this might apply to other situations as well
Faced similar issue, while running the code on a simulator, tried all the above mentioned options, still got the same error. Tried connecting the iOS device and build the code, it worked for us. This can be a quick workaround.
the same error i faced. so, i just removed reference of that classes which are generating the errors and than again gave reference and the error was gone...
as D80Buckeye says there should be problem of dragging and dropping files instead of Clicking on "Add Files"
In case this comes in useful for anyone else--I just had this same error, and turns out the cause was initializing a variable in my header file rather than in the main file.
I just encountered the same error. If you are using embedded Libraries, make sure your Deployment Target is set to iOS 8.0 or higher.
you only need to add the following framework: quartzcore.framework
The only way we can get past this bug on our project is to do a Clean and then build for iPad Retina. After that it will build successfully for any device. Weird.
In my case i have add reference of FacebookLoginSDK framework but forget to give search path in build setting. After removing its reference everything was fine.
So conclusion is if you are adding any external framework be careful.
If this happens to you with CoreData generated classes, combine the +CoreDataProperties and +CoreDataClass into the +CoreDataProperties class and delete the +CoreDataClass. Make sure to search Derived Data for leftovers of the +CoreDataClass. Even after deleting the Derived Data and cleaning I sometimes had Xcode just generate the +CoreDataClass again and again. Deleting it manually in Finder and then re-bulding helped me solve this.
try this, go to Target -> Build Settings,then search these three as following,
GCC_NO_COMMON_BLOCKS,
CLANG_WARN_INFINITE_RECURSION,
CLANG_WARN_SUSPICIOUS_MOVE,
set NO to each value then clean and build.
I tried several of the answers listed but none worked for me.
I got the error after updating XCode (while it was still open which may have contributed to the problem)
First, I deleted my Derived Data folder:
XCode => Preferences => Locations => Double Click on arrow next to path indicating where the Derived Data folder is.
Then "Move to Trash"
I don't think that's what the problem was, but it's amazing how many times this has been an issue for me working on different problems.
Second, I 'Quit' the simulator.
Third, I 'Quit' XCode.
Fourth, I opened up my project in XCode again and then did a Clean and Build (found in the Product menu)
Fifth, I ran my project and it worked fine
Cleaning the project not works for me.
Restart the Xcode works for me...
For me it was different. I had the same error when I removed a Pod and solved it by removing this pod from the Other Linker Flags in the Build Settings
then clean your project [Product > Clean] and rebuild
Go to general and linked frameworks and libraries in xcode and remove all the files there.

XCode linker error : library not found for -lAdMobDevice

I am trying to build lite version of my iPhone application using AdMob. I followed the guidelines here http://www.iphonedevsdk.com/forum/iphone-sdk-development/11358-creating-lite-version-app.html and created two different targets. In the lite version I added a macro called LITEVERSION which I am checking using #ifdef and doing the appropriate things.
But when I build the lite version of the app, I get a linker error
ld: library not found for -lAdMobDevice
collect2: ld returned 1 exit status
However I am able to build the full version without any issues and also noticed that build is working fine (for the fullversion) even if I remove the #ifdef macros. This suggests that the libAdMobSimulator.a library is linking properly for the full version however it fails on the lite version.
Any pointers would be greatly appreciated!
Cheers
Jugs
When I had this problem, the cause was that I'd added the library into Xcode by dragging it in like a regular source file.
The fix was to remove it, and then add it properly using the "Add->Existing Frameworks..." dialogue.
I got similar error as I was using CocoaPods libraries
library not found for -lPods-MyApp
I got the error because I opened xcode project instead of workspace.
I was using CocoaPods, and ran pod install, and that fixed it.
I figured out what he problem was. I just removed all frameworks and libraries and added them back in for both the targets and it worked!
Cheers
I cause this because of a libray libMobClickLibrary.a which is used in youmeng sdk missed. I fix the issued after copy libMobClickLibrary.a to the project floder.
I had the same problem with Google Analytics library. My problem was that I forgot to add the path to the Library Search Paths in my target's build settings. (Target -> Build Settings -> Library Search Paths)