[R] Re: [Omega-help] RSPython_0.3.0 on FreeBSD 4.*:

loren mccarter lorenmc at socrates.berkeley.edu
Thu Nov 1 20:12:40 CET 2001


Thanks for your help Duncan. Your last comment helped me to figure
out what FreeBSD was doing differently than Linux/Solaris. This fix worked
on a machine with Python 2.1, R 1.3.1 and FreeBSD 4.1. Here are the
details: 

The pthreads fix: I added '-lc_r' to the PKG_LIBS  definition in
src/Makevars.in. The FreeBSD 'man pthread' page suggests that adding
-pthread to the gcc statement (as opposed to -lpthread) will tell gcc to
use libc_r instead of libc to find pthreads (see more on pthread man page
in previous emails below). This did not work for me, but using '-lc_r' did
work. libc_r is located  in /usr/lib on my machine. This got me to the
state you describe below where 'openpty' was missing. The fix you
described worked for me also. After editing src/Makevars.in to add
-lutil, the following command worked for the install: 

    R INSTALL -c RSPython

library(RSPython) reported no errors. I ran example(.Python) and
example(.PythonPath) and they both worked fine. 


Some miscellaneous notes about FreeBSD and this Package: 

  --with-threads: Using the configure-arg 'with-threads' resulted in the
following error on FreeBSD:

gcc -shared  -o RSPython.so GeneralConverters.o PythonCall.o
PythonFunctionConverters.o PythonReferences.o PythonReflectance.o RCall.o
RPythonConverters.o RPythonReferences.o UserConverters.o -L/usr/local/lib
-L/usr/local/lib/python2.1/config -lpython2.1 -L/usr/local/lib/R/bin
-lpthread -lc_r -lutil 
/usr/libexec/elf/ld: cannot find -lpthread
*** Error code 1

  Replacing '-lpthread' with '-pthread' in configure* (i.e., configure.in)
fixes the error message, but pthreads are still undefined in
RSPython.so unless -lc_r is an argument to gcc. I don't know much more
about why this is the case. 

  --without-threads: For some reason, specifying --without-threads also
includes -lpthread as an argument to gcc. The statement I'm using is: 

    R CMD INSTALL --configure-args='--without-threads' -c RSPython


  ldd and objdump: In trying to find out about the dependencies of
RSPython.so, I had difficulty getting the dependency list from objdump
that ldd provides. On FreeBSD, ldd works on a.out and elf executables but
not elf shared libraries (at least that's all I could seem to find on the
topic).

Thanks again for your help! It appears to be working fine. 

Loren


On Thu, 1 Nov 2001, Duncan Temple Lang wrote:

