I have this console helper class which connects to a color measurement instrument via a (bunch of) C libraries being declared into. Which works on Windows.
On macOS, issues started when trying to open the dylibs as they have not been signed by the manufacturer. I moved them into the main project, ran a build with App Wrapper, and now can basically open them in Terminal and list their symbols.
Anyway, when trying to run an external method, result is always “could not load function”.
I then tried DeclareLibraryMBS and connected classes (which is better to handle this way anyway as the main library has a callback method).
Result is an UnsupportedOperationException “Failed to read library”.
Any ideas how to fix such an issue? @Christian_Schmitz ?
What does code look like and what is error message?
Usually you may need to sign libraries and app with same team to make them load.
or use entitlement to load any library.
This is a test code I inserted. Library file exists.
What entitlements would I need?
I’ll adjust the plugin to present an error message better:
Can you try this plugin and check what error message is now shown?
Thank you! Rest is on 23.6 and it seems I have to remove (or update) a different plugin…?
Yes, some things moved.
Please download 24.0pr7 here to get other plugins in newer version:
Thank you, Christian. Got it installed now, and error is now
dlopen(/Users/uli/Documents/Repositories/Capture Desktop/CCMyiro9/CCMyiro9.debug/Frameworks/libFD9SDK.dylib, 0x000A): Library not loaded: @executable_path/…/frameworks/libopencv_highgui.2.4.7.dylib
Referenced from: <0C74E9B2-B1FB-30AB-A0A9-A9365B531737> /Users/uli/Documents/Repositories/Capture Desktop/CCMyiro9/CCMyiro9.debug/frameworks/libFD9SDK.dylib
Reason: tried: ‘/Users/uli/Documents/Repositories/Capture Desktop/CCMyiro9/frameworks/libopencv_highgui.2.4.7.dylib’ (no such file), ‘/usr/local/lib/libopencv_highgui.2.4.7.dylib’ (no such file), ‘/usr/lib/libopencv_highgui.2.4.7.dylib’ (no such file, not in dyld cache)
Mentioned library is in frameworks folder (and libFD9SDK too) – would that mean I have to load it in a similar way before?
More or less answer to myself:
Loading connected libs as DeclareLibraryMBS doesn’t help. Do you have any advice if a dlopen will make them shared for the system? You see core could be opened – seems to have no dependencies –, but highGUI still misses it.
I think this answers your question. The highgui library is for adding ui components to windows but console apps don’t have access to that.
Throws a few questions for me. Why did they make a device library GUI dependent? Why does it work on Windows console where even more libraries are involved?
(Not your task to answer. Thanks!)
Here’s the page I was referencing:
I don’t think you can compare to Windows. On macOS, the UIKit libraries are typically unavailable to console apps.
I did notice however that the path you are using is incorrect:
That … is probably incorrect. That should be … and Frameworks may be case-sensitive
NM: console app, not bundle.
Looks like there are dependencies.
You may need to put a lot of more dylibs in the framework folder.