progress with bundled C libraries

Bert Freudenberg bert at freudenbergs.de
Mon Nov 6 06:11:27 EST 2006


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 ...

- 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




More information about the Devel mailing list