progress with bundled C libraries
Dan Williams
dcbw at redhat.com
Mon Nov 6 09:39:40 EST 2006
On Mon, 2006-11-06 at 12:11 +0100, Bert Freudenberg wrote:
> Sounds good. Maybe we even want to add this to the default bundle
> layout and Activity code? That way it would just work for other
> activities to put their libs into <bundle>/lib without worrying about
> how this will be accomplished ...
That's a good suggestion; activities could always override this with a
custom RPATH if they really want to.
Dan
> - Bert -
>
> Am 06.11.2006 um 02:15 schrieb Owen Williams:
>
> > I think I've solved the problem of bundled libraries on OLPC.
> >
> > Summary of problem:
> > Activities are expected to bundle their own libraries, but activities
> > can't know where they will be installed. Also, activities never
> > have a
> > chance to set LD_LIBRARY_PATH, so how can they link to their
> > libraries?
> >
> > Solution:
> > Set up a relative RPATH inside the python modules that link to the C
> > libraries.
> >
> >
> > For instance, I use the pycurl library which is a python module that
> > links to the C library libcurl. I can append to sys.path to tell
> > python
> > where pycurl is, but I can't do something similar with libcurl.
> >
> > However, If I compile pycurl and set runtime_library_dirs=['./
> > lib'], and
> > then os.chdir to my activity directory on load, the libraries link up
> > and everyone's happy. I don't have a complete working bundle, but
> > initial tests are promising.
> >
> > In my PenguinTVActivity module, I do this:
> > try:
> > #try the import because hey, it might work
> > import pycurl
> > except:
> > #yeah, well, what did we expect
> > logging.warning("Trying to load bundled pycurl libraries")
> >
> > #import ourselves
> > import PenguinTVActivity
> >
> > #where the hell are we?
> > activity_root = os.path.split(PenguinTVActivity.__file__)[0]
> >
> > #change to that folder, so that RPATH="./lib" will work
> > os.chdir(activity_root)
> >
> > #also append to sys.path so modules load
> > sys.path.append(os.path.join(activity_root, 'site-packages'))
> >
> > #try again. if it fails this time, it fails.
> > import pycurl
> >
> > I'm downloading FC6 now to install in a vmware image, so tomorrow I
> > should be able to build my own modules and test this for sure.
> >
> > Owen
> >
> > _______________________________________________
> > Devel mailing list
> > Devel at laptop.org
> > http://mailman.laptop.org/mailman/listinfo/devel
>
> _______________________________________________
> Devel mailing list
> Devel at laptop.org
> http://mailman.laptop.org/mailman/listinfo/devel
More information about the Devel
mailing list