【问题标题】:Installing cplexAPI with newest version of cplex 12.10.0 - new error使用最新版本的 cplex 12.10.0 安装 cplexAPI - 新错误
【发布时间】:2020-11-10 03:27:09
【问题描述】:

我想安装 cplexAPI R 包以与最新版本的 IBM CPLEX 求解器 (IBM ILOG CPLEX Optimizers 12.10.0) 交互,但我不断收到以下错误:

CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
* installing *source* package 'cplexAPI' ...
** package 'cplexAPI' successfully unpacked and MD5 sums checked
** using staged installation
** libs

*** arch - i386
"C:/rtools40/mingw32/bin/"gcc  -I"C:/Users/USERNAME/R/R-40~1.3/include" -DNDEBUG -g -D_R_=1 -DUSE_R=1 -I"C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\include"         -O2 -Wall  -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cplexAPI.c -o cplexAPI.o
C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                                              ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\include/ilcplex/cplex.h:1214:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\include/ilcplex/cpxconst.h:251:41: error: expected identifier or '(' before ')' token
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
                                         ^~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\include/ilcplex/cplex.h:1214:1: note: in expansion of macro 'CPXDEPRECATEDAPI'
 CPXDEPRECATEDAPI(12090000)
 ^~~~~~~~~~~~~~~~
C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\include/ilcplex/cpxconst.h:251:62: error: expected ')' before 'deprecated'
 #      define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
           
     

我做了以下事情:

  1. 从 [https://cran.r-project.org/bin/windows/Rtools/][1] 安装 Rtools40,并在我的 .Renviron 文件中添加 PATH="${RTOOLS40_HOME}\usr\bin;${PATH}"

  2. C:\Program Files\IBM\ILOG\CPLEX_Studio1210 中安装了 IBM CPLEX

  3. 在我的.Renviron 文件中添加了以下路径:

    CPLEX_STUDIO_DIR = "C:\Program Files\IBM\ILOG\CPLEX_Studio1210"

    CPLEX_STUDIO_LIB = "C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\lib"

  4. 运行install.packages('cplexAPI')。我也尝试手动下载 tar.gz 文件并修改 Makevars.win 文件中的路径,但我得到了同样的错误。 仅供参考,我有以下 R 版本:

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          4                           
minor          0.3                         
year           2020                        
month          10                          
day            10                          
svn rev        79318                       
language       R                           
version.string R version 4.0.3 (2020-10-10)
nickname       Bunny-Wunnies Freak Out

【问题讨论】:

    标签: r package cplex


    【解决方案1】:

    这似乎是 cplex 库中的一个错误。另见:https://stackoverflow.com/a/61199818/318752

    一种解决方法是将-DBUILD_CPXSTATIC 添加到包src/Makevars.win 内的PKG_CPPFLAGS 中,如下所示:https://github.com/r-windows/Rcplex/commit/545254ab7cf28e97e62063c16af711ff2b46476d

    我还必须更新 dll 名称,因为 cplex dll 被称为 cplex12100.dll,而 R 包仍假定为 cplex1263.dll。通过这些修复,我可以在 Windows 上安装该软件包:

    install.packages("slam")
    install.packages('https://github.com/r-windows/Rcplex/archive/master.tar.gz', repos = NULL, INSTALL_opts = '--no-multiarch')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-13
      • 2018-10-23
      • 2019-05-25
      • 2020-03-25
      • 2011-06-14
      • 1970-01-01
      相关资源
      最近更新 更多