Skip to content
Prev 9283 / 15075 Next

error: unrecognized option ‘-arch’ -- suggestion!

On 27 sep 2012, at 14:27, Simon Urbanek <simon.urbanek at r-project.org> wrote:

            
I know little about how this is set up, is it not possible to change some kind of template to change the way this is done? Some base variables that are generated from the flags, these variables are then used in the rest of the Makeconf along the lines I suggested?
As I understand it, if I use R CMD INSTALL I'm stuck with what is defined in the Makeconf files. If I use any other compiler other than Apple's clang as my "default" compiler, I get errors when I run R CMD INSTALL ?? that is, if I from R try to install any package that requires compilation. I think it would be better to determine the value of the variables when R CMD INSTALL is run, rather than when R is installed (or even compiled?).

I'm sure it could be implemented better, but something like:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GCCPATH = 

# If we are using the Apple compiler [that supports the -arch option], this is the argument to that option.
ARCH = x86_64

# Get information on the gcc to be used.
ISAPPLESTRING := $(shell "$(GCCPATH)gcc --version")
ISAPPLEKEY := Apple

# This will either be nothing or '-arch $(ARCH)'
MYARCH := $(if $(findstring $(ISAPPLEKEY),$(ISAPPLESTRING)),"-arch $(ARCH)")

MYGCC = $(GCCPATH)gcc $(MYARCH)
MYGPP = $(GCCPATH)g++ $(MYARCH)
MYFORTRAN = $(GCCPATH)gfortran $(MYARCH)

## etc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


All the best,
/Peder