From jpnolan at american.edu  Sun Jun 24 03:54:38 2012
From: jpnolan at american.edu (John Nolan)
Date: Sat, 23 Jun 2012 21:54:38 -0400
Subject: [Rd] Win 64 package build - ERROR: loading failed for 'x64'
Message-ID: <OFE74A4F41.07E6C42B-ON85257A27.000A7EA6-85257A27.000A7EBC@american.edu>

I have developed an R package that works under Win32, but when I attempt to build it on Win64,
I get     ERROR: loading failed for 'x64'

More precisely, I developed and tested the package under Win32 and it works. But when I move
to a 64 bit Windows 7 (Home Premium) system, and attempt to build both 32 bit and 64 bit packages, 
the 32 bit package seems to build, but the 64 bit build fails.
'rcmd build test' works fine, producing DLLs in both src-i386 and src-x64

But 'rcmd check test' and 'rcmd install test' both fail.  
When R attempts to load the 64 bit DLL.  A pop-up window says
   R for Windows terminal front-end has stopped working,
then I get the error message on the console
   ERROR: loading failed for 'x64'
   
Below is the Makevar.win file (it selects a library based on 32 vs 64 bit).
Also below is 00install.out and R.Version() output.

I'd appreciate any suggestions.

John
 ...........................................................................................................
 John P. Nolan
 Math/Stat Department
 227 Gray Hall,   American University
 4400 Massachusetts Avenue, NW
 Washington, DC 20016-8050

 jpnolan at american.edu      
 voice: 202.885.3140          web: academic2.american.edu/~jpnolan
 ...........................................................................................................

----------------- Makevar.win ------------------------------------------
ifeq "$(WIN)" "64"
PKG_LIBS=../../../win64/test_win64.a -lgfortran
else
PKG_LIBS=../../../win32/test_win32.a -lgfortran
endif

PKG_CPPFLAGS=-I/JohnsWork/test/src/

-------------  00install.out -----------------------------------------

* installing *source* package 'test' ...
** libs

*** arch - i386
gcc  -I"C:/PROGRA~1/R/R-215~1.0/include" -DNDEBUG -I/JohnsWork/test/src        -O3 -Wall  -std=gnu99 -mtune=core2 -c testR.c -o testR.o
gcc -shared -s -static-libgcc -o test.dll tmp.def testR.o ../../../win32/test_win32.lib -lgfortran -LC:/PROGRA~1/R/R-215~1.0/bin/i386 -lR
installing to C:/JohnsWork/test/make/R/test.Rcheck/test/libs/i386

*** arch - x64
gcc -m64 -I"C:/PROGRA~1/R/R-215~1.0/include" -DNDEBUG -I/JohnsWork/test/src   -I"d:/RCompile/CRANpkg/extralibs64/local/include"     -O2 -Wall  -std=gnu99 -mtune=core2 -c testR.c -o testR.o
gcc -m64 -shared -s -static-libgcc -o test.dll tmp.def testR.o ../../../win64/test_win64.lib -lgfortran -Ld:/RCompile/CRANpkg/extralibs64/local/lib/x64 -Ld:/RCompile/CRANpkg/extralibs64/local/lib -LC:/PROGRA~1/R/R-215~1.0/bin/x64 -lR
make: `symbols.rds' is up to date.
installing to C:/JohnsWork/test/make/R/test.Rcheck/test/libs/x64
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
ERROR: loading failed for 'x64'
* removing 'C:/JohnsWork/test/make/R/test.Rcheck/test'

-------------------------------------------------------------

> str(R.Version())
List of 14
 $ platform      : chr "x86_64-pc-mingw32"
 $ arch          : chr "x86_64"
 $ os            : chr "mingw32"
 $ system        : chr "x86_64, mingw32"
 $ status        : chr ""
 $ major         : chr "2"
 $ minor         : chr "15.0"
 $ year          : chr "2012"
 $ month         : chr "03"
 $ day           : chr "30"
 $ svn rev       : chr "58871"
 $ language      : chr "R"
 $ version.string: chr "R version 2.15.0 (2012-03-30)"
 $ nickname      : chr ""
 


[Rd] Win 64 package build - ERROR: loading failed for 'x64'
John Nolan