From ripley at stats.ox.ac.uk  Sun Jun 24 07:38:17 2012
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sun, 24 Jun 2012 06:38:17 +0100
Subject: [Rd] Win 64 package build - ERROR: loading failed for 'x64'
In-Reply-To: <OFE74A4F41.07E6C42B-ON85257A27.000A7EA6-85257A27.000A7EBC@american.edu>
References: <OFE74A4F41.07E6C42B-ON85257A27.000A7EA6-85257A27.000A7EBC@american.edu>
Message-ID: <4FE6A7C9.2050701@stats.ox.ac.uk>

On 24/06/2012 02:54, John Nolan wrote:
> 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.

1) Use Makevars.win, as documented, not Makevar.win.  And your output 
does not correspond to the file you showed ....

2) Use .a, not .lib (which is for MSVC).

3) I suspect your 64-bit library is broken.  That's not an R issue, not 
do we know anthing about it.

>
> 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 ""
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Win 64 package build - ERROR: loading failed for 'x64'
Prof Brian Ripley