GLPK: No such file or directory error when trying to install R package

前端 未结 8 1836
陌清茗
陌清茗 2020-12-10 04:10

I am trying to install sparkTable in R 3.1.0 which depends on Rglpk. I manually installed GPLK on the system and added the libs folder to LD_

8条回答
  •  死守一世寂寞
    2020-12-10 05:07

    In ubuntu 14.04, all above doesn't work. the following however works, without the need of installing libglpk-dev using apt-get.

    download the glpk package from gnu and extract it:

    wget http://ftp.gnu.org/gnu/glpk/glpk-4.55.tar.gz tar xvf glpk-4.55.tar.gz

    make a GLPK directory in your local path:

    mkdir ~/GLPK

    configure within glpk:

    cd glpk-4.55 ./configure --prefix=$HOME/GLPK cd .. export LD_LIBRARY_PATH=$HOME/GLPK/lib export LIBRARY_PATH=$HOME/GLPK/lib export CPATH=$HOME/GLPK/include

    download the Rglpk package from cran and extract it:

    wget http://cran.r-project.org/src/contrib/Rglpk_0.6-0.tar.gz tar xvf Rglpk_0.6_0.tar.gz

    move the glpk directory into Rglpk/src and rename it to GLPK:

    mv glpk-4.55 Rglpk/src/GLPK

    now you can install:

    R CMD INSTALL Rglpk


    now a bit of explanation of what's going on. The "src/Makevars.in" file in the Rglpk package contains a line of code to enter a non-existing directory 'GLPK' within the src/ folder:

    (line 11 of Makevars.in)

    GLPK.ts: @(cd GLPK && make) touch $@

    this is where the problem arises. obviously the code is trying to build glpk within that directory for some unknown reasons. and the solution above is achieved simply by moving the downloaded (and configured) glpk directory there...

提交回复
热议问题