I am trying to build a dll writen in C to be called by R. Interestingly, when I set the global environment variable PATH to be "c:\Rtools\bin;C:\Rtools\gcc-4.6.3;C:\Program Files\R\R-3.1.1\bin\*i386*;" and I typed "RCMD SHLIB Permutation.c" in Cygwin, the dll was compiled and I can sucessfully call functions after I had loaded it into 32 bits R via .Call. However, now I want to run the same function in 64 bits R. I changed the global environment variable PATH to be "c:\Rtools\bin;C:\Rtools\gcc-4.6.3;C:\Program Files\R\R-3.1.1\bin\*x64*;", opened Cygwin again and typed "RCMD SHLIB Permutation.c" in Cygwin. Error message appeared on Cywin console. $ RCMD SHLIB Permutation.c gcc -m64 -shared -s -static-libgcc -o Permutation.dll tmp.def Permutation.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.1/bin/x64 -lR C:/PROGRA~1/R/R-31~1.1/bin/x64/R.dll: file not recognized: My version of R is the latest 3.1.1 and my Rtools is also the latest version 31 I am not sure why this is happening and I have been struggled about this for two days.
RCMD SHLIB problem in 64 bits
2 messages · Qiao Kang, Duncan Murdoch
On 08/10/2014, 12:57 PM, Qiao Kang wrote:
I am trying to build a dll writen in C to be called by R. Interestingly, when I set the global environment variable PATH to be "c:\Rtools\bin;C:\Rtools\gcc-4.6.3;C:\Program Files\R\R-3.1.1\bin\*i386*;" and I typed "RCMD SHLIB Permutation.c" in Cygwin, the dll was compiled and I can sucessfully call functions after I had loaded it into 32 bits R via .Call. However, now I want to run the same function in 64 bits R. I changed the global environment variable PATH to be "c:\Rtools\bin;C:\Rtools\gcc-4.6.3;C:\Program Files\R\R-3.1.1\bin\*x64*;", opened Cygwin again and typed "RCMD SHLIB Permutation.c" in Cygwin. Error message appeared on Cywin console. $ RCMD SHLIB Permutation.c gcc -m64 -shared -s -static-libgcc -o Permutation.dll tmp.def Permutation.o -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-31~1.1/bin/x64 -lR C:/PROGRA~1/R/R-31~1.1/bin/x64/R.dll: file not recognized: My version of R is the latest 3.1.1 and my Rtools is also the latest version 31 I am not sure why this is happening and I have been struggled about this for two days.
This sounds related to a bug that is fixed in R-patched. Some of the build scripts use the bin/R or bin/Rscript executables; they are 32 bit only. Could you please download a recent R-patched, and confirm that the fix works for you? Thanks. Duncan Murdoch