> 
> The installation of Python2.2b1 was painless and easy, so I did that
> and then installed RSPython. I got amlost the same error message that
> you did, except mine was for a slightly different symbol in
> libpthread.so and we expect the order of the symbol resolution might
> be different on FreeBSD and Yellow Dog Linux.
> 
> So, then I tried adding the --with-threads to the configuration options
> for the RSPython, i.e.
>    R CMD INSTALL --configure-args='--with-threads' RSPython
> and that got me one step closer. Loading the RSPython
> library gave me an error about the missing symbol `openpty'.
> On my system, that is in /usr/lib/libutil.so, so I modified
> the src/Makevars.in file in the RSPython distribution
> and appended  
>    -lutil 
> to the definition of PKG_LIBS.
> 
> Then, I did I reinstallation and RSPython loaded as expected, and even
> works as expected! 
> 
> I'll look into how autoconf should figure out if libutil.so is needed.
> 
> Please let me know if this sorts things out on FreeBSD.
>  D.
> 
> Duncan Temple Lang wrote:
> > 
> > Hi Loren.
> > 
> >  So I'm not clear whether you did the install using the --with-threads argument to
> > configure, i.e.
> >   R CMD INSTALL --configure-args='--with-threads' RSPython
> > and hence end up with a link command that included -lpthread?
> > 
> >  On Linux and Solaris, ldd will tell me what other dependent shared
> > libraries will be loaded when I load RSPython.so.  Does the FreeBSD
> > equivalent (objdump -xtT) mention libpthread.so at all?
> > 
> >  I haven't actually tried this package with Python 2.1 yet. Perhaps
> > this could be related to this. I'll try to find time to install using
> > 2.1.
> > 
> >  This shouldn't be too hard to fix, just a matter of getting the
> > linking command correct. Can you send me the output from the R CMD
> > INSTALL so that I can look at the link step. Thanks.
> > 
> >   D.
> > 
> > 
> > 
> > loren mccarter wrote:
> > > I'm trying to install RSPython for use with R-1.3.1 on FreeBSD 4.4. The R
> > > INSTALL process appears to go smoothly, but when I call RSPython in R
> > > "library(RSPython)" I get the following: 
> > > 
> > >   Error in dyn.load(x, as.logical(local), as.logical(now)) : 
> > >   	unable to load shared library
> > >   "/usr/local/lib/R/library/RSPython/libs/RSPython.so":
> > >     /usr/local/lib/R/library/RSPython/libs/RSPython.so: Undefined symbol
> > >   "pthread_create"
> > >   Error in library(RSPython) : .First.lib failed
> > > 
> > > I've peeked into RSPython.so using 'nm -g' and 'objdump -xtT' (ldd for
> > > elf files on FreeBSD) and the pthread symbols are undefined. In the
> > > FreeBSD man pages (see excerpts below), there's some detail about pthread
> > > that led me to try using '-pthread' rather than -lpthread as an option to
> > > gcc. I also tried configure --without-threads but none of these seemed to
> > > fix the problem. Note that there's also an warning from gcc during
> > > compilation process that may be relevant because it's about POSIX THEADS: 
> > > 
> > > $ gcc -I/usr/local/lib/R/include -I../inst/include
> > >   -I/usr/local/include/python2.1 -D_R_=1 -DUSE_R=1 -I/usr/local/include
> > >   -mieee-fp  -fPIC  -g -O2 -c PythonReferences.c -o PythonReferences.o
> > > In file included from /usr/include/unistd.h:42,
> > >                  from PythonReferences.c:7:
> > > /usr/include/sys/unistd.h:71: warning: `_POSIX_THREADS' redefined
> > > 
> > > 
> > > Thanks for any help you can provide!
> > > 
> > > Loren
> > > 
> > > 
> > > MAN PAGE ENTRIES BELOW: 
> > > 
> > > >From 'man pthread':
> > > 
> > > INSTALLATION
> > > 
> > >   The current FreeBSD POSIX thread implementation is built in the library
> > >   libc_r which contains both thread-safe libc functions and the thread
> > >   functions.  This library replaces libc for threaded applications.
> > > 
> > >   By default, libc_r is built as part of a 'make world'.  To disable the
> > >   build of libc_r you must supply the '-DNOLIBC_R' option to make(1).
> > > 
> > >   A FreeBSD specific option has been added to gcc to make linking threaded
> > >   processes simple.  gcc -pthread links a threaded process against libc_r
> > >   instead of libc.
> > > 
> > > >From 'man gcc':
> > > 
> > >     -pthread
> > >               Link a user-threaded process against libc_r instead
> > >               of libc. Objects linked into user-threaded process-
> > >               es should be compiled with -D_THREAD_SAFE.
> > > 
> > > 
> > > _______________________________________________
> > > Omega-help maillist  -  Omega-help at www.omegahat.org
> > > http://www.omegahat.org/mailman/listinfo/omega-help
> > 
> > -- 
> > _______________________________________________________________
> > 
> > Duncan Temple Lang                duncan at research.bell-labs.com
> > Bell Labs, Lucent Technologies    office: (908)582-3217
> > 700 Mountain Avenue, Room 2C-259  fax:    (908)582-3340
> > Murray Hill, NJ  07974-2070       
> >          http://cm.bell-labs.com/stat/duncan
> > _______________________________________________
> > Omega-help maillist  -  Omega-help at www.omegahat.org
> > http://www.omegahat.org/mailman/listinfo/omega-help
> 

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list