Build problems on Win32

Issue #98 resolved
Satya Mishra created an issue

I had to make some small changes to get rpy2 (hg latest) to install on my system: 1. The official R seems to be built with mingw32. So I had to change the compiler in setup.cfg 2. R.dll needs to be searchable via os.environ['PATH']. If not I get an error about LoadLibrary not finding the module.

{{{ diff -r 4bbc5146eb7f rpy/rinterface/init.py --- a/rpy/rinterface/init.py Sun Sep 02 15:13:12 2012 +0200 +++ b/rpy/rinterface/init.py Thu Sep 20 08:23:52 2012 -0700 @@ -67,6 +67,7 @@ R_DLL_DIRS = ('bin', 'lib') # Try dirs from R_DLL_DIRS for r_dir in R_DLL_DIRS: + os.environ['PATH'] += ';' + os.path.join(R_HOME, r_dir, _win_bindir) Rlib = os.path.join(R_HOME, r_dir, _win_bindir, 'R.dll') if not os.path.exists(Rlib): continue diff -r 4bbc5146eb7f setup.cfg --- a/setup.cfg Sun Sep 02 15:13:12 2012 +0200 +++ b/setup.cfg Thu Sep 20 08:23:52 2012 -0700 @@ -2,3 +2,5 @@ tag_build = dev tag_date = true

+[build_ext] +compiler=mingw32 }}}

Comments (4)

  1. Laurent Gautier

    Thanks. I have not tried the patch (nice if windows users could) but one comment: setting compiler=mingw32 in [build_ext] would make the build break on Linux and OS X, I think.

    The compiler should be specified on the command line:

    python setup.py build --compiler=mingw32
    
  2. Satya Mishra reporter

    Indeed, I did not think about the side-effect of breaking build for other OS. It should be set at the command-line or in setup.py in that case.

  3. Log in to comment