Bundling .so files in an activity
I saw a very old message of yours on the sugar mailing list archive, talking about your experience bundling .so files into penguintv. I want to make some changes to a gtk widget (gtksourceview, so it accepts dynamically generated language definition files, see bityi for why) and bundle that in my activity. Can you give me an update of what you said back then? Note that since it's a gtk widget, I need both the python bindings and the widget itself, and I need some way to tell the python bindings where to find the widget - this last step is what has me confused at the moment. I'm gonna email you, but I think that the wiki is the best place to have this discussion so it is preserved for others. Cheers, Homunq 13:03, 11 February 2008 (EST)
The trick is compiling with a relative RPATH, like "./lib", so that no matter where the activity is installed, the loader will always look in the right place for the library.
For instance, if my python widget needs access to libfoo.so, normally during compilation and linking I'd know that libfoo.so would be in a specific place -- /usr/lib, /usr/local/lib, etc. On the OLPC, however, you're not allowed to install .so files, so they must be in the bundle. And the bundle could be anywhere, so the linker doesn't know what the absolute path of the lib will be.
So, we compile with a relative path like "./lib" and put the file in the bundle like this:
If the current working directory is my_bundle/, when the loader goes to link up the python widget it looks for libfoo.so in my_bundle/lib, finds it, and links.