xcode simultor - library not found for - ios

I'm trying to run my ios project on the simulator but I'm told that:
ld: library not found for -lPods-.....
This is not happening if I run it on my device.
I tried looking into the search paths in my Pods project, but I didn't see anything suspicious... Maybe i'm not looking for the right thing.
Can anyone help me by telling me what should I look for?
Thanks

Ok,
I went to the Pods project file and saw that "Build Active Architecture Only" is set to Yes on debug but set to No on release... I just set it to No on both and it works...

That means that there is no libPods-....dylib in the library search path that you passed to the linker. I can't be more specific because you omitted the rest of the library name in your question. You should make sure that your library search paths are correctly pointing to where you have the iOS Simulator version of your library.

Related

dyld: Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib

I've built a Swift framework and now I'm trying to start building a Swift iOS application that will use that framework. I'm getting this error:
dyld: Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib
Referenced from: /Users/tdean/Library/Developer/Xcode/DerivedData/NFLApplication-ejmafvjrlqgjaabggwvadjarjjlg/Build/Products/Debug-iphonesimulator/NFLStatsModel.framework/NFLStatsModel
Reason: image not found
I've scoured SO and found similar reports and tried the fixes listed there, including:
Clearing out my DerivedData folder
Restarting Xcode and the iPhone simulator
Ensuring that Always Embed Swift Standard Libraries = YES is set, both in my framework and my application's build settings
Ensuring that Enable Bitcode=NO is set, both in my framework and my application's build settings
Ensuring that Runpath Search Paths is set to #executable_path/Frameworks, both in my framework and my application's build settings
Copied all the libswift files from my Xcode installation into a local copy within my project, and added a custom build phase to copy those files into the frameworks folder.
In every case, I get the same error when I try to run my application.
Xcode Version 8.1 (8B62)
Apple Swift version 3.0.1 (swiftlang-800.0.58.6 clang-800.0.42.1)
I eventually got this working using a mix of fixes. I'm not sure if all of them are needed, but I'm documenting what seemed to work for me here, just in case anyone else can benefit by what I've found.
I have set Always Embed Swift Standard Libraries to a value of YES in the build settings tab for both my Swift framework and in the Swift application that uses the framework.
I have added Foundation.framework to the Linked Frameworks and Libraries section of the general tab for both my Swift framework and in the Swift application that uses the framework.
I have added Foundation.framework to the Embedded Binaries section of the general tab for the Swift application that uses the framework.
With all 3 of these settings in place, I am able to build and run my application without encountering this error.
This might not be the case for everyone, but I solved it by actually writing some code in the main target.
I had an empty project consisting of a framework and a test target, and when running tests I was getting this error. Apparently Swift is pretty smart to detect that you don't actually need this library and does not link to libswiftSwiftOnoneSupport.dylib.
The fix is just to add some code, I just added:
class Test {
func a() { print ("something") }
}
and libswiftSwiftOnoneSupport.dylib got linked.
After several days of being stuck with this issue I finally found something that worked for me; hopefully this will help others too.
Turns out that specifically using print() anywhere in the code will somehow force libswiftSwiftOnoneSupport.dylib to be loaded and the issue will go away.
I'm using Xcode 10.1, Swift 4.2 and the pod that was giving me this issue was Nimble.
BTW, I am aware of #S2dent's suggestion to "just add some code" but in my case my framework already had several different classes so it didn't help me.
How are you installing your dependencies?
I had a similar issue:
dyld: Library not loaded: #rpath/libswiftSwiftOnoneSupport.dylib
Referenced from: <internal framework>
Reason: image not found
It turned out to be related to Swift whole-module optimization.
Using Carthage as a dependency manager, they were being compiled for Release, and thus compiled with whole-module optimization, which Xcode suggested I turn on. Running the app on the simulator compiles it for Debug. I'm guessing that dynamic frameworks cannot be at a different level of optimization from the app running it.
The solution was to explicitly specify the configuration I wanted Carthage to build for. (carthage bootstrap --configuration Debug) Oh, and cleaning my build folder, of course.
I had the same issue, adding the library (my own build one) to Linked Frameworks and Libraries in General tab of the app solved the issue.
You can also provide an Host Application to your test target if you don't want to add Foundation.framework to Linked Frameworks or Embedded Binaries
You can solve this by setting "Always Embed Swift Standard Libraries" to "Yes" in the Build Settings of your target.
It is an dynamic linker error which links binary in load or runtime
[#rpath]

Restkit/Restkit.h file not found Xcode 6.1

I was working on Project in Xcode 6.1. It was working fine and all of sudden it prompted an error 'Restkit/Restkit.h file not found'. I'm getting error after changing Architectures from $(ARCHS_STANDARD_32_BIT) to Standard architectures (armv7,arm64) - $(ARCHS_STANDARD) which is recommended by Apple Check Link
I have tried following approaches :
1.'Cleaning' project and rebuilding
2. Checked for missing framework in Target -> Build Phases
3. Fixed 'Framework Search Path' of Target
4. I have build Restkit XcodeProject and Targets separately. It builds without error.
I was getting below error while submitting to App Store and hence changed architecture to 'Standard architecture'
Why did this occur all of sudden? How to fix it?
Just to be here. There is similar issue in newest Xcode 7+. You can observe "RestKit/RestKit.h file not found" failure on archive build. You could compile and run apps on emulator but archive would fail.
To fix this you need to add one line to "Header Search Paths" in Build Settings:
"$(BUILD_DIR)/../IntermediateBuildFilesPath/Headers"
Be sure to include the surrounding quotes.
You have not properly changed Architecture , if you have done properly than it will show you like this,
Proper Architecture setting:
So again properly change Architecture and try again.
This is your Architecture Setting
I had used third-party static library in project named libNuance.a. It seems that this static library works fine for 32-bit architecture but failed for 64-bit architecture.
I downloaded updated version of libNuance.a library from their official site and changed architecture to Standard architectures (armv7,arm64) - $(ARCHS_STANDARD).
Vola! build succeeded without any error.
First you can try, look for it in project navigator(left side) and delete if it is red.After that add the RestKit again.Be sure when adding check the copy if needed box and packages contains headers.
Also you may try just #import "RestKit.h"
I had solved this in many cases by deleting the contents of DerivedData folder. See the following questions on how to do this:
Can I safely delete contents of Xcode Derived data folder?
How can I safely delete in my ~/Library/Developer/Xcode/DerivedData directory?
If you have Pods configured then and if you have upgraded recently your Xcode, try reinstalling cocoapod and all the reinstall all required pods.
I fixed this issue, to change the Header Search Path
"$(SOURCE_ROOT)/RestKit-RestKit-c19a500/Build"
Note : "RestKit-RestKit-c19a500" this is my RestKit folder name.

linker command failed with exit code 1(use -v)

In my app, I am getting the following Linker Error.
Previously, I made the project in XCODE 4.6 & Works perfectly in it
But When I try to run the project in XCODE 5, I am facing following error
I search a lot but could not able to find any good solution.
My external Framwork are twitter and urabanAirship
so i have done setting in my project target>build settings> search paths >Header search path.
Is that any wrong with this setting.
I also applied the same setting in Library Search path but no luck.
Help me to solve this.
Thanks in advance.
I think your architecture is "armv7, armv7s". change to "armv7" only in Build Settings,

What do these Dsymutil Warnings mean in XCode 4.5?

I am linking a static framework for iOS, against an armv7 ios 6 application, I suspect that the original binaries are from XCode 3.x and were compiled with GCC, and that I'm now linking it using CLang compiler. I do not have the source code for the framework, only the binaries:
(null): warning: (armv7) /.../DerivedData/.../armv7/HardwareObjectFile.o unable to open object file
I get 69 warnings like the above, one for every .o file linked into the static framework.
Is this warning serious for any reason? I have simplified the giant path which appears to indicate that the binary files in the library have hardcoded a path in "/Users/somedeveloperthatisntme" that could hardly help but Not Exist since I'm using this library on a computer that doesn't even have a folder named "Users/somedeveloperthatisntme".
Dsymutil appears to be a tool to "manipulate archived DWARF debug symbol files", although I know precisely nothing about what it is and what it does, notwithstanding the thorough documentation from Apple, which tells me what, but never ever, why. What is it doing, and what will this warning mean for me? I suspect I need a new library/static-framework from the vendor to clear this up?
Update: I am unable to solve this and it appears the cause lays with very old binaries compiled by a very old XCODE version, shipped as part of a mobile framework from a third party vendor. The issue in this case would be resolved by having that vendor rebuild their library, something I asked them to do because the warnings drove me nuts, but which they seem unable to do. In the end I ditched their technology and replaced it with something else. (Grin)
These errors are to do with the architectures you are using and the resources you are referencing. I don't understand the reasons myself, but if you want them to go away, go to Build settings, then Build Options and then select Debug information format and select DWARF.
I am on the other side of this, building a library for others to use, and I was able to alter the library project by setting 'GCC_GENERATE_DEBUGGING_SYMBOLS = NO' in the Build Settings to make those warnings go away in an Application project that consumed the output framework.
This isn't a solution to your problem, but if you're in contact with this vendor, you could pass this along.
The other answers contain helpful information but I wish to put the real answer down succinctly:
You can not fix this, and the meaning of the errors is simple: The current linker sees these library files as containing elements that can not be opened.
To solve the warnings, contact the vendor and get a recompiled library that has been rebuilt with a later version of CLANG.
What I did was just delete the /Library/Developer/Xcode/DerivedData folder and it fixed everything for me.
Another reason these warnings could occur is because of incorrect symbol stripping settings for release builds in a project. Contact the author of the framework and tell them to make a new binary with the proper symbol stripping settings.

Problems trying to add the libz.1.2.3.dylib to my ipad project

First of all, i'm now on this site so really sorry if i'm commiting some error posting this question.I'm trying to use the zipArchive class to manage zip files in an ipad project.
What steps will reproduce the problem?
Create a project.
Add the ZipArchive folder with their files.
Add the libz.1.2.3.dylib
What is the expected output? What do you see instead?
I have all the code (about ziparchive) commented, so i only have the #import #import "ZipArchive/ZipArchive.h" in my viewcontroller, and i expect to build the project without errors.
I see the following error in the compiler:
ld: warning: ignoring file /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libSystem.dylib, missing required architecture i386 in file
ld: in /Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.2/Symbols/usr/lib/libobjc.A.dylib, missing required architecture i386 in file for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 failed with exit code 1
What version of the product are you using? On what operating system?
I'm using xcode 4 a project for the ipad with the 4.2 ipad simulator on a Mac os X version 10.6.7
Please provide any additional information below.
I think the problem is with the libz.1.2.3.dylib library, and I have some guest of where might be the problem:
The libz.1.2.3.dylib path error is on iPhoneSimulator.platform, it is valid for ipad too?? If is not, which lib could i use for the same purpose with the ipad??
I'm not sure i'm adding the libz.1.2.3.dylib lib correctly. What I have done is: right-click on Resources folder -> add files to "myproject" -> search for the libz.1.2.3.dylib and add the 4.2 version of it from the path u could see in the compiler errors. I also try to add to the frameworks folder with the same results.
I'm reading lots of posts about how to fix similar problems but no one could help me.
Any idea of what I have to do to fix my problem??
Really thanks!!
You need to do this:
Delete libz.1.2.3 from your local Frameworks folder. You don't need it.
Select your project at the top of the Project Navigator.
Select your application target.
Open "Link Binary With Libraries".
Click the "+"
Search for "libz".
Select "libz.dylib".
If you are using Xcode 4.5.2 the screenshots below may aide you in proceeding through steps 2 through 5. I'm not sure if other versions of Xcode are the same or not.
If you are using xcode 4 or upper version of it than it seems that libz.1.2.3.dylib is not included in iOS5 sdk. Here is simple method to fix this:
Open your project in XCode 4.2
Remove libz.1.2.3.dylib from framework
Add new framework libz.1.2.5
Run you app
It works fine.
libz.dylib is an alias to the latest version (currently libz.1.2.5) so you can also navigate to the file's location in Terminal and create a symlink called "libz.1.2.3.dylib".
cd /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/lib/
sudo ln -s libz.1.2.5.dylib libz.1.2.3.dylib
You could also link to libz.dylib, which I would expect to always point to the actual latest version, which is why Tricon recommends changing the project to just include libz.dylib. I'm not sure I'd delete anything, although it's not a whole lot different from adding a new symlink...you're still mucking around deep inside the guts of Xcode....

Resources