[R-SIG-Mac] Compiling RMatlab on OS 10.6.4

Nicola Soranzo nsoranzo at tiscali.it
Fri Oct 1 12:22:27 CEST 2010

Hi Suresh and all,
during the last few years I have developed a big patch to make RMatlab work on 
the latest R and MATLAB versions, and to update it to the current R package 


I don't have a Mac, but I think my patch may help you anyway. If you have 
problems/comments/suggestions, please CC me (I'm not subscribed to this list).

Kind regards,
Nicola Soranzo, Ph.D.

Personal: http://nsoranzo.altervista.org

My PGP key: http://nsoranzo.altervista.org/key.asc

> Hello,
> I am trying to see if I can get RMatlab from Omegahat
> (http://www.omegahat.org/RMatlab/) working on OS 10.6.4 to be able to call
> R from Matlab.
> I am following the instructions at:
> http://www.stanford.edu/~dgleich/notebook/2009/09/rmatlab_using_r_from_matl
> ab.html
> I got to the point of running the ./configure script (see below) where the
> script complains that libR.so cannot be found. I searched my Mac for a
> libR.so file, but could not find it. I am using the latest OSX binary from
> CRAN, and I read in the R for Mac OS X FAQ that it is already compiled as
> a shared library.
> If there are likely to be non-trivial changes involved in trying to
> compile it for OSX, then probably doing it by myself is beyond my current
> ability, as is also probably already obvious.
> Seeking hints/guidance/advice...
> Very best and many thanks, Suresh
> ---------------------------------------------------------------------------
> ------------------ Suresh-iMac:RMatlab suresh$ ./configure
> checking for mex... /Applications/MATLAB_R2007B/bin/mex
> checking for sed... /usr/bin/sed
> There is no R shared library (libR.so), so you cannot run R within Matlab.
> You will only be able to start Matlab from within R
> If this is not what you want, reinstall R from source with the
> configuration option
>    ./configure --enable-R-shlib
>   If you have already compiled R as a shared library but this script has
> not been able
>   to find it, set the environment variable R_SHARED_LIB_DIR to the name of
> the directory
>   in which it is located and re-install this package
> Looking for mclmcr.h
> checking for gcc... gcc
> checking for C compiler default output... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables...
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether gcc accepts -g... yes
> checking for gcc option to accept ANSI C... none needed
> configure: creating ./config.status
> config.status: creating inst/scripts/RMatlab.csh
> config.status: creating inst/scripts/RMatlab.sh
> config.status: creating src/Makefile
> Using the following settings
>    Mex compiler:               /Applications/MATLAB_R2007B/bin/mex
>    Mex extension:              mexmaci
>    Mex linker flags:           -Wl,-flat_namespace -undefined suppress
> -bundle
>    R shared library directory:
>    Installation directory:
> *********************************************************
>    To set the environment variables to run R from within Matlab
>    or vice versa, source the relevant shell script into your shell
>    before running Matlab or R
>    Bourne or Bash shell:
>       . /scripts/RMatlab.sh
>    Csh or Tcsh shell:
>       source /scripts/RMatlab.csh
> *********************************************************
> Suresh-iMac:RMatlab suresh$

More information about the R-SIG-Mac mailing list