[Rcpp-devel] Rcpp on R 2.12.0 / windows / gcc 4.5

Romain Francois romain at r-enthusiasts.com
Mon Oct 4 08:16:48 CEST 2010


Le 01/10/10 20:52, Uwe Ligges a écrit :
>
>
> On 30.09.2010 21:46, Romain Francois wrote:
>> If I replace unit tests with this simple one:
>>
>>
>> test.dummy2 <- function(){
>> fx <- cxxfunction( , 'return R_NilValue ; ', plugin = "Rcpp", verbose =
>> TRUE )
>> fx()
>> }
>>
>> I get this problem:
>>
>> Executing test function test.dummy2 ... >> setting environment variables:
>> PKG_LIBS =
>> C:/Users/romain/svn/rcpp/pkg/Rcpp.Rcheck/Rcpp/lib/x64/libRcpp.a
>>
>> >> LinkingTo : Rcpp
>> CLINK_CPPFLAGS =
>> -I"C:/Users/romain/svn/rcpp/pkg/Rcpp.Rcheck/Rcpp/include"
>>
>> >> Program source :
>>
>> 1 : // includes from the plugin
>> 2 :
>> 3 : #include <Rcpp.h>
>> 4 :
>> 5 :
>> 6 : #ifndef BEGIN_RCPP
>> 7 : #define BEGIN_RCPP
>> 8 : #endif
>> 9 :
>> 10 : #ifndef END_RCPP
>> 11 : #define END_RCPP
>> 12 : #endif
>> 13 :
>> 14 : using namespace Rcpp;
>> 15 :
>> 16 :
>> 17 : // user includes
>> 18 :
>> 19 :
>> 20 : // declaration
>> 21 : extern "C" {
>> 22 : SEXP file652d570b( ) ;
>> 23 : }
>> 24 :
>> 25 : // definition
>> 26 :
>> 27 : SEXP file652d570b( ){
>> 28 : BEGIN_RCPP
>> 29 : return R_NilValue ;
>> 30 : END_RCPP
>> 31 : }
>> 32 :
>> 33 :
>> Compilation argument:
>> c:\R\R-212~1.0AL/bin/x64/R CMD SHLIB file652d570b.cpp 2>
>> file652d570b.cpp.err.txt
>> g++ -I"c:/R/R-212~1.0AL/include"
>> -I"C:/Users/romain/svn/rcpp/pkg/Rcpp.Rcheck/Rcpp/include" -O2 -Wall -c
>> file652d570b.cpp -o file652d570b.o
>> g++ -shared -s -static-libgcc -o file652d570b.dll tmp.def file652d570b.o
>> C:/Users/romain/svn/rcpp/pkg/Rcpp.Rcheck/Rcpp/lib/x64/libRcpp.a
>> -Lc:/R/R-212~1.0AL/bin/i386 -lR
>> Timing stopped at: 0 0.02 2.41
>> Error in inDL(x, as.logical(local), as.logical(now), ...) :
>> unable to load shared object
>> 'C:/Users/romain/AppData/Local/Temp/Rtmp5Bzbzb/file652d570b.dll':
>> LoadLibrary failure: %1 n’est pas une application Win32 valide.
>
>
> No surprise:
>
> You mixed 64-bit R (called from bin/x64) with 32-bit gcc (gcc without
> prefix)...
> I guess you used the wrong path to the R executable and got the wrong one?
>
> Uwe

Not my fault. All we do is to call R CMD SHLIB (in inline:::compileCode).

     cmd <- paste(R.home(component = "bin"), "/R CMD SHLIB ",
         basename(libCFile), " 2> ", errfile, sep = "")



Here is something. If I have this function as my unit tests:

test.dummy <- function( ){
	print( commandArgs( ) )
	print( .Platform )
	print( Sys.getenv() )
}

I get the attached result, especially:


Sys.getenv( "R_ARCH" )

     R_ARCH
    "/i386"


seems to disagree with .Platform:

$r_arch
[1] "x64"


What should we do ?
- Should we call R CMD SHLIB differently ?
- Since this is now all R code, maybe we don't have to launch another 
process and we can invoke some R function (tools:::.SHLIB ?) ?
- Can/should we be defensive and set the R_ARCH environment variable 
based on $r_arch before calling SHLIB
- Is this a bug in R ?

Romain


