Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

igraph build issue on Ubuntu 16.04 #209

Closed
ebridge2 opened this issue Jul 20, 2017 · 38 comments
Closed

igraph build issue on Ubuntu 16.04 #209

ebridge2 opened this issue Jul 20, 2017 · 38 comments

Comments

@ebridge2
Copy link

ebridge2 commented Jul 20, 2017

Hi, I am experiencing the following error while trying to install igraph from CRAN in a docker container:

R -e "install.packages('igraph', repos='http://cran.rstudio.com/')"

...


In file included from src/foreign-gml-parser.y:59:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined
 #  define strdup igraph_i_strdup
 ^
In file included from /usr/include/string.h:630:0,
                 from src/foreign-gml-parser.y:54:
/usr/include/x86_64-linux-gnu/bits/string2.h:1291:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)
 ^
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -DUSING_R -I. -Iinclude -Ics -Iglpk -Iplfit -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.1.1\" -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL=/**/ -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c foreign-graphml.c -o foreign-graphml.o
foreign-graphml.c: In function 'igraph_write_graph_graphml':
foreign-graphml.c:1408:46: error: expected ')' before 'GRAPHML_NAMESPACE_URI'
   ret=fprintf(outstream, "<graphml xmlns=\"" GRAPHML_NAMESPACE_URI "\"\n");
                                              ^
foreign-graphml.c:1412:59: error: expected ')' before 'GRAPHML_NAMESPACE_URI'
   ret=fprintf(outstream, "         xsi:schemaLocation=\"" GRAPHML_NAMESPACE_URI "\n");
                                                           ^
foreign-graphml.c:1414:38: error: expected ')' before 'GRAPHML_NAMESPACE_URI'
   ret=fprintf(outstream, "         " GRAPHML_NAMESPACE_URI "/1.0/graphml.xsd\">\n");
                                      ^
/usr/lib/R/etc/Makeconf:159: recipe for target 'foreign-graphml.o' failed
make: *** [foreign-graphml.o] Error 1
ERROR: compilation failed for package 'igraph'
* removing '/usr/local/lib/R/site-library/igraph'

The downloaded source packages are in
	'/tmp/RtmpGOP7Ra/downloaded_packages'
Warning message:
In install.packages("igraph", repos = "http://cran.rstudio.com/") :
  installation of package 'igraph' had non-zero exit status

I had no issues the other day with this same docker file. R version is 3.4.1; OS is ubuntu 16.04. no issues when installing instead with:

apt-get install -y r-cran-igraph

any ideas where the issue could be?

@ebridge2 ebridge2 changed the title igraph build issue igraph build issue on Ubuntu 16.04 Jul 20, 2017
@wlandau
Copy link

wlandau commented Jul 20, 2017

Hmm... it installed just fine on my personal Ubuntu box (17.04)

$ gcc --version
gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
...
$ R -e "install.packages('igraph', repos='http://cran.rstudio.com/')"
...
* installing *source* packageigraph...
** packageigraphsuccessfully unpacked and MD5 sums checked
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether we are using the GNU Fortran compiler... yes
checking whether gfortran accepts -g... yes
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking for rintf... yes
checking for finite... yes
checking for expm1... yes
checking for rint... yes
checking for log2... yes
checking for logbl... yes
checking for snprintf... yes
checking for log1p... yes
checking for round... yes
checking for fmin... yes
checking for stpcpy... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking whether stpcpy is declared... yes
checking sys/times.h usability... yes
checking sys/times.h presence... yes
checking for sys/times.h... yes
checking net/if.h usability... yes
checking net/if.h presence... yes
checking for net/if.h... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking net/if_dl.h usability... no
checking net/if_dl.h presence... no
checking for net/if_dl.h... no
checking sys/sockio.h usability... no
checking sys/sockio.h presence... no
checking for sys/sockio.h... no
checking sys/un.h usability... yes
checking sys/un.h presence... yes
checking for sys/un.h... yes
checking sys/socket.h usability... yes
checking sys/socket.h presence... yes
checking for sys/socket.h... yes
checking sys/ioctl.h usability... yes
checking sys/ioctl.h presence... yes
checking for sys/ioctl.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/file.h usability... yes
checking sys/file.h presence... yes
checking for sys/file.h... yes
checking for struct sockaddr.sa_len... no
checking for xml2-config... /usr/bin/xml2-config
checking for xmlSAXUserParseFile in -lxml2... yes
checking libxml/parser.h usability... yes
checking libxml/parser.h presence... yes
checking for libxml/parser.h... yes
checking for __gmpz_add in -lgmp... yes
checking gmp.h usability... yes
checking gmp.h presence... yes
checking for gmp.h... yes
...
* DONE (igraph)
$ Rscript -e 'packageVersion("igraph")'
[1] ‘1.1.1

