Skip to content

How to install R-project 3.1.0 on FreeBSD 9.2 user’s home

In some machines I do not have ‘root’ access, therefore when I need a software and I don’t want to bother the sysadmin, I have to install it by myself into my home directory. Today, I needed to install the newest R-project’s version 3.1.0, and for some reason my FreeBSD machine could not find Fortran’s path.

In my home directory I have a special folder, named ‘TOOLS_SRC’ where I leave all source code for compilation. To install R on the user’s home I ran ./configure –prefix=/home/kaiorafael/rbinary , which gave me the following error.

checking for Fortran 77 libraries of fc... 
checking how to get verbose linking output from gcc -std=gnu99... -v
checking for C libraries of gcc -std=gnu99...  -L/usr/local/lib -L/usr/lib -lgcc_s
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... configure: error: in `/home/kaiorafael/TOOLS_SRC/R-3.1.0':
configure: error: cannot compile a simple Fortran program
See `config.log' for more details

Looking carefully at the log message, I found this line very interesting.

“loading site script ‘./config.site'”

This file ‘config.site’ has many options to customize R-project’s installation. Since FreeBSD uses ‘gfortran’, I just had to uncomment the ‘## F77=’ line and change it for

F77=gfortran

Running again ‘./configure –prefix=/home/kaiorafael/rbinary’, and than ‘make && make install’, everything is working like a charm now.

R version 3.1.0 (2014-04-10) -- "Spring Dance"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-unknown-freebsd9.2 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

I am not FreeBSD sysadmin nor FreeBSD heavy user. In case you are a FreeBSD expert, please let me know that there is a better way to solve this issue.

2 Comments

  1. mike mike

    Wow this blog post really saved me today. Thank you so much.

    The FreeBSD ports have R 3.0. But you can’t install dplyr in R 3.0 because dplyr depends on lazyeval which requires at least R 3.1. So I did what you did and tried to install R in my home directory but I got the same error. Only I was installing R 3.2 on FreeBSD 9.3.

    FreeBSD 9.x still uses gcc. So our fortran compiler will be a gfortran. On 9.3 it’s gfortran48. So using your fix and putting F77=gfortran48 in site.config did the trick. To fully compile R I also needed to install the ports: texlive, openjdk6, and tcl86.

    • Hi Mike, thank you for your feedback.

      The best thing on this procedure is that you can update your R`modules anytime using your userid or you can compile many times using different flags

Leave a Reply to kaiorafael Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.