# Install math/R with gcc47



## timeout (Sep 20, 2011)

Hi, 

I'm using FreeBSD 8.2 and would like to install math/R with the gcc47 compiler, which I already have installed. When I start the build, math/R pulls in gcc46 and instead of having another version of gcc floating around, I would like to try and build the port using one of the versions of gcc already installed (4.7).

I'm using gcc47 for most of the ports which I've configured in /etc/make.conf. But this is obviously overridden in the R-port's make file. Unfortunately, I can't see where and how this is done. How can I ask make to try and use gcc47 when building R?

Thanks.


----------



## timeout (Sep 21, 2011)

To compile using gcc47, you need to edit the following file: /usr/ports/Mk/bsd.gcc.mk

In the math/R Makefile 

```
USE_FORTRAN = yes
```

which is set in /usr/ports/Mk/bsd.gcc.mk such that:

```
72 .if defined (USE_FORTRAN)
 73 
 74 # The default case, with a current lang/gcc port.
 75 . if ${USE_FORTRAN} == yes
 [color="Red"][B]76 _USE_GCC:=  4.6[/B][/color]
 [color="Red"][B]77 FC:=    gfortran46
 78 F77:=   gfortran46[/B][/color]
```

Changing to the installed version (USE_GCC:= 4.7, gfortran47) is successful. 

Thanks to t_j on the irc channel for helping me with this!


----------