@wlandau
Copy link

wlandau commented Jul 20, 2017

Also, the build of appears to have completed just fine on R-hub builder for Ubuntu 16.04 and R-release. I submitted the CRAN source of igraph 1.1.1 for that.

@wlandau
Copy link

wlandau commented Jul 21, 2017

I spoke too soon. The installation completed just fine, but an example failed.

5265#> * checking examples ... ERROR
5266#> Running examples in ‘igraph-Ex.R’ failed
5267#> The error most likely occurred in:
5268#> > ### Name: plot_dendrogram
5269#> > ### Title: Community structure dendrogram plots
5270#> > ### Aliases: plot_dendrogram dendPlot plot_dendrogram.communities
5271#> > ### Keywords: graphs
5272#> > 
5273#> > ### ** Examples
5274#> > 
5275#> > 
5276#> > karate <- make_graph("Zachary")
5277#> > fc <- cluster_fast_greedy(karate)
5278#> > plot_dendrogram(fc)
5279#> Error in .reorder_ape(x, order, index.only, length(x$tip.label), io) : 
5280#> object 'neworder_phylo' not found
5281#> Calls: plot_dendrogram ... as_phylo.communities ->  -> .reorder_ape
5282#> Execution halted
5283#> * checking for unstated dependencies in ‘tests’ ... OK
5284#> * checking tests ...
5285#> Running ‘testthat.R’
5286#> OK
5287#> * checking PDF version of manual ... OK
5288#> * DONE
5289#> Status: 1 ERROR, 1 NOTE
5290#> See
5291#> ‘/home/docker/igraph.Rcheck/00check.log’
5292#> for details.

@gaborcsardi
Copy link
Contributor

@wlandau I think you don't have the ape package installed.

But surely, this is a different error than the one in the original post.

@gaborcsardi
Copy link
Contributor

@ebridge2 I cannot reproduce this, unfortunately. You would need to give me a (simple) reproducible example, e.g. a Dockerfile.

@wlandau
Copy link

wlandau commented Jul 21, 2017

@gaborcsardi Yes, it was a different error, and far less serious. And to be clear, when I mentioned the failed example, I was talking about the R-hub builder results, not anything on my local machine.

@jeffcav
Copy link

jeffcav commented Jul 31, 2017

Hi, I am experiencing the exact same problem on a Fedora 25.

Details:
platform x86_64-redhat-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 4.1
year 2017
month 06
day 30
svn rev 72865
language R
version.string R version 3.4.1 (2017-06-30)
nickname Single Candle

@jonashaag
Copy link

Here's a Dockerfile to reproduce

FROM ubuntu:16.10

RUN DEBIAN_FRONTEND=noninteractive apt-get update \
 && DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
      gcc make g++ gfortran r-cran-magrittr r-cran-matrix r-cran-nmf r-cran-irlba liblapack-dev libblas-dev \
 && echo 'install.packages(c("igraph"), repos="http://cran.uni-muenster.de")' | R --no-save

@cchng
Copy link

cchng commented Aug 4, 2017

I'm running into the exact error with the same versions of Ubuntu and R.

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.2 LTS

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
 [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8    
 [5] LC_MONETARY=en_CA.UTF-8    LC_MESSAGES=en_CA.UTF-8   
 [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_CA.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_3.4.1
...
In file included from src/foreign-gml-parser.y:59:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined
 #  define strdup igraph_i_strdup
 ^
In file included from /usr/include/string.h:630:0,
                 from src/foreign-gml-parser.y:54:
/usr/include/x86_64-linux-gnu/bits/string2.h:1291:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)
 ^
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -DUSING_R -I. -Iinclude -Ics -Iglpk -Iplfit -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.1.1\" -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL=/**/ -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c foreign-graphml.c -o foreign-graphml.o
foreign-graphml.c: In function ‘igraph_write_graph_graphml’:
foreign-graphml.c:1408:46: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "<graphml xmlns=\"" GRAPHML_NAMESPACE_URI "\"\n");
                                              ^
