[R] How to make sure R's g++ compiler uses certain C++ flags when making a package

Mike Marchywka marchywka at hotmail.com
Thu Mar 17 12:56:09 CET 2011




----------------------------------------
> Date: Wed, 16 Mar 2011 13:50:37 -0700
> From: solomon.messing at gmail.com
> To: r-help at r-project.org
> Subject: Re: [R] How to make sure R's g++ compiler uses certain C++ flags when making a package
>
> Looks like the problem may be that R is automatically passing this flag to
> the g++ compiler: "-arch x86_64" which appears to be causing trouble for
> opencv. Does anyone know how to suppress this flag?

Are you builing a 32 or 64 bit app? I haven't looked but offhand that may be
what this flag is for ( you can man g++ and check I suppose ) 

I was going to reply after doing some checking as I have never actually made
a complete R package but I did make a test one and verified I could call
the c++ code from R. I seem to remember that it was easy to just invoke g++
explicitly and R would use whatever binaries you happen to have left there.
That is, if you just compile the code for your R modules yourself there
is no real reason to worry about how R does it. Mixing some flags will
prevent linking or, worse, create mysterious run time errors.

Also, IIRC, your parameters were the output of foreign scripts ( opencv apparently)
and not too helpful here ( and in any case you should echo these to see what they
are if they are an issue). 




>
> --

 		 	   		  


More information about the R-help mailing list