Can't run xctest on macOS app - couldn’t be loaded because it is damaged or missing necessary resources - objective-c

Please do help me on this scenario. I saw several post related to this, but could not able to resolve the issue with my mac App without pods.
Project is several years old, developed in macOS(Objective C). Now I am trying with XCTest for unit testing. Using Xcode 7.3.1, I am not able to run tests classes.
This project is to create frame work. Project is working fine, only issue is with the testing. We are not supposed to do Pods or some other alternatives.
Console window shows below points:
xctest[35530:345970] The bundle “BaseLibTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle. xctest[35530:345970]dlopen_preflight(/Users/12345678/Documents/Modify/Cocoa/Projects/BaseLib/build/Debug/BaseLibTests.xctest/Contents/MacOS/BaseLibTests): Library not loaded: #executable_path/../Frameworks/FreeTDS.framework/Versions/A/FreeTDS
Referenced from: /Users/12345678/Documents/Modify/Cocoa/Projects/BaseLib/build/Debug/BaseLib.framework/Versions/Current/BaseLib
Reason: no suitable image found. Did find:
/Library/Frameworks/FreeTDS.framework/Versions/A/FreeTDS: no matching architecture in universal wrapper)
Program ended with exit code: 82

#Anand For the 3rd Point: Please check the build settings.
Please make sure its either set to Standard Architectures (64-bit Intel) (x86_64) - $(ARCHS_STANDARD) or set to represent proper architectures.
To debug this more, could you please copy paste the exact error you are facing and share the build env variables?

Related

LWIP library files not building on Atmel 7.0 when setting NO_SYS=1

