-
Notifications
You must be signed in to change notification settings - Fork 87
Description
The base library is built for iOS, but I don't believe the current approach works in practice. In my preliminary testing it failed to load the library at runtime (although I should mention this was in a Unity game, where the iOS build pipeline is a bit finicky).
Are you currently verifying the iOS support in any way?
I'm not an iOS developer by trade, but based on what I know from previous experience with integrating native libraries on iOS, in order to properly load a dylib on an iOS device,
- It must be wrapped in a framework (basically a directory named
{library_name}.framework, containing the library and anInfo.plistfile with various metadata). - The library file itself should not have a file extension (but this might just be convention)
- The library's install name property should be of the form
@rpath/{library_name}.framework/{library_name}. This can be set usinginstall_name_tool -id {new_install_name} path/to/libraryon MacOS (and read usingotool -l path/to/library). I'm not 100% sure if the@rpath/prefix is necessary though, as I don't remember the exact details around it right now.
AFAIK, it is possible to load a "bare" .dylib file, but it only works in development builds and will fail when attempting to build a release archive, specifically due to code signing issues IIRC.
Oh, and the current install name is liblmdb.so (set by the compiler, not updated when the file gets renamed), which is probably why it fails to load right now, even in development builds.
Setting up a proper Xcode build pipeline that outputs a framework directly is probably not too complicated, but I don't have the exact details on hand atm. Another way to do it is to just set up the expected folder structure and Info.plist file manually and use install_name_tool to set the correct install name, but this is a bit more fragile.
Finally, I believe clients also need to register the framework in their Xcode project in order for things to work, so some manual intervention may be necessary in the end.
I will be looking further into this in the coming days, but I'm not sure if I'll be able to allocate enough time to submit a proper PR - I may need to go with the hacky solution of manually creating a framework around the library file for now.