SIMBL plugin fails to load framework - macos

On console, I am getting these errors:
27.08.11 20:56:06,371 sandboxd: ([83008]) TextEdit(83008) deny file-read-data /Users/az/Library/Frameworks/FScript.framework/Versions/A/FScript
27.08.11 20:56:06,372 TextEdit: Error loading /Users/az/Library/Containers/com.apple.TextEdit/Data/Library/Application Support/SIMBL/Plugins/FScriptAnywhere.bundle/Contents/MacOS/FScriptAnywhere: dlopen(/Users/az/Library/Containers/com.apple.TextEdit/Data/Library/Application Support/SIMBL/Plugins/FScriptAnywhere.bundle/Contents/MacOS/FScriptAnywhere, 265): Library not loaded: #executable_path/../Frameworks/FScript.framework/Versions/A/FScript
Referenced from: /Users/az/Library/Containers/com.apple.TextEdit/Data/Library/Application Support/SIMBL/Plugins/FScriptAnywhere.bundle/Contents/MacOS/FScriptAnywhere
Reason: no suitable image found. Did find:
/Users/az/Library/Frameworks/FScript.framework/Versions/A/FScript: open() failed with errno=1
The file FScriptAnywhere.bundle/Contents/Frameworks/FScript.framework/Versions/A/FScript exists. Thus, I don't understand the error / the problem.
Any idea?

Found the problem:
#executable_path is relative to the app, not the bundle, i.e. in this case TextEdit. Of course it doesn't find the framework there.
It also cannot load the framework from ~/Library/Frameworks because of the sandboxing of TextEdit.
Copying the framework over to /Library/Frameworks solved the problem.

Related

Relative framework paths, the Hardened Runtime and Notarization

After successfully notarizing my app around a dozen times and it working just fine, it now goes through notarization without a hitch and then crashes on launch with:
Dyld Error Message:
Library not loaded: #loader_path/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder
Referenced from: /Applications/Vitamin-R 3.app/Contents/MacOS/Vitamin-R 3
Reason: no suitable image found. Did find:
/Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder: code signing blocked mmap() of '/Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder'
/Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder: code signing blocked mmap() of '/Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder'
/Applications/Vitamin-R 3.app/Contents/MacOS/../Frameworks/ShortcutRecorder.framework/Versions/A/ShortcutRecorder: stat() failed with errno=1
file system relative paths not allowed in hardened programs
Thing is I'm not sure where exactly the runtime path for a framework is determined.. I keep the framework in ~/Libary/Frameworks/ on my development machine, but then it's copied into the app bundle and I'm not quite sure what determines the path at runtime..
Any help would be appreciated.
This could be a codesign certificate issue... Fix it by:
Open Keychain Access: My Certificates > "Right Click" Certificate > get info > Trust > When using this certificates > Use System Defaults
I had exactly the same issue. The solution was to add the framework to the 'Copy Files' build step as well. There you can define the destination to 'Frameworks'.

What's different between open App.app file and App.app/contents/MacOS/Electron on MacOS?

I have an electron application.It is an updater with download another application and toolchain.I can't open it with open Updater.app.However, I can use Updater.app/contents/MacOS/Electron to open it.
Here is the log:
Non-fatal error enumerating at <private>, continuing: Error Domain=NSCocoaErrorDomain Code=260 "未能打开文件“PlugIns”,因为它不存在。"
UserInfo={
NSURL=PlugIns/ -- file:///private/var/folders/xn/08sc_nts0n11yyw_3ddlngdh0000gn/T/AppTranslocation/A0F3B185-B4AB-4CC8-A3C5-86DAA22043D5/d/Updater.app/Contents/,
NSFilePath=/private/var/folders/xn/08sc_nts0n11yyw_3ddlngdh0000gn/T/AppTranslocation/A0F3B185-B4AB-4CC8-A3C5-86DAA22043D5/d/Updater.app/Contents/PlugIns,
NSUnderlyingError=0x7fd1d2d13fe0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}
}
I would like to know the difference between Updater.app and Updater.app/contents/MacOS/Electron.
Updater.app is a macOS App Bundle. App Bundles are Apple's way of packaging a program - each one is basically just a folder containing an executable program and all the configuration files, helper executables, images, shipped libraries, and other resources the program needs to run.
In your case, Updater.app/Contents/MacOS/Electron is probably the main executable of the app - <App>/Contents/MacOS/ is usually the location of an App Bundle's main executable.
For further reading, look over this answer which further explains the general concept of a macOS App Bundle.

