patch to fix build on win32

Issue #27 resolved
Former user created an issue

This patches fixes various issues when compiling RPy2 on Win32: Rinterface.h is not present R.dll is in RHOME/bin and not RHOME/lib DLL imports are not compile-time constants RIF_HAS_RSIGHAND and CSTACK_DEFNS shouldn't be defined

My setup: default R for Windows installation, Python 2.5, MinGW32

Comments (13)

  1. Laurent Gautier
    • changed status to new

    I have questions regarding the patch. Can you (the anonymous author) get in touch with me ?

  2. Laurent Gautier

    Windows support now depends on funding (or contributions, but I am not holding my breath).

    """ Since the 2.0.x series, there is no longer any binary for Microsoft Windows distributed. The version in the 2.0.x series was already stripped out of some of the functionalities the UNIX-like systems can enjoy. Patches to compile and binaries were contributed, but there was not much progress regarding features.

    Currently, the only blocking issue for having a Windows port is time / resources: a win32 port, and eventually a win64 port, will require sponsorship in order to happen. If you or your organization are interested, please do contact the rpy2 author. ""

  3. Laurent Gautier

    Copying the bits of informations on your blog here:

    1. Copied Rinterface.h from R source distro
    2. Hacked Rinterface.h to remove uintptr_t typedef
    3. Hacked na_values.c to remove dynamic allocations (compile time non-constants)
    4. Copied R dll's from "bin" to "lib" in R install


    1/ Known / reported requirements. This might be solved in recent builds of R for windows (by the way, I could not find where you document which version of R was used)

    2/ This should not be necessary. R is compiling on win32 (and now on win64). Looking closer at what is happening would seem much more reasonable.

    3/ Why would this be necessary ? This is certainly an indication that something is not right.

    4/ See comment in 3/. (I do not remember having to do that when I was building for the rpy2-2.0.x series).

  4. Tisham Dhar

    I used R 2.11.1. Just built successfully from mercurial so all seems to be well. Tested on Vista in 64 bit mode with 32 bit gcc/python. The above comments relate to an attempt to build rpy2-2.1.4 which is the latest stable release. Thanks for clarifying the issues I was having.

  5. Former user Account Deleted

    Could you do a post on how exactly you got Rpy2 built and installed on windows? Have been tearing my hair out for >2 days with no luck. Am trying with rpy2-2.2.1 on win7 32 bit, Python 2.7 and R 2.13.1. I moved the files across from \bin\i386 to \bin like WHATNICK mentions.

    I copied the missing Rinterface.h file into the R binary distro's INCLUDE folder. I did not do WHATNICK's steps 2 and 3 Laurent's comments.

    I then run:

    python build install

    …and it chokes at:

    … File “”, line 152, in finalize_options config += get_rconfig(r_home, about) File “”, line 312, in get_rconfig rc = RConfig.from_string(rconfig, allow_empty = allow_empty) File “”, line 272, in from_string + ‘\nin string\n’ + string) ValueError: Invalid substring

    in string

    I tried to run the command directly in a python shell, using:

    rexec = os.path.join(R_HOME, ‘bin’, ‘R’) cmd = ‘”‘ + rexec + ‘” CMD –cppflags’ rp = os.popen(cmd)

    …and the response for all –ldflags’, ‘–cppflags’, ‘LAPACK_LIBS’, ‘BLAS_LIBS’ (called on line 150 of are empty.

    I understand that the Windows build are on hold - i have access to windows machines and if you can help walk me through building this correctly, i can post the binaries here.


  6. Log in to comment