1

I'm trying to install R package "igraph" in Linux server and stuck with some errors.

I've tried install.packages("igraph"), and got these error messages :

  1. Problem related with checking whether the C compiler works... no :

    * installing *source* package ‘igraph’ ...
    ** package ‘igraph’ successfully unpacked and MD5 sums checked
    checking for gcc... /usr/local/bin/gcc
    checking whether the C compiler works... no
    configure: error: in `/tmp/RtmpPaaksz/R.INSTALL8c157a39a973/igraph':
    configure: error: C compiler cannot create executables
    See `config.log' for more details
    ERROR: configuration failed for package ‘igraph’
    
  2. Problem related with lazyeval.c:53: error: ‘for’ loop initial declarations are only allowed in C99 mode :

    lazyeval.c: In function ‘make_lazy_dots’:
    lazyeval.c:53: error: ‘for’ loop initial declarations are only allowed in C99 mode
    lazyeval.c:53: note: use option -std=c99 or -std=gnu99 to compile your code
    lazyeval.c:63: error: redefinition of ‘nxt’
    lazyeval.c:53: note: previous definition of ‘nxt’ was here
    make: *** [lazyeval.o] Error 1
    ERROR: compilation failed for package ‘igraph’
    

My environment is

  • Linux
  • R 3.4.3

Would anyone give me a piece of precious advice?

I close this post due to consistency of my question, though I still can't install the package. Thanks everyone!

inmybrain
  • 386
  • 3
  • 16
  • Can you find the `config.log` and upload that? – SeGa May 24 '18 at 14:29
  • What OS are you running exactly? How did you install R? Have you run something like `apt-get build-essential`? That should include a compiler. – MrFlick May 24 '18 at 14:38
  • Possibly Relevant [os-x-10-9-2-checking-whether-the-c-compiler-works-no](https://stackoverflow.com/questions/22844522/os-x-10-9-2-checking-whether-the-c-compiler-works-no) – G5W May 24 '18 at 14:38
  • @SeGa Trying to find it, @MrFlick I added my information on the post. ``apt-get build-essential`` gives me this ``-bash: apt-get: command not found``. – inmybrain May 24 '18 at 14:48
  • Thanks, @G5W. I was struggling little bit, and tried to change my ~/.R/Makevars file, which solves ``checking whether the C compiler works``. However, new error I updated comes. – inmybrain May 24 '18 at 15:05

1 Answers1

2

I handled two problems by changing my ~/.R/Makevars file as

C=gcc-5
CXX=g++
CXX1X = g++-5
CFLAGS = -std=c99 -Wall -pedantic

First three lines are for the problem 1, and the last one for 2.

inmybrain
  • 386
  • 3
  • 16