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
Duncan, Thanks for your answer. I just realised that I was probably a bit too quick to claim that ~/usr/local/lib/R/bin/ is the only place that the dynamic linker is looking for libwx_gtk_html-2.5.so.1 I don't have much experience at reading strace output. I think it looks in the wrong place initially, but then in the correct place. On Jun 2004, Duncan Temple Lang wrote:> What should happen is that _core.so and all Python packages > should be linked against libpython2.2.so or libpython2.2.a. > We can tell whether this has happened via > > ldd /export/share/disk501/lab0605/wettenhall/usr/local/lib/python2.2/site-packages/wx/_core.so I haven't included all the ldd output from wxPython's _core.so but I can tell you that libpython2.2.so is not there. Here's some of the output: unix28 507 % ldd _core.so libwx_gtk_html-2.5.so.1 => /home/users/lab0605/wettenhall/usr/local/lib/libwx_gtk_html-2.5.so.1 (0x00842000) libwx_gtk_adv-2.5.so.1 => /home/users/lab0605/wettenhall/usr/local/lib/libwx_gtk_adv-2.5.so.1 (0x00d98000) libwx_gtk_core-2.5.so.1 => /home/users/lab0605/wettenhall/usr/local/lib/libwx_gtk_core-2.5.so.1 (0x00111000) libwx_base_xml-2.5.so.1 => /home/users/lab0605/wettenhall/usr/local/lib/libwx_base_xml-2.5.so.1 (0x003e5000) libwx_base_net-2.5.so.1 => /home/users/lab0605/wettenhall/usr/local/lib/libwx_base_net-2.5.so.1 (0x0054b000) libwx_base-2.5.so.1 => /home/users/lab0605/wettenhall/usr/local/lib/libwx_base-2.5.so.1 (0x005e5000) libpthread.so.0 => /lib/tls/libpthread.so.0 (0x004e6000) libc.so.6 => /lib/tls/libc.so.6 (0x00a39000) <snip>> > nm /export/share/disk501/lab0605/wettenhall/usr/local/lib/python2.2/site-packages/wx/_core.so | grep PyExc_IOErrorThis returns: unix28 510 % nm _core.so | grep PyExc_IOError U PyExc_IOError i.e. the symbol is undefined in wxPython's _core.so whereas it is defined in libpython2.2.so : unix28 513 % nm libpython2.2.so | grep PyExc_IOError 000f65d8 B PyExc_IOError (To be precise, it is declared but not initialized). OK, so I guess I will experiment with trying to build wxPython and get it to link against libpython2.2.so. Or maybe for each wxPython .so file, I can just add a libpython2.2.so dependency with something like: ld -o _core2.so _core.so libpython2.2.so mv _core2.so _core.so I'll play around with this sort of thing for a while... Regards, James