igraph / rigraph

igraph R package
https://r.igraph.org
561 stars 204 forks source link

Installing igraph failed in R #508

Closed seedvestige closed 2 years ago

seedvestige commented 2 years ago

Describe the bug

after entering the command, this output show that

gcc -std=gnu11 -I"/work/zhengjieou/R/lib64/R/include" -DNDEBUG -DUSING_R -I. -Iinclude -Ics -Iplfit -ISuiteSparse_config -I/usr/include/libxml2 -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.2.11\" -DINTERNAL_ARPACK -DPRPACK_IGRAPH_SUPPORT -DIGRAPH_THREAD_LOCAL=/**/ -I/work/zhengjieou/setupl/pcre-8.45/include -fpic -g -O2 -c zeroin.c -o zeroin.o 77 -fpic -g -O2 -c dgetv0.f -o dgetv0.o make: 77: Command not found make: *** [dgetv0.o] Error 127 ERROR: compilation failed for package ‘igraph’

To reproduce

just use command in R to install this package 'install.packages('igraph')'

Version information igraph version: the common version when installing R version :4.1.2 platform: centos 7 gcc version:11.0

ntamas commented 2 years ago

Apparently your Fortran compiler is configured to 77, which is of course not valid. It should be f77 or something similar. This is not an igraph bug but an issue with your local environment. Check the contents of ~/.R/Makevars and your environment variables; in particular, if FC in your environment is set to 77, this may cause an issue similar to the above.

seedvestige commented 2 years ago

Apparently your Fortran compiler is configured to 77, which is of course not valid. It should be f77 or something similar. This is not an igraph bug but an issue with your local environment. Check the contents of ~/.R/Makevars and your environment variables; in particular, if FC in your environment is set to 77, this may cause an issue similar to the above.

I modified the ~/.R/Makevars before to install other packages . The content is below :

CXX17FLAGS=-O3 -march=native -mtune=native -fPIC CXX17=g++

F77 = /usr/bin/gfortran FC = $F77 FLIBS = -L/usr/bin/gfortran

Should I delete all of them ?

Thank you so much in advance!

ntamas commented 2 years ago

$F77 in make resolves to $F (i.e. the value of the variable named F), followed by 77 as a literal string. This is why you are getting 77 as the Fortran compiler. Use $(F77) instead, or just remove the indirection and use FC = /usr/bin/gfortran.

seedvestige commented 2 years ago

$F77 in make resolves to $F (i.e. the value of the variable named F), followed by 77 as a literal string. This is why you are getting 77 as the Fortran compiler. Use $(F77) instead, or just remove the indirection and use FC = /usr/bin/gfortran.

Thank you ! I have solved this problem by using '$(F77)' instead. Before doing this ,I tried to use 'FC=/usr/bin/gfortran', but another bug occurred. Anyway, I installed successfully. Thanks so much again.