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

From: Mike Marchywka <>
Date: Thu, 17 Mar 2011 07:56:09 -0400

> Date: Wed, 16 Mar 2011 13:50:37 -0700
> From:
> To:
> 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).

> --
                                          mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Thu 17 Mar 2011 - 14:01:35 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 17 Mar 2011 - 14:10:23 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive