[Rd] Nested shared library calls in Linux

James Wettenhall wettenhall at wehi.edu.au
Tue Jun 8 15:41:05 CEST 2004


Hi,

I have an interface from R to the wxPython GUI toolkit which 
works under Windows:
http://bioinf.wehi.edu.au/folders/james/wxPython/

(as long as you build RSPython with a shared (not static) 
Python library).

But on Linux I get an error:
> library(RSPython)
> importPythonModule("wx")
Error in .PythonEval(cmd) : Error in Python call: 
/export/share/disk501/lab0605/wettenhall/usr/local/lib/
python2.2/site-packages/wx/_core.so: 
undefined symbol: PyExc_IOError

I am working within my home area at the moment:
~ 
= /home/users/lab0605/wettenhall/
= /export/share/disk501/lab0605/wettenhall/

By running strace, I found that the Python command "import wx" 
correctly loads 
~/usr/local/lib/python2.2/site-packages/wx/_core.so

but then when _core.so tries to load libwx_gtk_html-2.5.so.1 
(its first shared-library-dependency), it only looks 
in one place:
~/usr/local/lib/R/bin/
i.e. THE DIRECTORY CONTAINING THE R SHARED LIBRARY.
when in fact it should be looking in:
~/usr/local/lib/

Has LD_LIBRARY_PATH somehow been collapsed into just one 
directory???  I have tried checking it with Sys.getenv() 
just before running importPythonModule("wx"), and 
it seems to be OK:  ~/usr/local/lib/ is certainly included 
in $LD_LIBRARY_PATH. 

I have included ~/usr/local/lib in my PYTHONPATH and 
I can also modify the Python path within R, using:
importPythonModule("sys")
.PythonEval("path=['path1','path2',...]",.module="sys")
or .PythonEval("path.append ...",.module="sys")

I have registered the shared libraries with ldconfig.

One more complication is that libwx_gtk_html-2.5.so.1 is 
actually a symbolic link to libwx_gtk_html-2.5.so.1.0.0 
(in the same directory, ~/usr/local/lib).

I'm running Fedora Linux with R 1.9.0. I've installed Python 
2.2.3 from source in ~/usr/local/ and I've built RSPython 
0.5-3 with a shared Python library libpython2.2.so (which I 
built from the Python source).  R and wxPython are also 
installed from source, both in ~/usr/local/ and R is 
configured with --enable-shlib.

If it would be helpful, I could try to come up with a much 
simpler example of nested shared-library calls from R, but 
people may wish to suggest that this is not the real problem.

Regards,
James

> version
         _
platform i686-pc-linux-gnu
arch     i686
os       linux-gnu
system   i686, linux-gnu
status
major    1
minor    9.0
year     2004
month    04
day      12
language R



More information about the R-devel mailing list