>> If I run this from R --arch 64 it works fine:
>>
>>
>>
>>
>> $ R --arch 64
>>
>> R version 2.12.0 alpha (2010-09-29 r53067)
>> Copyright (C) 2010 The R Foundation for Statistical Computing
>> ISBN 3-900051-07-0
>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>
>> R est un logiciel libre livré sans AUCUNE GARANTIE.
>> Vous pouvez le redistribuer sous certaines conditions.
>> Tapez 'license()' ou 'licence()' pour plus de détails.
>>
>> R est un projet collaboratif avec de nombreux contributeurs.
>> Tapez 'contributors()' pour plus d'information et
>> 'citation()' pour la façon de le citer dans les publications.
>>
>> Tapez 'demo()' pour des démonstrations, 'help()' pour l'aide
>> en ligne ou 'help.start()' pour obtenir l'aide au format HTML.
>> Tapez 'q()' pour quitter R.
>>
>> > fx <- cxxfunction( , 'return R_NilValue ; ', plugin = "Rcpp", verbose
>> = TRUE$
>> Erreur : impossible de trouver la fonction "cxxfunction"
>> > fx()
>> Erreur : impossible de trouver la fonction "fx"
>> > require( Rcpp )
>> Le chargement a nécessité le package : Rcpp
>> > require( inline )
>> Le chargement a nécessité le package : inline
>> >
>> > fx <- cxxfunction( , 'return R_NilValue ; ', plugin = "Rcpp", verbose
>> = TRUE$
>> >> setting environment variables:
>> PKG_LIBS = c:/R/R-2.12.0alpha/library/Rcpp/lib/x64/libRcpp.a
>>
>> >> LinkingTo : Rcpp
>> CLINK_CPPFLAGS = -I"c:/R/R-2.12.0alpha/library/Rcpp/include"
>>
>> >> Program source :
>>
>> 1 : // includes from the plugin
>> 2 :
>> 3 : #include <Rcpp.h>
>> 4 :
>> 5 :
>> 6 : #ifndef BEGIN_RCPP
>> 7 : #define BEGIN_RCPP
>> 8 : #endif
>> 9 :
>> 10 : #ifndef END_RCPP
>> 11 : #define END_RCPP
>> 12 : #endif
>> 13 :
>> 14 : using namespace Rcpp;
>> 15 :
>> 16 :
>> 17 : // user includes
>> 18 :
>> 19 :
>> 20 : // declaration
>> 21 : extern "C" {
>> 22 : SEXP file14357889( ) ;
>> 23 : }
>> 24 :
>> 25 : // definition
>> 26 :
>> 27 : SEXP file14357889( ){
>> 28 : BEGIN_RCPP
>> 29 : return R_NilValue ;
>> 30 : END_RCPP
>> 31 : }
>> 32 :
>> 33 :
>> Compilation argument:
>> c:\R\R-2.12.0alpha/bin/x64/R CMD SHLIB file14357889.cpp 2>
>> file14357889.cpp.err.txt
>> x86_64-w64-mingw32-g++ -I"c:/R/R-212~1.0AL/include"
>> -I"c:/R/R-2.12.0alpha/library/Rcpp/include" -O2 -Wall -c fil
>> e14357889.cpp -o file14357889.o
>> x86_64-w64-mingw32-g++ -shared -s -static-libgcc -o file14357889.dll
>> tmp.def file14357889.o c:/R/R-2.12.0alpha/library/R
>> cpp/lib/x64/libRcpp.a -Lc:/R/R-212~1.0AL/bin/x64 -lR
>>
>>
>>
>>
>> Not sure what my next move is.
>>
>> Romain
>>
>>
>> Le 30/09/10 21:21, Romain Francois a écrit :
>>> I tried now with the newer R alpha (rev 53067) and I'm afraid I still
>>> get the same errors.
>>>
>>>
>>> When however I run the tests manually, everything goes fine:
>>>
>>>
>>> $ R --arch 64
>>> > require( Rcpp )
>>> > require( inline )
>>> > require( RUnit )
>>> # for example
>>> > runTestFile( "Rcpp/inst/unitTests/runit.sugar.R" )
>>>
>>>
>>> Executing test function test.sugar.abs ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.equal ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.greater ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.greater.or.equal ... done
>>> successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.less ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.less.or.equal ... done
>>> successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.not.equal ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.one.equal ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.one.greater ... done
>>> successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.one.greater.or.equal ... done
>>> successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.one.less ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.one.less.or.equal ... done
>>> successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.all.one.not.equal ... done
>>> successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.any.equal ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.any.equal.not ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.any.greater ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.any.greater.or.equal ... done
>>> successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.any.isna ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.any.less ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.any.less.or.equal ... done
>>> successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.any.not.equal ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.assignment ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.beta ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.ceil ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.choose ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.complex ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.constructor ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.diag ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.diff ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.divides ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.exp ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.floor ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.gamma ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.head ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.ifelse ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.isna ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.isna.isna ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.lapply ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.lbeta ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.lchoose ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.log1p ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.matrix.outer ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.matrix.row ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.minus ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.plus ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.plus.all ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.plus.seqlen ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.pmax ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.pmax.one ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.pmin ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.pmin.one ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.pow ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.psigamma ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.Range ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.rep ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.rev ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.sapply ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.sapply.list ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.sapply.rawfun ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.sapply.square ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.seqlaong ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.seqlen ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.sign ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.tail ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.times ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.unary.minus ... done successfully.
>>>
>>>
>>>
>>> Executing test function test.sugar.wrap ... done successfully.
>>>
>>> Number of test functions: 67
>>> Number of errors: 0
>>> Number of failures: 0
>>>
>>> > .Platform
>>> $OS.type
>>> [1] "windows"
>>>
>>> $file.sep
>>> [1] "/"
>>>
>>> $dynlib.ext
>>> [1] ".dll"
>>>
>>> $GUI
>>> [1] "RTerm"
>>>
>>> $endian
>>> [1] "little"
>>>
>>> $pkgType
>>> [1] "win.binary"
>>>
>>> $path.sep
>>> [1] ";"
>>>
>>> $r_arch
>>> [1] "x64"
>>>
>>>
>>> Romain
>>>
>>> Le 30/09/10 15:04, Uwe Ligges a écrit :
>>>>
>>>>
>>>> On 30.09.2010 14:17, Romain Francois wrote:
>>>>> Hmm. This failed on win builder.
>>>>>
>>>>>> Dear package maintainer,
>>>>>>
>>>>>> this notification has been generated automatically.
>>>>>> Your package Rcpp_0.8.6.3.tar.gz has been built (if working) and
>>>>>> checked for Windows.
>>>>>> Please check the log files and (if working) the binary package at:
>>>>>> http://win-builder.r-project.org/7zee4m5kHIjB
>>>>>> The files will be removed after roughly 72 hours.
>>>>>> Installation time in seconds: 87
>>>>>> Check time in seconds: 2385
>>>>>> Check result: ERROR
>>>>>> R version 2.12.0 alpha (2010-09-27 r53048) (32+64-bit)
>>>>>
>>>>> I initially tested it with
>>>>>
>>>>> $ Rscript --arch 64 -e "Rcpp:::test()"
>>>>>
>>>>> which worked fine.
>>>>
>>>> Brian just said he fixed it. Can you try with the very recent svn from
>>>> minutes (or few hours) ago?
>>>>
>>>> Best,
>>>> Uwe
>>>>
>>>>
>>>>> R CMD check gives me the same failures as win builder... more work
>>>>> required then :-(
>>>>>
>>>>>
>>>>> Le 30/09/10 13:45, Romain Francois a écrit :
>>>>>> Hello,
>>>>>>
>>>>>> I spent some of my time this morning tweaking Rcpp so that it builds
>>>>>> and
>>>>>> checks on the R 2.12.0 alpha (the latest snapshot) on windows with
>>>>>> the
>>>>>> latest Rtools on both archs.
>>>>>>
>>>>>> It appears to work fine at the latest svn revision (rev 2259).
>>>>>>
>>>>>> I've sent it to the R-devel branch of win builder and posted a
>>>>>> tarball
>>>>>> here: http://addictedtor.free.fr/misc/rcpp/Rcpp_0.8.6.3.tar.gz
>>>>>> I'd appreciate if other people would also try it, I'm always a bit
>>>>>> insecure when it comes to windows.
>>>>>>
>>>>>> Our aim is to synchronize release of Rcpp 0.8.7 with the release of R
>>>>>> 2.12.0
>>>>>>
>>>>>>
>>>>>> Issues were:
>>>>>> - the hello function in the module that is part of the testRcppmodule
>>>>>> package:
>>>>>>
>>>>>> std::string hello() {
>>>>>> throw std::range_error( "boom" ) ;
>>>>>> }
>>>>>>
>>>>>> This makes windows (or gcc 4.5, or something else) unhappy. This is
>>>>>> probably an issue with throw declarations, exceptions accross
>>>>>> translation unites, etc ... as we have seen before. For now, I
>>>>>> commented
>>>>>> it out. This is low priority.
>>>>>>
>>>>>> - fast indexing, i.e. as provided by the Rcpp::Fast class makes
>>>>>> windows
>>>>>> unhappy, so I am only using Fast on other platforms. See the #ifndef
>>>>>> WIN32 in the Extractor.h file. This seems like a good enough
>>>>>> workaround
>>>>>> for now. People who want faster indexing on windows are welcome to
>>>>>> submit a (((tested))) patch. Note that this is possible that the
>>>>>> newer
>>>>>> compiler produces better code, so the need for the Rcpp::Fast trick
>>>>>> might not be needed at all.
>>>>>>
>>>>>> Romain
>>>
>>>
>>
>>
>


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/cCmbgg : Rcpp 0.8.6
|- http://bit.ly/bzoWrs : Rcpp svn revision 2000
`- http://bit.ly/b8VNE2 : Rcpp at LondonR, oct 5th

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: doRUnit.Rout
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20101004/96022f9b/attachment.txt>


More information about the Rcpp-devel mailing list