最近使用R进行生物信息多组学分析,需要用到cplex,安装走了不少弯路,记录这个过程。

首先需要安装cplex;我的安装如下,

1.下载地址:cplex_studio1263.win-x86-64百度网盘:https://pan.baidu.com/s/1_d3rQIw8Uzv__btewMFlOA

2.cplex安装好之后,需要配置环境变量。

3.从官网下载cplexAPI_1.3.3.tar.gz包,如果按照其默认安装,出错,找不到文件夹,原因是,获取不到刚才安装的cplex_studio1263的路径,这就需要对其进行设置绝对路径。

我的设置如下:参考github的安装方式:https://github.com/bayesteecal/cplexAPI/blob/master/inst/INSTALL

里面src中的Makevars.win文件,指定真正的文件路径

PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"C:\soft_install\cplex\cplex\include"

PKG_LIBS=-L"C:\soft_install\cplex\cplex\lib" -lm -lcplex1236

其中lcplex1236是你安装cplex_studio1263对应的版本号。

但build之后出现如下错误。

C:\Users\openstack> R CMD INSTALL --build --no-multiarch .\cplexAPI_1.3.3.tar.gz

* installing to library 'C:/Users/openstack/Documents/R/win-library/4.1'
* installing *source* package 'cplexAPI' ...
** package 'cplexAPI' successfully unpacked and MD5 sums checked
** using staged installation
** libs
"C:/soft_install/rtools40/mingw64/bin/"gcc -I"C:/soft_install/R/R-4.1.1/include
" -DNDEBUG -g -D_R_=1 -DUSE_R=1 -I"C:\soft_install\cplex\cplex\include"
-O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c cplexAPI.c -o cplex
API.o
C:\soft_install\cplex\cplex\include/ilcplex/cpxconst.h:249:62: error: expected '
)' before 'deprecated'
# define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
^~~~~~~~~~
C:\soft_install\cplex\cplex\include/ilcplex/cplex.h:35:1: note: in expansion of
macro 'CPXDEPRECATEDAPI'
CPXDEPRECATEDAPI(12060200)
^~~~~~~~~~~~~~~~
C:\soft_install\cplex\cplex\include/ilcplex/cpxconst.h:249:41: error: expected i
dentifier or '(' before ')' token
# define CPXDEPRECATEDAPI(version) __declspec(dllimport deprecated)
^~~~~~~~~~
C:\soft_install\cplex\cplex\include/ilcplex/cplex.h:35:1: note: in expansion of
macro 'CPXDEPRECATEDAPI'
CPXDEPRECATEDAPI(12060200)

解决方法需要在Makevars.win第一句后面加入这句话:-DBUILD_CPXSTATIC

最终Makevars.win配置文件如下:

PKG_CPPFLAGS=-g -D_R_=1 -DUSE_R=1 -I"C:\soft_install\cplex\cplex\include" -DBUILD_CPXSTATIC
PKG_LIBS=-L"C:\soft_install\cplex\cplex\bin\x64_win64" -lm -lcplex1263

在build ;install,

R CMD build --no-build-vignettes --no-manual --md5 C:\Users\{your name here}\Desktop\cplexAPI

R CMD INSTALL --build --no-multiarch .\cplexAPI_1.3.3.tar.gz

最后成功提示如下

** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* MD5 sums
packaged installation of 'cplexAPI' as cplexAPI_1.3.3.zip
* DONE (cplexAPI)

