title: How to install Tidyverse on Ubuntu 16.04 and 17.04
body: <p>I'm running Ubuntu 16.04 [now 17.04: see note in bold below] and R 3.4.1. I installed the latter this morning, so I presume it's the latest version. I want to install Tidyverse, which I've spent many happy hours with under Windows. But when I do <code>install.packages("tidyverse")</code> , I get errors about unrecognized command line options to gcc. These start when the install hits the colorspace and munsell packages. I'll show an example at the end of this post, just for munsell.</p>
  
  <p>I've not found anyone else who had exactly that problem on Ubuntu 16.04. But posts from people with similar problems suggest that my gcc might be a version that's too old to recognise the options -fstack-protector-strong and -Wdate-time.</p>
  
  <p>Possible work-arounds that I've thought of:</p>
  
  <p>1) Update Ubuntu to 16.10 or 17.04 in the hope that one of these has a suitable gcc. However, I'm hitting my lack of Ubuntu expertise here: in particular, it appears that I have to upgrade twice, once to 16.10 and then again to 17.04. I can't even make the system upgrade to 16.10: the steps recommended at <a href="https://wiki.ubuntu.com/YakketyYak/ReleaseNotes" rel="noreferrer">https://wiki.ubuntu.com/YakketyYak/ReleaseNotes</a> , "Upgrading from Ubuntu 16.04 LTS", don't find upgrades when I try them. Also, I don't know for sure whether either of those Ubuntus would have the right gcc.</p>
  
  <p><strong>Added the following day:</strong> Although my attempts to upgrade Ubuntu by following <a href="https://wiki.ubuntu.com/YakketyYak/ReleaseNotes" rel="noreferrer">https://wiki.ubuntu.com/YakketyYak/ReleaseNotes</a> did nothing yesterday, they did work today. Maybe a caching problem? So I now have Ubuntu 17.04. However, I still get the same errors when trying to install Tidyverse.</p>
  
  <p>2) Find an older version of Tidyverse that doesn't need those compiler options.</p>
  
  <p>3) Upgrade my Ubuntu's gcc. But I don't know whether that would nuke other software on my machine that expects an older gcc.</p>
  
  <p>4) Install a new gcc just for Tidyverse, and somehow play with paths to fool the installer into calling it, perhaps by following the advice in <a href="https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu">https://askubuntu.com/questions/466651/how-do-i-use-the-latest-gcc-on-ubuntu</a> . But that sounds risky.</p>
  
  <p>5) Scrap Ubuntu and do all my work on Windows. I know people deride "Micro$oft", but at least with Windows, I don't waste a morning with Linux arcana and can do my job, which is R. This is feeling far too much like the priests with their incantations in <a href="https://people.dsv.su.se/~jpalme/s1/hoare.pdf" rel="noreferrer">https://people.dsv.su.se/~jpalme/s1/hoare.pdf</a> , "Software Design: a Parable". Just saying...</p>
  
  <p>Any suggestions from someone who has actually done this with these versions of R and Ubuntu?</p>
  
  <p>Here's an install that failed:</p>
  
  <pre>
  `> install.packages("munsell")
  Installing package into ‘/home/popx/R/x86_64-pc-linux-gnu-library/3.4’
  (as ‘lib’ is unspecified)
  also installing the dependency ‘colorspace’
  
  trying URL 'https://cran.rstudio.com/src/contrib/colorspace_1.3-2.tar.gz'
  Content type 'application/x-gzip' length 293433 bytes (286 KB)
  ==================================================
  downloaded 286 KB
  
  trying URL 'https://cran.rstudio.com/src/contrib/munsell_0.4.3.tar.gz'
  Content type 'application/x-gzip' length 97244 bytes (94 KB)
  ==================================================
  downloaded 94 KB
  
  * installing *source* package ‘colorspace’ ...
  ** package ‘colorspace’ successfully unpacked and MD5 sums checked
  ** libs
  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c colorspace.c -o colorspace.o
  gcc: error: unrecognized command line option '-fstack-protector-strong'
  gcc: error: unrecognized command line option '-Wdate-time'
  /usr/lib/R/etc/Makeconf:159: recipe for target 'colorspace.o' failed
  make: *** [colorspace.o] Error 1
  ERROR: compilation failed for package ‘colorspace’
  * removing ‘/home/popx/R/x86_64-pc-linux-gnu-library/3.4/colorspace’
  Warning in install.packages :
    installation of package ‘colorspace’ had non-zero exit status
  ERROR: dependency ‘colorspace’ is not available for package ‘munsell’
  * removing ‘/home/popx/R/x86_64-pc-linux-gnu-library/3.4/munsell’
  Warning in install.packages :
    installation of package ‘munsell’ had non-zero exit status
  
  The downloaded source packages are in
      ‘/tmp/RtmpQ8FW70/downloaded_packages’
  Warning message:
  R graphics engine version 12 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.
  </pre>