Error loading igraph in R on CentOS Linux

When I try to load igraph 1.2.6 in R on a cluster (CentOS Linux), I receive the following error:

Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/itpetersen/Documents/Projects/Bayesian_IRT/packrat/lib/x86_64-pc-linux-gnu/4.0.2/igraph/libs/igraph.so':
  libglpk.so.36: cannot open shared object file: No such file or directory
Execution halted

The odd thing is that glpk 4 is present via environment module dependency and thus libglpk.so.40 is provided on the cluster. No symlinks crossing from other versions are provided on the cluster, and the tech support staff verified libglpk.so itself does not provide symbols to suggest compatibility with other versions. I see the installation’s igraph.so shows the path to the headers provided by the environment module, but lists libglpk.so.36 instead of libglpk.so.40. Tech support staff thought this might reflect a bug (or unwarranted assumption) somewhere in the build.

Here is my session info in R:

R version 4.0.2 (2020-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS/LAPACK: /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/intel-mkl-2020.2.254-tdhfzki/compilers_and_libraries_2020.2.254/linux/mkl/lib/intel64_lin/libmkl_gf_lp64.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.0.2 tools_4.0.2    packrat_0.5.0

I’m a new user to igraph, so your help is greatly appreciated. Thanks!

In case it’s helpful, here’s more information from our tech support staff on this issue:

What was happening is that there is an older version of the glpk library installed on the login nodes that is in place for the octave package. When you were building your R packages, the build system picked up the system library at link time. If you had the glpk environment module loaded, the build system should have picked up the newer glpk. Not doing so indicates an issue with the build system for igraph.

Also here’s information on my configuration:

$ R CMD config --all
CC = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/gcc
CFLAGS = -g -O2
CPICFLAGS = -fpic
CPPFLAGS = -I/usr/local/include
CXX = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++ -std=gnu++11
CXXFLAGS = -g -O2
CXXPICFLAGS = -fpic
CXX11 = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++
CXX11STD = -std=gnu++11
CXX11FLAGS = -g -O2
CXX11PICFLAGS = -fpic
CXX14 = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++
CXX14STD = -std=gnu++14
CXX14FLAGS = -g -O2
CXX14PICFLAGS = -fpic
CXX17 = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++
CXX17STD = -std=gnu++17
CXX17FLAGS = -g -O2
CXX17PICFLAGS = -fpic
CXX20 = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++
CXX20STD = -std=gnu++2a
CXX20FLAGS = -g -O2
CXX20PICFLAGS = -fpic
DYLIB_EXT = .so
DYLIB_LD = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/gcc
DYLIB_LDFLAGS = -shared -fopenmp
FC = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/gfortran
FFLAGS = -g -O2
FPICFLAGS = -fpic
FLIBS = -lgfortran -lm -lquadmath
FCFLAGS = -g -O2
SAFE_FFLAGS = -g -O2 -msse2 -mfpmath=sse
OBJC =
OBJCFLAGS =
JAVA = /opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/openjdk-11.0.2-3psihzi/bin/java
JAVAC = /opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/openjdk-11.0.2-3psihzi/bin/javac
JAVAH = /usr/bin/javah
JAR = /opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/openjdk-11.0.2-3psihzi/bin/jar
JAVA_HOME = /opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/openjdk-11.0.2-3psihzi
JAVA_LIBS = -L/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/openjdk-11.0.2-3psihzi/lib/server -ljvm
JAVA_CPPFLAGS = -I/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/openjdk-11.0.2-3psihzi/include -I/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/openjdk-11.0.2-3psihzi/include/linux
LDFLAGS = -L/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/r-4.0.2-r5no5a2/rlib/R/lib -Wl,-rpath,/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/r-4.0.2-r5no5a2/rlib/R/lib
SHLIB_CFLAGS =
SHLIB_CXXFLAGS =
SHLIB_CXXLD = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++ -std=gnu++11
SHLIB_CXXLDFLAGS = -shared
SHLIB_CXX11LD = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++ -std=gnu++11
SHLIB_CXX11LDFLAGS = -shared
SHLIB_CXX14LD = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++ -std=gnu++14
SHLIB_CXX14LDFLAGS = -shared
SHLIB_CXX17LD = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++ -std=gnu++17
SHLIB_CXX17LDFLAGS = -shared
SHLIB_CXX20LD = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++ -std=gnu++2a
SHLIB_CXX20LDFLAGS = -shared
SHLIB_EXT = .so
SHLIB_FFLAGS =
SHLIB_LD = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/gcc
SHLIB_LDFLAGS = -shared
TCLTK_CPPFLAGS = -I/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/tcl-8.6.10-ivemd3z/include -I/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/tk-8.6.8-ckcsqbi/include -I/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/libx11-1.6.7-wpdlqp5/include
TCLTK_LIBS = -L/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/tcl-8.6.10-ivemd3z/lib -ltcl8.6 -L/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/tk-8.6.8-ckcsqbi/lib -ltk8.6 -L/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/libx11-1.6.7-wpdlqp5/lib -lX11 -lXss -lXext
BLAS_LIBS = -L/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/r-4.0.2-r5no5a2/rlib/R/lib -lRblas
LAPACK_LIBS = -L/opt/ssoft/apps/2020.2/linux-centos7-broadwell/gcc-8.4.0/r-4.0.2-r5no5a2/rlib/R/lib -lRlapack
MAKE = make
LIBnn = lib64
AR = ar
RANLIB = ranlib
## The following variables are deprecated
CPP = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/gcc -E
CXXCPP = /opt/ssoft/apps/2020.2/linux-centos7-x86_64/gcc-4.8.5/gcc-8.4.0-247uqcb/bin/g++ -std=gnu++11 -E

Any help would be greatly appreciated. Thanks!

I don’t have much experience with igraph’s R interface (so be prepared for some basic questions from me), but let’s try and see if we can get a solution … What I do have experience with is building the C core on various platforms.

First, are you trying to build igraph from source? Why don’t you use the binaries from CRAN?