I've got a strange question that I can't seem to find any answers for. I'm building a quite simple application for sending/receving data from/to a PCB, and the application itself builds, but when I exited Atmel Studio (Version 7.0) and reopened the project, the library files no longer built. At least that's what I think happened. I didn't change any code between building the project before and after restart of the program. It has happened before, and that time I solved it by creating the project from scratch, but I'd really like that not to be the only solution. I've also tried restarting the program again, as well as the computer. I also removed and re-added the library.
Has anyone encountered the same issue? If so, any help in the right direction would be greatly appreciated. Information on my system and error messages below:
I'm building for the ATSAMV71N21B board, with Atmel Studio 7.0. I've imported the lwip library trough the ASF wizard, and these files built before the program restart.
These are the files that won't build:
The 122 build errors mainly consists of "expected expression before 'struct'" and undeclared functions and variables, even though these clearly are defined in the various files in the library.
It ended up being because of my NO_SYS setting being 1. When I switched it to 0, everything built, (except for sys_check_timeouts(), but I think I'll find another answer for this). Keeping this here for reference if anyone needs it one day.

Invalid resource directory CocoaTouch framework

I'm trying to compile a basic Cocoa Touch framework to test this new feature in iOS 8 but I'm encountering some problems. First of all the framework doesn't import any other frameworks or libraries and the deployment target is set to iOS 8 (regular project when trying to create an Cocoa Touch framework. I added two methods:
- addValue:toValue
- subtractValue:fromValue
Compiling the framework goes without any problems as long as I'm not trying to code sign it. When I import the framework in my TestFramework project and I press build I getting this as build result:
I'm running into a peculiar error which doesn't seem to affect anyone on the web because nobody has complained about this error yet. The error is as following:
Warning: usage of --preserve-metadata with option "resource-rules" (deprecated in Mac OS X >= 10.10)!
.../DerivedData/TestFramework-ethagmafcjzncuftipguwzdeiezh/Build/Products/Debug-iphoneos/TestFramework.app/Frameworks/BasicFramework.framework: replacing existing signature
.../DerivedData/TestFramework-ethagmafcjzncuftipguwzdeiezh/Build/Products/Debug-iphoneos/TestFramework.app/Frameworks/BasicFramework.framework: invalid resource directory (directory or signature have been modified)
I mentioned that this "invalid resource directory" is an known issue for MAC developers but I can't seem to find the right solution. Who can point me in the right direction?
EDIT: I found out that it definitely has something to do with the code signing. Probably I need to code sign the framework too but that's not possible because I encounter the same error.

Dyld Error Message: Library not loaded: /usr/lib/libusb-1.0.2.dylib OSX

I am trying to release an app for OSX but every time someone runs the app on their machine they get:
Dyld Error Message:
Library not loaded: /usr/lib/libusb-1.0.2.dylib
Referenced from: /Users/USER/Desktop/____.app/Contents/MacOS/____
Reason: image not found
The guy on this post suggests it is the path that the package was built with Dyld: Library not Loaded Error Mac OS
But even if I build the app with no prefix I still have the issue.
Then I tried to build using:
./configure --disable-dependency-tracking --disable-static --prefix=#executable_path/../Frameworks/
But that gave a error of an invalid path. I am including the dylib in the package. I have to use libusb 1.0.16RC10 because there is a bug in the newest stable release that breaks mouse and keyboard functionality on the MBP for a short period of time ever time you scan for devices.
Please tell me there is a way to have it included that every use doesnt have to compile their own libUSB.
So if you're including your .dylib within the framework directory, now you just need to run the "install_name_tool" to point your app to that dylib within the application package, instead of "/usr/lib".
To do this, add a "Run Script" build step after the compiling and linking has finished. And in this build phase, the script will be as simple as:
install_name_tool -id #executable_path/../Frameworks/libusb-1.0.2.dylib path/to/your/project/libusb-1.0.2.dylib
The tutorial I'm looking at can be found here. I hope this helps you out!

How can I fix a missing mscorelib.dll error that occurs when trying to run a Mono for Android app?

In MonoDevelop when compiling and running an app developed for Android against the simulator, the app compiles then crashes immediately in the simulator with the following application output...
E/mono ( 225): The assembly mscorlib.dll was not found or could not be loaded.
E/mono ( 225): It should have been installed in the `/home/jon/Development/xamarin/mono/BUILD/armeabi/install/lib/mono/2.0/mscorlib.dll' directory.
Keep in mind that I'm not Jon so I don't even know where it's getting the /home/jon path configuration. Though I have found that path in other similar but ultimately unrelated searches on the internet so I imagine it's a path on some other devs machine.
mscorlib.dll is indeed on my machine. located here...
/Developer/MonoTouch/usr/lib/mono/2.1/
and here...
/Developer/MonoAndroid/usr/lib/mono/2.1/
I've tried targetting various Android SDK environments (currently 2.3 and the simulator is currently running under the 2.3 SDK environment as well).
I'm on Mac OSx 10.7.2. Using the latest version of MonoDevelop, Mono and Mono for Android. I've also got the latest MonoTouch installed as well and iPhone apps compile fine if that's worth anything.
The closest thing I can find to a hint at the issue is here...
http://phonicuk.com/Forums/ViewThread.aspx?tid=401
I've tried reinstalling Mono and Mono for Android but admittedly have not tried uninstalling in entirely before a reinstall. I've searched within files for the /home/jon path thinking that it must be a configuration somewhere but haven't been able to find it anywhere.
I found this... Mono return error: mono mscorlib.dll was not found
Along with a few other things that were sort of in the same vein, but ultimately nothing that seems to be a fix.
Any ideas?
Update: From the suggestions in jonp's answer below it indeed seems like the Mono.Android.DebugRuntime package is not installed. So far I've tried a couple of MonoAndroid reinstalls and have tried removing MonoAndroid entirely beforehand. I'm trying to figure out if there is a way to add the package manually, but I'm so new to this.
Another update: Not sure why I didn't try this already, but I created a HelloWorld MonoAndroid app and it works fine. The compilation took a while longer too for that one and I could see if was setting up the required packages, so there has to be an issue with the specific solution.
When you install a Debug build of your app on the device, three .apk files are installed:
Mono.Android.DebugRuntime, which contains libmonosgen-2.0.so, mscorlib.dll, etc.
Mono.Android.Plaltform.ApiLevel_N, which contains Mono.Android.dll for API level N.
Your application.
My guess is that the Mono.Android.DebugRuntime package has not been installed. To check this, run:
adb shell pm list packages | grep Mono.Android
I'm going to guess that it's missing. :-)
Next, why is it missing? When you Run the app within MonoDevelop, all required packages are checked for and installed. It seems rather odd that it wouldn't be. Is your device low on disk space?
adb shell df /data
How are you launching the emulator? If you're launching within MonoDevelop, there should be enough free space to install all of the above packages. However, if you launch it yourself, the default /data size is 64MB, which isn't enough to support a Debug build environment. Please launch the simulator from MonoDevelop and re-Run your app, or launch the emulator so that it has enough free space:
emulator -partition-size 512 -avd YOUR_AVD_NAME

How do I build an app and framework on OS X 10.6 that can run on 10.5?

Here's my situation: I have the source code for a third-party framework that I want to include in my project. I'm developing on 10.6 but I want to support 10.5, so I have the base SDK and the deployment target set to 10.5.
I can build the framework and the application, and the app runs inside Xcode and on the machine. However, it fails on a 10.5.8 and crashes. The crash report says
Unknown required load command 0x80000022
I have also tried building the framework on the 10.5.8 machine, setting the architecture to '32/64-bit Universal'. Moving this framework to the 10.6 machine and attempting to build the app works, but the app fails to run, throwing multiple errors of:
-[NSCFArray matchAndAssemble:]: unrecognized selector sent to instance 0x3503c0
Has anyone seen this before? Do you know of a fix or workaround? It can't be an uncommon situation.
The loader command being flagged is the loader command for a compressed binary which is a binary type supported only on 10.6.
matchAndAssemble: is not a (documented) method of NSArray/NSMutableArray. It is, however, a method of the PKParser kit. Is that the framework you are trying to build?
Anyhow, something in your project is being built only for 10.6 and it's probably that framework. Check the build settings for all of your targets, and any targets of any sub projects and do an otool -l on any third party frameworks to look for the 22 load command.
Answer for the first error: unable to read unknown load command 0x80000022 - Stack Overflow, and it might have a bearing on the second error. What version Xcode and SDK are you using?