XCTest unit test don't work because of framework signature

I've a dynamic framework that doesn't have signature
CODE_SIGNING_ALLOWED = NO
CODE_SIGNING_REQUIRED = NO
EXPANDED_CODE_SIGN_IDENTITY =
Main application that this framework is linked works fine, while tests are failing with code signature requirement.
2016-10-05 17:40:40.034 xctest[46026:374452] The bundle “CoreUnitTests.xctest” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2016-10-05 17:40:40.035 xctest[46026:374452] (dlopen_preflight(/Users/user/Library/Developer/Xcode/DerivedData/Application-cafxiqfcbbczvkezpwscftqdsllz/Build/Products/Debug-iphonesimulator/CoreUnitTests.xctest/CoreUnitTests): Library not loaded: #rpath/Core.framework/Core
Referenced from: /Users/user/Library/Developer/Xcode/DerivedData/Application-cafxiqfcbbczvkezpwscftqdsllz/Build/Products/Debug-iphonesimulator/CoreUnitTests.xctest/CoreUnitTests
Reason: no suitable image found. Did find:
/Users/user/Library/Developer/Xcode/DerivedData/Application-cafxiqfcbbczvkezpwscftqdsllz/Build/Products/Debug-iphonesimulator/Core.framework/Core: required code signature missing for '/Users/user/Library/Developer/Xcode/DerivedData/Application-cafxiqfcbbczvkezpwscftqdsllz/Build/Products/Debug-iphonesimulator/Core.framework/Core'
/Users/user/Library/Developer/Xcode/DerivedData/Application-cafxiqfcbbczvkezpwscftqdsllz/Build/Products/Debug-iphonesimulator/Core.framework/Core: required code signature missing for '/Users/user/Library/Developer/Xcode/DerivedData/Application-cafxiqfcbbczvkezpwscftqdsllz/Build/Products/Debug-iphonesimulator/Core.framework/Core'
)
Program ended with exit code: 82
Is there a way to disable code signature requirement in test bundle?

EmguCV 'Emgu.CV.CvInvoke' Exception

I have installed EmguCV 2.4.2.1777. I have a 32-bit windows 7 so I installed it using the installer. Now I am trying to write a simple code to capture a webcam's video in a window in C#.
The problem is after during execution I am getting the following famous error:
A first chance exception of type 'System.DllNotFoundException' occurred in Emgu.CV.dll
A first chance exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll
An unhandled exception of type 'System.TypeInitializationException' occurred in Emgu.CV.dll
The file Emgu.CV.dll is present in the folder. I don't understand why its giving that error.
I tried all the checks which are suggested by fellow stackoverflow users and also many other references:
1) Installed MSVCR: MSVCRT 10.0 SP1 x86
2) copied the OpenCV dlls to the execution directory
3) I also have a 32-bit OS. So that also should'nt be an issue.
But when I checked for dependencies, I faced a problem:
I used DependecyWalker to open cvextern.dll and found the following dependencies missing:
NVCUDA.DLL
API-MS-WIN-CORE-COM-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL
DCOMP.DLL
IESHIMS.DLL
It also gave the following:
Error: At least one required implicit or forwarded dependency was not found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
Please help me out with the exception. Thanks in advance.
I copied all the dll files from C:\Emgu\emgucv-windows-universal-gpu 2.4.9.1847\bin\x86 to a folder called includes in my project and updated the "Copy To Output Directory" Option for these DLLs to "Copy Always" and it got rid of this issue.

can't share an archive in Xcode due to missing icon\r file

I put my Xcode project within my dropbox folder and now it seems like every time i try to share my archive from within the organizer it keep giving me the following error:
error: Codesign check fails : /var/folders/7l/l93zzs6n4h14qb7rmj5r7zn00000gn/T/GtLyx05w1O/Payload/stryker.app: a sealed resource is missing or invalid
In architecture: armv6
resource added: /private/var/folders/7l/l93zzs6n4h14qb7rmj5r7zn00000gn/T/GtLyx05w1O/Payload/stryker.app/www/Icon
resource missing: /private/var/folders/7l/l93zzs6n4h14qb7rmj5r7zn00000gn/T/GtLyx05w1O/Payload/stryker.app/www/Icon
I believe this error is caused by the fact that Xcode can see the icon/r file associated with drop box.
Is there a way i can delete this file?
I was able to share my archive after I deleted the icon\r file. Please refer to the following post for more info
https://apple.stackexchange.com/questions/31867/what-is-icon-r-file-and-how-do-i-delete-them/31877#31877

Resources