R安装cplexAPI弯路的更多相关文章

  1. R安装package报ERROR: a 'NAMESPACE' file is required

    R安装package报错: [root@Hadoop-NN-01 mysofts]# R CMD INSTALL trimcluster_0.1-1.tar.gz * installing to li ...

  2. Ubuntu-16.04 R 安装及Jupyter notebook 配置

    1. R 安装 通常在Terminal下直接apt-get 即可,在16.10下可以get到R-3.3.1,目前最新好像是 R-3.4.2,可以去官方网站下载源码编译 (https://www.r-p ...

  3. R 安装与环境配置

    R语言是一种很方便的应用于科学计算的语言,推荐给大家学习. 由于R的版本对程序包的兼容有些问题,推荐使用2.15.3. 下面给出下载链接,安装一路默认即可,可以自己更存放目录,其他的都没有影响.下面是 ...

  4. R安装

    linux: 在编译R之前,需要通过yum安装以下几个程序: #yum install gcc-gfortran              #否则报”configure: error: No F77 ...

  5. R安装时出现辑程包不存在,解决方法

    R > -------------------------------------------------[解决方案]1.使用命令单独安装caret,安装的时间很长.install.packag ...

  6. R 安装 简单实用

    下载和安装Windows环境的R 1.进入主页,点击 蓝色加粗的 download R 2.随便点击一个镜像,这里点击的是http://mirror.fcaglp.unlp.edu.ar/CRAN/ ...

  7. R 安装car包失败

    在RStudio里安装car包的时候报错 /usr/bin/ld: cannot find -llapack /usr/bin/ld: cannot find -lblas make: *** [qu ...

  8. centos7 安装R和Rstudio客户端

    #官网下载R和Rstudio 我下载的是 R-3.2.1.tar.gz和rstudio-0.99.467-x86_64.rpm两个版本 rstudio没有看见有centos版的,下的这个RStudio ...

  9. R语言入门(一)简介安装

    数据挖掘常用的语言有R语言,python,SQL等,其中R语言最受欢迎.(注:SQL Server包含微软研究院开发的两种数据挖掘算法:Microsoft决策树和Microsoft聚集,此外还支持第三 ...

  10. R: 修改镜像、bioconductor安装及go基因富集分析

    1.安装bioconductor及go分析涉及的相关包 source("http://bioconductor.org/biocLite.R") options(BioC_mirr ...

随机推荐

  1. 物语(monogatari)

    \(Description\) 某一天,少年邂逅了同病相连的IA.见面后,IA一把牵起少年的手,决定和他一起逃离部落,离开这个无法容身的是非之地. 要逃离部落,少年和IA就需要先选择一条耗时最少的路线 ...

  2. Destroying Roads

    题目链接 \(Destroying\) 分析 又是变形了的最短路 我们可以考虑哪些道路必须被保留 然后枚举两个起点到终点重复的道路 考虑公合法用这些道路就可以了 \(Code\) #include&l ...

  3. 在 CentOS7 部署 ELK8.0.1

    在 CentOS7 部署 ELK8.0.1 目录 在 CentOS7 部署 ELK8.0.1 1 下载软件: 2 环境准备: 2.1 关闭防火墙和SELinux 2.2 修改Linux最大打开文件数 ...

  4. Cobalt Strike 之:会话管理

    郑重声明: 本笔记编写目的只用于安全知识提升,并与更多人共享安全知识,切勿使用笔记中的技术进行违法活动,利用笔记中的技术造成的后果与作者本人无关.倡导维护网络安全人人有责,共同维护网络文明和谐. Co ...

  5. PostgreSQL中的row_number() 与distinct用法说明

    一.示例 这两个SQL执行所得到的数据是一样的! select count(s.*) from (  select *, row_number() over (partition by fee_dat ...

  6. (2) 使用phpstudy 实现局域网内远程访问本地ThreeJS示例

    1 下载phpStudy  作为本地开发服务器 hpStudy下载后解压安装.安装完成后启动服务.如下: 2 打开phpStudy的安装目录,进入到安装目录的   PHPTutorial \  WWW ...

  7. mybatis动态标签——trim

    <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "- ...

  8. java正则匹配字符串最外层{}里的内容,包含{}

    String s = "start {sffff''{adfaw3ea}wfewrfwef----}";String regex = "(?<=\\{).*(?=\ ...

  9. foreach 和for

    "foreach和for循环如果只是遍历集合或者数组,用foreach好些,如果是对集合中的值进行修改,就要用for循环了,其实foreach的内部原理其实也是Iterator,但不能像It ...

  10. python怎么实现正确的浮点数四舍五入

    round 以下示例展示对于结构相同的两组数据(1.03575000和1.03425000)保留小数后4位,使用内置函数round方法的输出结果,并不是需要的结果 print(round(1.0357 ...