[R-gui] R-wxPython and dynamic linking issues

James Wettenhall wettenhall at wehi.edu.au
Wed Jun 23 07:03:39 CEST 2004


Hi Vaidotas,

On Wed, 23 Jun 2004, Vaidotas Zemlys wrote:
> Could you please provide an example when this situation arises? 
> I would gladly  test it.

After building wxPython 2.5.1.5 from source on Fedora Linux, 
without editing config.py and adding libpython2.2.so to the 
newLFLAGS, I got an error like:
"Undefined Symbol: PyExc_IOError"
when I tried to import the wx module when Python was embedded 
within R.  I tried building RSPython with a shared (instead of 
static) library, but this didn't seem to help, so I built 
wxPython linking against libpython2.2.so as well (editing 
config.py's newLFLAGS to inclue libpython2.2.so), and then I 
could import wx into Python embedded in R without problems.

But now, when I try to run some code from my preliminary 
R-wxPython package at:
http://bioinf.wehi.edu.au/folders/james/wxPython/

I get undefined symbols errors when I try to import the parser 
module, which is actually a shared library, see:
rpm -ql python | grep "\\.so"
/usr/lib/python2.2/lib-dynload/parsermodule.so

OR I think it might be called "parser.so" rather than 
"parsermodule.so", depending on your Python version.

Currently in my R-wxPython package, the parser module is used by
the wxDialogPython() function which is called by:
getMethod("wxShow","wxDialog")

When I use "import parser", I get errors like:
Error in Python call: 
/home/users/lab0605/wettenhall/usr/local/lib/python2.2/lib-dynload/parser.so: 
undefined symbol: _Py_TrueStruct

One solution is just to remove all instances of "import parser".  
The only reason I use it is to use the Python 'exec' function to 
try register widgets/controls in a way that R can later access 
them, e.g. after creating a dialog, you might want to disable a 
particular checkbox from within R.  Unfortunately, this 
widget-registering mechanism is not working yet, maybe due to my 
lack of understanding of RSPython and foreign object references, 
so I could just remove all instances of "import parser", but it 
would be nice to know why I get undefined symbol errors.

I still haven't really had time to test building RSPython against 
python statically but using the whole-archive options to include 
as many symbols as possible in RSPython/libs/RSPython.so

Regards,
James


On Wed, 23 Jun 2004, Vaidotas Zemlys wrote:
> Hi,
> > 
> > I've mentioned before that when trying to run R-wxPython in
> > Linux, you very quickly run up against some nasty dynamic
> > linking issues, where RSPython can't find certain Python symbols
> > in the wxPython shared libraries, so I had to rebuild wxPython
> > linking against a Python shared library libpython2.2.so.
> 
> Could you please provide an example when this situation arises? I would gladly  
> test it.
> 
> Vaidotas
> 
> _______________________________________________
> R-SIG-GUI mailing list
> R-SIG-GUI at stat.math.ethz.ch
> https://www.stat.math.ethz.ch/mailman/listinfo/r-sig-gui
> 

-- 
--------------------------------------------------------------------------
James Wettenhall                                  Tel: (+61 3) 9345 2629
Division of Genetics and Bioinformatics           Fax: (+61 3) 9347 0852
The Walter & Eliza Hall Institute         E-mail: wettenhall at wehi.edu.au
 of Medical Research,                     Mobile: (+61 / 0 ) 438 527 921    
1G Royal Parade,
Parkville, Vic 3050, Australia
http://www.wehi.edu.au



More information about the R-SIG-GUI mailing list