iOS dyld: Library not loaded: /usr/lib/libc++.1.dylib - ios

The iOS application i'm creating uses ZXing, Couchbase and Couchcocoa. Originally I only needed libc++.dylib and I can run the program using the Simulator.
When I tried running on the device, it builds successfully but then crashes and I get the log:
dyld: Library not loaded: /usr/lib/libc++.1.dylib
Referenced from: /var/mobile/Applications/E6AD6AC4-4081-4608-86FB-306D86DCFD35/qrcard.app/qrcard
Reason: image not found
I then added libc++.1.dylib in the link binary libraries. And I still get the same logs.

Have you tried just renaming your main.m to main.mm? That will tell Xcode to link against C++ dependences itself. I'm wondering if there are load path flags you have to give the build if you try to explicitly name C++ libraries (which isn't even all that well defined in Xcode anymore since Apple now provides multiple versions of at least some of the C++ libraries.)
It may not be the only way, just the only one I've used. But I've never gotten an error with this method.

Related

No such module 'AppInvokeSDK'

Paytm All-in-one SDK integrated successfully and working fine in simulator but when I am trying to run in real device, its giving me an error that No such module 'AppInvokeSDK'
Cannot run in real device (iPhone 8)
Following error getting in log:
dyld: Library not loaded: #rpath/AppInvokeSDK.framework/AppInvokeSDK
Referenced from: /private/var/containers/Bundle/Application/840EAA6B-AB7E-4712-B77F-B6E625E899D2/app.app/app
Reason: image not found
dyld: launch, loading dependent libraries
DYLD_LIBRARY_PATH=/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Developer/usr/lib/libBacktraceRecording.dylib:/Developer/usr/lib/libMainThreadChecker.dylib:/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib
here is the screenshot:
I got to know later, By mistake I put framework in somewhere else. Actual place for external framework is inside the "Framework" folder in Xcode.

dyld: Library not loaded realm

i added a framework that i developed in ios to the new project. I tried to make the app universal (one framework work both in device and simulator) according to this tutorial
create an ios universal framework
. When i run my demo project using this universal framework i get this errors
dyld: Library not loaded: #rpath/Realm.framework/Realm
Referenced from: /private/var/mobile/Containers/Bundle/Application/DDF71B22-F535-43E5-B770-D3425419B108/DemoSDk2.app/Frameworks/#######.framework/#########
Reason: no suitable image found. Did find:
/private/var/mobile/Containers/Bundle/Application/DDF71B22-F535-43E5-B770-D3425419B108/DemoSDk2.app/Frameworks/########.framework/Frameworks/Realm.framework/Realm: mmap() errno=1 validating first page of '/private/var/mobile/Containers/Bundle/Application/DDF71B22-F535-43E5-B770-D3425419B108/DemoSDk2.app/Frameworks/##########.framework/Frameworks/Realm.framework/Realm'
both in device and simulator the demo app crash
Dynamic frameworks are by definition not statically linked into binaries that link them.
This means dynamic frameworks must be shipped with the binaries that link them.
The typical way to do this for iOS apps is to have a build phase to copy the framework into your app bundle after compilation.
Due to restrictions by Apple for app store deployment it is not possible to dynamically link frameworks. This is an issue that is common amongst frameworks and not specific to Realm.
The following link is from Realm's GitHub discussion and explains in further detail and offers some work arounds (though none are particularly elegant.
https://github.com/realm/realm-cocoa/issues/3051

App crashes on iOS 6: Symbol not found: ___sync_fetch_and_add_4

I have an application that works perfectly with iOS4 and iOS5. It uses a statically compiled version of the zeromq library, targeted for ARM. Apple denied my application because they claim it crashes under iOS 6 (yet unreleased..wth?)
After trying it with the iOS 6 GM I can confirm it does crash when we initialize the ZeroMQ socket. Here is the crash messages:
dyld: lazy symbol binding failed: Symbol not found: ___sync_fetch_and_add_4
Referenced from: /var/mobile/Applications/00EDEEDA-0068-4061-9188-01D627F9A6D6/OpenAir.app/OpenAir
Expected in: /usr/lib/libSystem.B.dylib
dyld: Symbol not found: ___sync_fetch_and_add_4
Referenced from: /var/mobile/Applications/00EDEEDA-0068-4061-9188-01D627F9A6D6/OpenAir.app/OpenAir
Expected in: /usr/lib/libSystem.B.dylib
I understand the __sync_fetch_add_4 symbol is a compiler atomic builtin. I know that ZeroMQ is using mutexes for it's internal locking. I have been searching everywhere to try to figure out what changed in iOS6 that could cause these symbols not to be present.
Using Xcode 4.5 and iOS6 GM, the library will not even compile with the same type of message:
Undefined symbols for architecture armv7:
"___sync_fetch_and_add_4", referenced from:
zmq::socket_base_t::unregister_session(std::basic_string<unsigned char, std::char_traits<unsigned char>, std::allocator<unsigned char> > const&)in libzmq.a(libzmq_la-socket_base.o)
Is there a way to disable atomic builtins in the Apple compilers to try to bypass this problem altogether?
Make sure you aren't targeting any iOS below 4.3. Same goes for your static library, you will need to rebuild these. Also, make sure to remove armv6 from Archs and add armv7s is it does not exist.
After upgrading to Xcode 4.5, I tried everything for 2 days, and nothing worked. I finally gave up and went back to using Xcode 4.2.1
open -a /Developer/Applications/Xcode.app
Just to clarify. I've run my app on iOS 6 by building using the iOS 5 SDK. so unless you need iOS 6 functionality immediately, that works.
It shouldn't really be necessary to downgrade to an early version of iOS. I think the key is to use the extra bindings that are available for C and objective C development:
http://czmq.zeromq.org/
http://www.zeromq.org/bindings:objc
I used the czmq ones and can confirm these build with xcode in an iOS 6 project. I spent some time trying to get these to work as there's not much documentation on using them with iOS SDKs, but found the easiest method was to:
Download zeromq from http://download.zeromq.org/zeromq-3.2.2.tar.gz, extract, configure and build from the command line.
Download czmq from the link above and extract.
Import the src and include paths from the above into an xcode project.
Add -lstdc++ to the 'Other Linker Flags' section under 'Build Settings' for your target project
Import "czmq.h"
The libraries should successfully link together, then you should be good to go!

dyld isuess (Library not loaded)

I have this message when I build my project:
dyld: Library not loaded:
#rpath/iPhoneSimulatorRemoteClient.framework/Versions/A/iPhoneSimulatorRemoteClient
Referenced from: /Users/dev01/mobile/ios/Test/test/testTests/FoneMonkey/bin/iphonesim
Reason: image not found
This is dynamic link error and as I understand correct this error came because image not found. is this correct?
What steps should be taken to resolve errors?
I have found this link and as I understad this error came because I use xcode 4.3. Now I have try this on 4.2 and everething work good.
But I not have any idea how to run it on XCode 4.3
Maybe you have this problem after adding new library and you linked it in actual framework path, if you drag this library in embeded framework path then problem will solve. Another variant is that in build scheme you have enabled memory managment malloc, if you turn it off problem will be solved.
Check your SDK project settings (i.e. when passing from SDK 6.x to 7.x) maybe one of library was not compiled for architecture and project target. And the paths. Clean DerivedData and delete app from simulator (if it is there).
If you still need the Sdk just copy it from Xcode 4.6.(3) both for device and simulator and see if this solve your problem.

How to link an Adobe AIR3 Native Extension for iOS against an iOS framework?

I’m working on an app with an AIR3 iOS native extension that uses Accelerate.framework
Followed the first steps mentioned in the tutorials, successfully created an .ane file etc.
When I run the final packaging command (adt -package -target ipa-test ...), I get the following errors:
ld warning: unexpected srelocation type 9
ld warning: unexpected srelocation type 9
... (repeating several times)
Undefined symbols:
"_vDSP_vsdiv", referenced from: ...
"_vDSP_vsmul", referenced from: ...
... several more like this
ld: symbol(s) not found
Compilation failed while executing : ld64
I guess this is because when I created the .a file in xcode, it couldn’t really link it statically to the Accelerate.framework.
I suppose I need to tell adt to link it somehow? Probably in the phase I’m creating the .ane file? Or maybe I should change my extension.xml file?
No idea. Couldn’t really find it...
Please advise.
UPDATE: This seems like a bug on the Adobe side specifically with Accelerate.framework. I'll keep updating here in case other guys stumble upon this one.
Make sure you are using the latest Flex 4.6 SDK. If that doesn't solve it, ensure you have specified the Apple iOS SDK correctly under the Native Extensions tab of your Apple iOS build packaging in your project settings. It should be
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk
if you installed Xcode into the default folder
I've had this "srelocation" error, because the included libraries (in my case AudioToolBox/ OpenAL) were treated as shared libraries by XCode: They were not included in my library build (even when it's static). I've had to set "Enable Linking With Shared Libraries" under Build Settings to NO, and then the errors have been gone. Maybe this will solve your problem too...

Resources