foreign-graphml.c:1412:59: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         xsi:schemaLocation=\"" GRAPHML_NAMESPACE_URI "\n");
                                                           ^
foreign-graphml.c:1414:38: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         " GRAPHML_NAMESPACE_URI "/1.0/graphml.xsd\">\n");
                                      ^
/usr/lib/R/etc/Makeconf:159: recipe for target 'foreign-graphml.o' failed
make: *** [foreign-graphml.o] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/home/carolynchng/R/x86_64-pc-linux-gnu-library/3.4/igraph’

The downloaded source packages are in
	‘/tmp/RtmpqwJ11Z/downloaded_packages’
Warning message:
In install.packages("igraph", repos = "http://cran.rstudio.com/") :
  installation of package ‘igraph’ had non-zero exit status

@gaborcsardi
Copy link
Contributor

This is a closed issue, because the problem of the OP was solved. If you have other problems, please open another issue.

@cchng
Copy link

cchng commented Aug 4, 2017

Thanks for the comment @gaborcsardi - I had posted too soon - managed to install successfully from source.

@ebridge2
Copy link
Author

ebridge2 commented Aug 4, 2017 via email

@ebridge2
Copy link
Author

ebridge2 commented Aug 4, 2017

@cchng @jonashaag @JeffRodrigo this might help you guys. Note you need devtools installed, but:

RUN R -e "require(devtools); install_version('igraph', version='1.0.1', repos='https://cran.rstudio.org/')"

@jonashaag
Copy link

@gaborcsardi This issue should be reopened, see last comment by @ebridge2

@gaborcsardi
Copy link
Contributor

It was solved by this: igraph/igraph#1020

@jeffcav
Copy link

jeffcav commented Aug 4, 2017

Maybe it hasn't yet been added to repositories. This answer in Stack Overflow discusses how to install igraph straight from github.

@wlandau
Copy link

wlandau commented Nov 2, 2017

@JeffRodrigo which repositories do you think need to be updated? I just tried this Dockerfile

FROM r-base
RUN Rscript -e 'install.packages("igraph")'

and I get one of the most common igraph compilation errors. I am a bit surprised that the problem has persisted for this long.

gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -DUSING_R -I. -Iinclude -Ics -Iglpk -Iplfit -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -g -O2 -fdebug-prefix-map=/build/r-base-3.4.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.1.1\" -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL=/**/ -fpic  -g -O2 -fdebug-prefix-map=/build/r-base-3.4.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c foreign-graphml.c -o foreign-graphml.o
foreign-graphml.c: In function ‘igraph_write_graph_graphml’:
foreign-graphml.c:1408:46: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "<graphml xmlns=\"" GRAPHML_NAMESPACE_URI "\"\n");
                                              ^~~~~~~~~~~~~~~~~~~~~
foreign-graphml.c:1412:59: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         xsi:schemaLocation=\"" GRAPHML_NAMESPACE_URI "\n");
                                                           ^~~~~~~~~~~~~~~~~~~~~
foreign-graphml.c:1414:38: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         " GRAPHML_NAMESPACE_URI "/1.0/graphml.xsd\">\n");
                                      ^~~~~~~~~~~~~~~~~~~~~
make: *** [foreign-graphml.o] Error 1
/usr/lib/R/etc/Makeconf:159: recipe for target 'foreign-graphml.o' failed
ERROR: compilation failed for package ‘igraph’
* removing ‘/usr/local/lib/R/site-library/igraph’

The downloaded source packages are in
        ‘/tmp/RtmpZ7svnx/downloaded_packages’
Warning message:
In install.packages("igraph") :
  installation of package ‘igraph’ had non-zero exit status

@Deleetdk
Copy link

Same issue. Mint 18.2, i.e. Ubuntu 16.04 LTS.

In file included from src/foreign-gml-parser.y:59:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined
 #  define strdup igraph_i_strdup
 ^
In file included from /usr/include/string.h:630:0,
                 from src/foreign-gml-parser.y:54:
/usr/include/x86_64-linux-gnu/bits/string2.h:1291:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)
 ^
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -DUSING_R -I. -Iinclude -Ics -Iglpk -Iplfit -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.1.1\" -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL=/**/ -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c foreign-graphml.c -o foreign-graphml.o
foreign-graphml.c: In function ‘igraph_write_graph_graphml’:
foreign-graphml.c:1408:46: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "<graphml xmlns=\"" GRAPHML_NAMESPACE_URI "\"\n");
                                              ^
foreign-graphml.c:1412:59: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         xsi:schemaLocation=\"" GRAPHML_NAMESPACE_URI "\n");
                                                           ^
foreign-graphml.c:1414:38: error: expected ‘)’ before ‘GRAPHML_NAMESPACE_URI’
   ret=fprintf(outstream, "         " GRAPHML_NAMESPACE_URI "/1.0/graphml.xsd\">\n");
                                      ^
/usr/lib/R/etc/Makeconf:159: recipe for target 'foreign-graphml.o' failed
make: *** [foreign-graphml.o] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/home/emil/R/x86_64-pc-linux-gnu-library/3.4/igraph’
Warning in install.packages :
  installation of package ‘igraph’ had non-zero exit status
ERROR: dependency ‘igraph’ is not available for package ‘tidygraph’
* removing ‘/home/emil/R/x86_64-pc-linux-gnu-library/3.4/tidygraph’
Warning in install.packages :
  installation of package ‘tidygraph’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpitvvdJ/downloaded_packages’
> sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.2

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  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_3.4.2 tools_3.4.2    yaml_2.1.14   

I tried installing the two listed system dependencies (libgmp3-dev libxml2), but it didn't change anything afaict.

@venkatachalapathy
Copy link

I got identical errors when I tried to install igraph in Ubuntu 14.04. @JeffRodrigo's Stack Overflow link worked for me.

@OnlyBelter
Copy link

This is my Dockerfile, I got same error:

FROM ubuntu:16.04

MAINTAINER Laurent Gautier <[email protected]>, Xin Xiong <[email protected]>

ARG DEBIAN_FRONTEND=noninteractive
ARG CRAN_MIRROR=https://cran.revolutionanalytics.com/

RUN \
  apt-get update -qq && \
  apt-get install -y \
                     apt-utils \
                     apt-transport-https \
                     gnupg \
                     libcurl4-openssl-dev \
                     libnlopt-dev \
                     software-properties-common \
                     lsb-release && \
  echo "deb ${CRAN_MIRROR}/bin/linux/ubuntu $(lsb_release -c -s)/" \
        >> /etc/apt/sources.list.d/added_repos.list && \
  apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 && \
  apt-get update -qq && \
  apt-get install -y \
                     aptdaemon \
                     ed \
                     git \
                     mercurial \
                     libcairo-dev \
                     libedit-dev \
                     python3 \
                     python3-pip \
                     python3.5-venv \
                     python-dev \
                     r-base \
                     r-base-dev \
                     sudo \
                     wget

RUN \
  cd /src && \
  R -e 'source("http://bioconductor.org/biocLite.R"); biocLite("igraph")'

If I run docker buil -t onlybelter/rpy2-docker, I will get this error:

In file included from src/foreign-gml-parser.y:59:0:
igraph_hacks_internal.h:42:0: warning: "strdup" redefined
 #  define strdup igraph_i_strdup
 ^
In file included from /usr/include/string.h:630:0,
                 from src/foreign-gml-parser.y:54:
/usr/include/x86_64-linux-gnu/bits/string2.h:1291:0: note: this is the location of the previous definition
 #   define strdup(s) __strdup (s)
 ^
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -DUSING_R -I. -Iinclude -Ics -Iglpk -Iplfit -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -DPACKAGE_VERSION=\"1.1.1\" -DINTERNAL_ARPACK -DIGRAPH_THREAD_LOCAL=/**/ -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c foreign-graphml.c -o foreign-graphml.o
foreign-graphml.c: In function 'igraph_write_graph_graphml':
foreign-graphml.c:1408:46: error: expected ')' before 'GRAPHML_NAMESPACE_URI'
   ret=fprintf(outstream, "<graphml xmlns=\"" GRAPHML_NAMESPACE_URI "\"\n");
                                              ^
foreign-graphml.c:1412:59: error: expected ')' before 'GRAPHML_NAMESPACE_URI'
   ret=fprintf(outstream, "         xsi:schemaLocation=\"" GRAPHML_NAMESPACE_URI "\n");
                                                           ^
foreign-graphml.c:1414:38: error: expected ')' before 'GRAPHML_NAMESPACE_URI'
   ret=fprintf(outstream, "         " GRAPHML_NAMESPACE_URI "/1.0/graphml.xsd\">\n");
                                      ^
/usr/lib/R/etc/Makeconf:159: recipe for target 'foreign-graphml.o' failed
make: *** [foreign-graphml.o] Error 1
ERROR: compilation failed for package 'igraph'
* removing '/usr/local/lib/R/site-library/igraph'

The downloaded source packages are in
	'/tmp/RtmpkgHPZF/downloaded_packages'
> 
> 
Old packages: 'MASS', 'Matrix', 'codetools', 'lattice', 'spatial'
Warning message:
In install.packages(pkgs = doing, lib = lib, ...) :
  installation of package 'igraph' had non-zero exit status

@OnlyBelter
Copy link

I find a method occasionally when I run pip install mysqlclient still get error:

sudo apt-get install libssl-dev  
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libxml2-dev

ref here: https://stackoverflow.com/a/46388882/2803344

@alugowski
Copy link

Confirm @OnlyBelter's solution works. It's also a second answer in @JeffRodrigo's stackoverflow link.

sudo apt-get install -y libcurl4-openssl-dev libxml2-dev libssl-dev

@thibautjombart
Copy link

For what it's worth, I could reproduce the issue on a clean install of Ubuntu 16.04 and the above solution works.

@rbreunev
Copy link

rbreunev commented Oct 7, 2020

If it i can be of used to someone :

Encounter close problem : igraph installed using Rstudio package manager UI but can not be loaded :

Restarting R session...

> install.packages("igraph")
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://packagemanager.rstudio.com/all/__linux__/focal/latest/src/contrib/igraph_1.2.5.tar.gz'
Content type 'binary/octet-stream' length 8388708 bytes (8.0 MB)
==================================================
downloaded 8.0 MB

* installing *binary* package ‘igraph’ ...
* DONE (igraph)

The downloaded source packages are in
	‘/tmp/RtmptCbORy/downloaded_packages’
> library(igraph)
Error: package or namespace load failed for ‘igraph’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/local/lib/R/site-library/igraph/libs/igraph.so':
  libglpk.so.40: cannot open shared object file: No such file or directory

The solution founded is to install igraph using command line with :

sudo R -e "require(devtools); install_version('igraph', version='1.2.5', repos='https://cran.rstudio.org/')"

The Linux version is : "Ubuntu 20.04 LTS"

The Rstudio server version is :

platform       x86_64-pc-linux-gnu         
arch           x86_64                      
os             linux-gnu                   
system         x86_64, linux-gnu           
status                                     
major          4                           
minor          0.2                         
year           2020                        
month          06                          
day            22                          
svn rev        78730                       
language       R                           
version.string R version 4.0.2 (2020-06-22)
nickname       Taking Off Again 

@Kodiologist
Copy link

Kodiologist commented Sep 1, 2022

This (namely libglpk.so.40: cannot open shared object file) is still an issue on Ubuntu 22.04 when trying to install the latest igraph from CRAN, namely 1.3.4. sudo apt install libglpk-dev fixed it.

@szhorvat
Copy link
Member

szhorvat commented Oct 10, 2022

@Kodiologist @bersbersbers I just tested this again, and I cannot reproduce this problem. If GLPK is not present when installing igraph, then GLPK support will simply be disabled in igraph.

One way to get this error is if GLPK is present when installing igraph, but then later it is removed. That will break igraph. You must keep GLPK installed. Did you by any chance uninstall GLPK after installing igraph?

If you see this error even though you've never had GLPK installed, it is possible that igraph picked up a different GLPK library at installation/compilation time, but it cannot find it at load time. This different GLPK library may have come from an active Anaconda environment. Did you have a conda environment active when you installed igraph?

If you can answer these questions, it will help us improve the igraph installation experience for everyone.

@Kodiologist
Copy link

Did you by any chance uninstall GLPK after installing igraph?

I couldn't install igraph in the first place. I had to apt install libglpk-dev first.

Did you have a conda environment active when you installed igraph?

No.

@szhorvat
Copy link
Member

szhorvat commented Oct 10, 2022

Thanks for the response @Kodiologist !

Would you have the time to try a couple more things? Could you uninstall libglpk-dev, uninstall igraph, and see if re-installing igraph works correctly now?

After running install.packages("igraph"), you will see several output lines from the configure script, starting with checking for.... One of these, possibly the last one, should be checking for glp_read_mps in -lglpk... no, assuming that libglpk-dev is not installed. Do you see the same, i.e. no? Does installation succeed? It should succeed, and igraph should work fine, except for function calls that use GLPK. cluster_optimal(sample_gnm(10,20)) should cleanly throw an error: "GLPK is not available, Unimplemented function call".

As you can see from this thread, many people encounter this problem, and it would be great if we could figure out why it happens!

@Kodiologist
Copy link

Could you uninstall libglpk-dev, uninstall igraph, and see if re-installing igraph works correctly now?

I've done so and it seems to work. I saw checking for glp_read_mps in -lglpk... no during setup. cluster_optimal(sample_gnm(10,20)) indeed yields GLPK is not available, Unimplemented function call.

@bersbersbers
Copy link

Not sure when I upvoted this, but I think I remember that it was the time I experimented with GHA. Conda and the like where never involved as far as I can tell. My current workflow is something like this:

jobs:
  cron:
    runs-on: ubuntu-latest
    steps:
      - name: 1
        uses: actions/checkout@v3
      - name: 2
        uses: r-lib/actions/setup-r@v2
        with:
          use-public-rspm: true
      - name: 3
        uses: r-lib/actions/setup-r-dependencies@v2
      - name: 4
        run: sudo apt-get install -y libglpk40
      - name: 5
        run: pak::local_install()
        shell: Rscript {0}

But I don't have logs from that time. Maybe a cache action interfered? That's hard for me to test right now, but if there is anything I shall run to get log output, I can do that.

@Kodiologist
Copy link

I think the build of igraph provided by RStudio at https://packagemanager.rstudio.com/all/__linux__/focal/latest/src/contrib/igraph_1.3.5.tar.gz assumes you have GLPK installed, and so it will yield libglpk.so.40: cannot open shared object file: No such file or directory if you don't.

@szhorvat
Copy link
Member

Thanks for the hint @Kodiologist! This could indeed be the explanation for why this issue appears to be so common. The only other explanation I can think of is that people install igraph when GLPK is present, then they inadvertently uninstall GLPK (perhaps an apt autoremove), which then breaks igraph.

@szhorvat
Copy link
Member

@bersbersbers Are you compiling igraph from sources? If yes, for complete functionality, you need to install libglpk-dev, as this will provide the GLPK headers. For using an already-compiled igraph, you only need to install libglpk40 (as you currently do).

@szhorvat
Copy link
Member

szhorvat commented Oct 11, 2022

I've updated the troubleshooting document based on the information you provided here, see #584. Suggestions for improvements are welcome. Thanks again for all the help!

@bersbersbers
Copy link

bersbersbers commented Oct 11, 2022

@szhorvat as outlined above, I think I see this problem only when installing on GHA, via RSPM - but it's hard to know what exactly GHA does in the background. Job setup is reasonably fast, so I guess it's using binaries or an extensive cache (I guess, both, as I only ever used libglpk40, not libglpk-dev). So #209 (comment) provides a very sensible explanation - that process seems to convert an optional dependency into a real one.

I never ever consciously uninstalled a library on GHA.

@bersbersbers
Copy link

Ultimately, I feel this is something r-lib/actions/setup-r-dependencies may be interested in fixing.

@szhorvat
Copy link
Member

@gaborcsardi Opinions on the above suggestion?

@bersbersbers
Copy link

bersbersbers commented Oct 11, 2022

After reading https://github.com/r-lib/actions/blob/v2/setup-r-dependencies/README.md, my impression is that system requirements are not explicitly installed by that action, but by pak. Maybe we can find a reprex using a minimal package depending on igraph that fails to install via pak and RSPM when the required library is not installed?

And https://github.com/rstudio/r-system-requirements/tree/main/rules is maybe a good point to add igraph support?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests