From kasperdanielhansen at gmail.com  Sun Jun 24 17:28:49 2012
From: kasperdanielhansen at gmail.com (Kasper Daniel Hansen)
Date: Sun, 24 Jun 2012 11:28:49 -0400
Subject: [Rd] Win 64 package build - ERROR: loading failed for 'x64'
In-Reply-To: <OFA547D7A8.4B00D6D5-ON85257A27.0041EF10-85257A27.0041EF13@american.edu>
References: <OFE74A4F41.07E6C42B-ON85257A27.000A7EA6-85257A27.000A7EBC@american.edu>
	<4FE6A7C9.2050701@stats.ox.ac.uk>
	<OFA547D7A8.4B00D6D5-ON85257A27.0041EF10-85257A27.0041EF13@american.edu>
Message-ID: <CAC2h7uuZz40eR3_PzJAaaYoPEniN19h2_yxh0OD0nMkkNppo-w@mail.gmail.com>

On Sun, Jun 24, 2012 at 8:00 AM, John Nolan <jpnolan at american.edu> wrote:
> I did use the name Makevars.win, sorry for mistyping the name in my message as Makevar.win.
>
> I changed the extension on the library names from *.lib to *.a in the output below precisely to avoid complaints from this list; sorry for the confusion caused by missing 2 occurrences.
>
> The 64 bit library works fine: I can compile, link, and run a stand-alone test program that uses the 64 bit library test_win64.a. ?Since that works fine, I suspect the problem is somewhere in the process where R builds and links the 64 bit DLL. ?It may be a configuration problem, but if so, I don't understand why it does not show up in the rcmd build stage?

It is entirely possible - I see it all the time on something I am
working on right now - to have something that compiles file and
doesn't load.  Also, depending on how you do the package building,
there may not be any compilation done at package build time, if you
are creating a source package.

Kasper


>
> 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
> ?...........................................................................................................
>
>
> -----r-devel-bounces at r-project.org wrote: -----
> To: r-devel at r-project.org
> From: Prof Brian Ripley
> Sent by: r-devel-bounces at r-project.org
> Date: 06/24/2012 01:38AM
> Subject: Re: [Rd] Win 64 package build - ERROR: loading failed for 'x64'
>
> 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.a -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.a -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
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Win 64 package build - ERROR: loading failed for 'x64'
Kasper Daniel Hansen