简体   繁体   English

R:在Linux上安装Rcplex

[英]R: install Rcplex on linux

I have some trouble installing Rcplex on linux. 我在Linux上安装Rcplex时遇到一些麻烦。

I tried: 我试过了:

R CMD INSTALL --configure-args="                                      
--with-cplex-dir='/opt/ibm/ILOG/CPLEX_Studio129/cplex'"    Rcplex_0.3-3.tar.gz

then I get this error: 然后我得到这个错误:

* installing *source* package ‘Rcplex’ ...
** package ‘Rcplex’ successfully unpacked and MD5 sums checked
checking for gawk... gawk
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for egrep... grep -E
checking for ANSI C header files... no
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 ilcplex/cplex.h usability... yes
checking ilcplex/cplex.h presence... yes
checking for ilcplex/cplex.h... yes
checking for library containing CPXversion... no
configure: error: Could not link CPLEX library using -L/opt/ibm/ILOG/CPLEX_Studio129/cplex/lib/x86-64_linux/static_pic -l$(CPLEXLIB) -lm -lpthread -ldl
ERROR: configuration failed for package ‘Rcplex’

I also tried this: 我也试过这个:

R CMD INSTALL     --configure-args="--with-cplex-include=/opt/ibm/ILOG/CPLEX_Studio129/cplex/include \
    --with-cplex-cflags=-fPIC \
    --with-cplex-lib=/opt/ibm/ILOG/CPLEX_Studio129/cplex/lib/x86-64_linux/static_pic' \
    -lcplex -lm -lpthread'" Rcplex_0.3-3.tar.gz 

and get this error: 并得到这个错误:

* installing *source* package ‘Rcplex’ ...
** package ‘Rcplex’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for egrep... grep -E
checking for ANSI C header files... no
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 ilcplex/cplex.h usability... yes
checking ilcplex/cplex.h presence... yes
checking for ilcplex/cplex.h... yes
checking for library containing CPXversion... no
configure: error: Could not link CPLEX library using /opt/ibm/ILOG/CPLEX_Studio129/cplex/lib/x86-64_linux/static_pic -lcplex -lm -lpthread
ERROR: configuration failed for package ‘Rcplex’

I think your best course of action is to look into what exactly the configure script tries to run. 我认为您最好的做法是调查configure脚本尝试运行的内容。 Maybe it expects another version of CPLEX? 也许它期望CPLEX的另一个版本?

I experienced the same problem installing the Rcplex 0.3-3 package for R3.6.1 on Ubuntu 18.04 with CPLEX 12.9. 我在使用CPLEX 12.9的Ubuntu 18.04上为R3.6.1安装Rcplex 0.3-3软件包时遇到了同样的问题。

Turns out that the Rcplex package was developed and tested with CPLEX 12.6.3. 事实证明,Rcplex软件包是使用CPLEX 12.6.3开发和测试的。 When I installed this older version of CPLEX on Ubuntu, I was able to install Rcplex 0.3-3 by following the instructions in the INSTALL file. 当我在Ubuntu上安装此旧版本的CPLEX时,可以按照INSTALL文件中的说明安装Rcplex 0.3-3。

On my system, this command did the trick: 在我的系统上,此命令可以达到目的:

sudo R CMD INSTALL --configure-args="PKG_CFLAGS=-fPIC PKG_CPPFLAGS=-I/opt/ibm/ILOG/CPLEX_Studio1263/cplex/include PKG_LIBS='-L/opt/ibm/ILOG/CPLEX_Studio1263/cplex/lib/x86-64_linux/static_pic -lcplex -lm -lpthread'" Rcplex_0.3-3.tar.gz

This appears to be an issue with the Linux version of Rcplex only. 这似乎仅与Rcplex的Linux版本有关。 I was able to install Rcplex with the latest version of CPLEX on my Mac. 我可以在Mac上使用最新版本的CPLEX安装Rcplex。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM