Difference between revisions of "YARP and Python"

From Wiki for iCub and Friends
Jump to: navigation, search
m (fix spelling Linux)
Line 12: Line 12:
 
   sudo apt-get install python-dev python
 
   sudo apt-get install python-dev python
  
On 64 bit machine, you need to compile YARP as dynamic/shared library (CREATE_SHARTED_LIBRARY), otherwise you get the error:  
+
On 64 bit machine, you need to compile YARP as dynamic/shared library (CREATE_SHARED_LIBRARY), otherwise you get the error:  
  
 
relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
 
relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC

Revision as of 21:01, 11 January 2011

The current supported method for using YARP from Python is via SWIG. See:

 $YARP_ROOT/example/swig

Read the README in that directory.

If you go in there and run CMake ("ccmake ." on linux) you'll be presented with a bunch of language options (Java, Python, Perl, ...). Switch "CREATE_PYTHON" on, and then finish configuring. Then run "make". There may be lots of warnings from swig about language features that don't match exactly; it is usually safe to ignore these. Then hopefully the example in "example.py" will work for you.

Linux

Simple but important, don't forget to install python and python sources:

  sudo apt-get install python-dev python

On 64 bit machine, you need to compile YARP as dynamic/shared library (CREATE_SHARED_LIBRARY), otherwise you get the error:

relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC