无法链接R

时间:2019-07-16 13:32:41

标签: r terminal linker install cplex

我正在尝试在Macbook上的Rcplex中安装R,并且正在遵循此链接http://jrzubizarreta.com/INSTALL上的说明。

在终端上,我解压缩RcplexUsers/Downloads)的文件夹中,

R CMD INSTALL --configure-args="PKG_CFLAGS='-m64 -fPIC' 
PKG_CPPFLAGS=-I/Applications/CPLEX_Studio129/cplex/include 
PKG_LIBS='-l/Applications/CPLEX_Studio129/cplex/lib/x86-64_osx/static_pic 
-lcplex -m64 -lm -lpthread -framework CoreFoundation -framework IOKit'" Rcplex

我收到的错误为:

配置:错误:无法使用-链接CPLEX库    l /应用程序/ CPLEX_Studio129 / cplex / lib / x86-64_osx / static_pic -lcplex -m64-    lm -lpthread-框架CoreFoundation-框架IOKit    错误:“ Rcplex”包的配置失败

下面附有makefileCFLAGS信息的CLNFLAGS和我安装config.log的文件夹中的Rcplex文件。

我没有从终端安装软件的经验,但是我确实需要此软件才能工作。有人知道问题出在哪里吗?谢谢。

PS:我过去曾在error: C compiler cannot create executables发表过类似的问题,但是尽管上一篇文章非常有帮助,但我无法完成这项工作。

********************* START MAKEFILE  ***********************************
SYSTEM     = x86-64_osx
LIBFORMAT  = static_pic

#------------------------------------------------------------
#
# When you adapt this makefile to compile your CPLEX programs
# please copy this makefile and set CPLEXDIR and CONCERTDIR to
# the directories where CPLEX and CONCERT are installed.
#
#------------------------------------------------------------

CPLEXDIR      = ../../..
CONCERTDIR    = ../../../../concert

# ---------------------------------------------------------------------
# Compiler selection 
# ---------------------------------------------------------------------

CCC = clang++ -O0
CC  = clang -O0
JAVAC = javac 

# ---------------------------------------------------------------------
# Compiler options 
# ---------------------------------------------------------------------

CCOPT = -m64 -O -fPIC -fexceptions -DNDEBUG -DIL_STD -stdlib=libc++
COPT  = -m64 -fPIC
JOPT  = -classpath $(CPLEXDIR)/lib/cplex.jar -O

# ---------------------------------------------------------------------
# Link options and libraries
# ---------------------------------------------------------------------

CPLEXBINDIR   = $(CPLEXDIR)/bin/$(BINDIST)
CPLEXJARDIR   = $(CPLEXDIR)/lib/cplex.jar
CPLEXLIBDIR   = $(CPLEXDIR)/lib/$(SYSTEM)/$(LIBFORMAT)
CONCERTLIBDIR = $(CONCERTDIR)/lib/$(SYSTEM)/$(LIBFORMAT)

# For dynamic linking
CPLEXBINDIR   = $(CPLEXDIR)/bin/$(SYSTEM)
CPLEXLIB      = cplex$(dynamic:yes=1290)
run           = $(dynamic:yes=DYLD_LIBRARY_PATH=$(CPLEXBINDIR))

CCLNDIRS  = -L$(CPLEXLIBDIR) -L$(CONCERTLIBDIR) $(dynamic:yes=-L$(CPLEXBINDIR))
CLNDIRS   = -L$(CPLEXLIBDIR) $(dynamic:yes=-L$(CPLEXBINDIR))
CCLNFLAGS = -lconcert -lilocplex -l$(CPLEXLIB) -m64 -lm -lpthread -framework CoreFoundation -framework IOKit -stdlib=libc++
CLNFLAGS  = -l$(CPLEXLIB) -m64 -lm -lpthread -framework CoreFoundation -framework IOKit
JAVA      = java  -d64 -Djava.library.path=$(CPLEXDIR)/bin/x86-64_osx -classpath $(CPLEXJARDIR):


all:
    make all_c
    make all_cpp
    make all_java

execute: all
    make execute_c
    make execute_cpp
    make execute_java
CONCERTINCDIR = $(CONCERTDIR)/include
CPLEXINCDIR   = $(CPLEXDIR)/include

EXDIR         = $(CPLEXDIR)/examples
EXINC         = $(EXDIR)/include
EXDATA        = $(EXDIR)/data
EXSRCC        = $(EXDIR)/src/c
EXSRCCX       = $(EXDIR)/src/c_x
EXSRCCPP      = $(EXDIR)/src/cpp
EXSRCJAVA     = $(EXDIR)/src/java

CFLAGS  = $(COPT)  -I$(CPLEXINCDIR)

********************* END MAKEFILE  *************************************


********************* START CONFIG.LOG **********************************

Removed because of space limit

********************* END CONFIG.LOG  ***********************************

@rkersh正确指出-l实际上应该是-L。不幸的是,代码仍然给出错误。我从运行中附加了config.log

R CMD INSTALL --configure-args="PKG_CFLAGS='-m64 -fPIC' PKG_CPPFLAGS=-
I/Applications/CPLEX_Studio129/cplex/include PKG_LIBS='-
L/Applications/CPLEX_Studio129/cplex/lib/x86-64_osx/static_pic -lcplex -m64 -
lm -lpthread -framework CoreFoundation -framework IOKit'" Rcplex


********************* START CONFIG.LOG WITH `-L`  ***********************

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by Rcplex configure 0.3.2, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  $ ./configure PKG_CFLAGS=-m64 -fPIC PKG_CPPFLAGS=-I/Applications/CPLEX_Studio129/cplex/include PKG_LIBS=-L/Applications/CPLEX_Studio129/cplex/lib/x86-64_osx/static_pic -lcplex -m64 -lm -lpthread -framework CoreFoundation -framework IOKit

## --------- ##
## Platform. ##
## --------- ##

hostname = Andrews###
uname -m = x86_64
uname -r = 16.7.0
uname -s = Darwin
uname -v = Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64

/usr/bin/uname -p = i386
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
hostinfo               = Mach kernel version:
     Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3
Primary memory available: 16.00 gigabytes
Default processor set: 365 tasks, 1784 threads, 4 processors
Load average: 2.23, Mach factor: 1.76
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /Users/andrews/anaconda/bin
PATH: /Library/Frameworks/Python.framework/Versions/2.7/bin
PATH: /Users/andrews/anaconda/bin
PATH: /Library/Frameworks/Python.framework/Versions/3.5/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /opt/X11/bin
PATH: /Library/TeX/texbin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:1631: checking for gcc
configure:1657: result: clang
configure:1901: checking for C compiler version
configure:1904: clang --version </dev/null >&5
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
configure:1907: $? = 0
configure:1909: clang -v </dev/null >&5
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
configure:1912: $? = 0
configure:1914: clang -V </dev/null >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:1917: $? = 1
configure:1940: checking for C compiler default output file name
configure:1943: clang -Wall -g -O2 -I/usr/local/include  conftest.c  >&5
configure:1946: $? = 0
configure:1992: result: a.out
configure:1997: checking whether the C compiler works
configure:2003: ./a.out
configure:2006: $? = 0
configure:2023: result: yes
configure:2030: checking whether we are cross compiling
configure:2032: result: no
configure:2035: checking for suffix of executables
configure:2037: clang -o conftest -Wall -g -O2 -I/usr/local/include  conftest.c  >&5
configure:2040: $? = 0
configure:2065: result: 
configure:2071: checking for suffix of object files
configure:2092: clang -c -Wall -g -O2 -I/usr/local/include conftest.c >&5
configure:2095: $? = 0
configure:2117: result: o
configure:2121: checking whether we are using the GNU C compiler
configure:2145: clang -c -Wall -g -O2 -I/usr/local/include conftest.c >&5
configure:2151: $? = 0
configure:2155: test -z 
             || test ! -s conftest.err
configure:2158: $? = 0
configure:2161: test -s conftest.o
configure:2164: $? = 0
configure:2177: result: yes
configure:2183: checking whether clang accepts -g
configure:2204: clang -c -g -I/usr/local/include conftest.c >&5
configure:2210: $? = 0
configure:2214: test -z 
             || test ! -s conftest.err
configure:2217: $? = 0
configure:2220: test -s conftest.o
configure:2223: $? = 0
configure:2234: result: yes
configure:2251: checking for clang option to accept ANSI C
configure:2321: clang  -c -Wall -g -O2 -I/usr/local/include conftest.c >&5
configure:2327: $? = 0
configure:2331: test -z 
             || test ! -s conftest.err
configure:2334: $? = 0
configure:2337: test -s conftest.o
configure:2340: $? = 0
configure:2358: result: none needed
configure:2376: clang -c -Wall -g -O2 -I/usr/local/include conftest.c >&5
conftest.c:2:3: error: unknown type name 'choke'
  choke me
  ^
conftest.c:2:11: error: expected ';' after top level declarator
  choke me
          ^
          ;
2 errors generated.
configure:2382: $? = 1
configure: failed program was:
| #ifndef __cplusplus
|   choke me
| #endif
configure:2520: checking how to run the C preprocessor
configure:2638: result: clang -E
configure:2662: clang -E -I/usr/local/include conftest.c
configure:2668: $? = 0
configure:2700: clang -E -I/usr/local/include conftest.c
conftest.c:9:10: fatal error: 'ac_nonexistent.h' file not found
#include <ac_nonexistent.h>
         ^
1 error generated.
configure:2706: $? = 1
configure: failed program was:
| /* confdefs.h.  */
| 
| #define PACKAGE_NAME "Rcplex"
| #define PACKAGE_TARNAME "rcplex"
| #define PACKAGE_VERSION "0.3.2"
| #define PACKAGE_STRING "Rcplex 0.3.2"
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
| #include <ac_nonexistent.h>
configure:2756: checking for egrep
configure:2766: result: grep -E
configure:2771: checking for ANSI C header files
configure:2796: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2802: $? = 0
configure:2806: test -z 
             || test ! -s conftest.err
configure:2809: $? = 0
configure:2812: test -s conftest.o
configure:2815: $? = 0
configure:2904: clang -o conftest -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include  conftest.c -L/Applications/CPLEX_Studio129/cplex/lib/x86-64_osx/static_pic -lcplex -m64 -lm -lpthread -framework CoreFoundation -framework IOKit >&5
conftest.c:26:7: warning: implicitly declaring library function 'exit' with type 'void (int) __attribute__((noreturn))'
      exit(2);
      ^
conftest.c:26:7: note: include the header <stdlib.h> or explicitly provide a declaration for 'exit'
1 warning generated.
configure:2907: $? = 0
configure:2909: ./conftest
configure:2912: $? = 0
configure:2927: result: yes
configure:2951: checking for sys/types.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z 
             || test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for sys/stat.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z 
             || test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for stdlib.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z 
             || test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for string.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z 
             || test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for memory.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z 
             || test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for strings.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z 
             || test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for inttypes.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z 
             || test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for stdint.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z 
             || test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:2951: checking for unistd.h
configure:2967: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:2973: $? = 0
configure:2977: test -z 
             || test ! -s conftest.err
configure:2980: $? = 0
configure:2983: test -s conftest.o
configure:2986: $? = 0
configure:2997: result: yes
configure:3019: checking ilcplex/cplex.h usability
configure:3031: clang -c -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c >&5
configure:3037: $? = 0
configure:3041: test -z 
             || test ! -s conftest.err
configure:3044: $? = 0
configure:3047: test -s conftest.o
configure:3050: $? = 0
configure:3060: result: yes
configure:3064: checking ilcplex/cplex.h presence
configure:3074: clang -E -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include conftest.c
configure:3080: $? = 0
configure:3100: result: yes
configure:3135: checking for ilcplex/cplex.h
configure:3142: result: yes
configure:3154: checking for library containing CPXversion
configure:3184: clang -o conftest -Wall -g -O2 -m64 -fPIC -I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include  conftest.c -L/Applications/CPLEX_Studio129/cplex/lib/x86-64_osx/static_pic -lcplex -m64 -lm -lpthread -framework CoreFoundation -framework IOKit >&5
configure:3190: $? = 0
configure:3194: test -z 
             || test ! -s conftest.err
configure:3197: $? = 0
configure:3200: test -s conftest
configure:3203: $? = 0
configure:3273: result: none required
configure:3415: creating ./config.status

## ---------------------- ##
## Running config.status. ##
## ---------------------- ##

This file was extended by Rcplex config.status 0.3.2, which was
generated by GNU Autoconf 2.59.  Invocation command line was

  CONFIG_FILES    = 
  CONFIG_HEADERS  = 
  CONFIG_LINKS    = 
  CONFIG_COMMANDS = 
  $ ./config.status 

on Andrews###

config.status:638: creating src/Makevars

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_c_compiler_gnu=yes
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_exeext=
ac_cv_header_ilcplex_cplex_h=yes
ac_cv_header_inttypes_h=yes
ac_cv_header_memory_h=yes
ac_cv_header_stdc=yes
ac_cv_header_stdint_h=yes
ac_cv_header_stdlib_h=yes
ac_cv_header_string_h=yes
ac_cv_header_strings_h=yes
ac_cv_header_sys_stat_h=yes
ac_cv_header_sys_types_h=yes
ac_cv_header_unistd_h=yes
ac_cv_objext=o
ac_cv_prog_CPP='clang -E'
ac_cv_prog_ac_ct_CC=clang
ac_cv_prog_cc_g=yes
ac_cv_prog_cc_stdc=
ac_cv_prog_egrep='grep -E'
ac_cv_search_CPXversion='none required'

## ----------------- ##
## Output variables. ##
## ----------------- ##

AWK=''
CC='clang'
CFLAGS='-Wall -g -O2 -m64 -fPIC'
CPLEX_BIN=''
CPP='clang -E'
CPPFLAGS='-I/usr/local/include -I/Applications/CPLEX_Studio129/cplex/include'
DEFS='-DPACKAGE_NAME=\"Rcplex\" -DPACKAGE_TARNAME=\"rcplex\" -DPACKAGE_VERSION=\"0.3.2\" -DPACKAGE_STRING=\"Rcplex\ 0.3.2\" -DPACKAGE_BUGREPORT=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 '
ECHO_C='ECHO_N=''
ECHO_T=''
EGREP='grep -E'
EXEEXT=''
LDFLAGS=''
LIBOBJS=''
LIBS='-L/Applications/CPLEX_Studio129/cplex/lib/x86-64_osx/static_pic -lcplex -m64 -lm -lpthread -framework CoreFoundation -framework IOKit'
LTLIBOBJS=''
OBJEXT='o'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='Rcplex'
PACKAGE_STRING='Rcplex 0.3.2'
PACKAGE_TARNAME='rcplex'
PACKAGE_VERSION='0.3.2'
PATH_SEPARATOR=':'
PKG_CFLAGS='-m64 -fPIC'
PKG_CPPFLAGS='-I/Applications/CPLEX_Studio129/cplex/include'
PKG_LIBS='-L/Applications/CPLEX_Studio129/cplex/lib/x86-64_osx/static_pic -lcplex -m64 -lm -lpthread -framework CoreFoundation -framework IOKit'
SHELL='/bin/sh'
ac_ct_CC='clang'
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${prefix}/share'
exec_prefix='${prefix}'
host_alias=''
includedir='${prefix}/include'
infodir='${prefix}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localstatedir='${prefix}/var'
mandir='${prefix}/man'
oldincludedir='/usr/include'
prefix='/usr/local'
program_transform_name='s,x,x,'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

#define HAVE_INTTYPES_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
#define PACKAGE_BUGREPORT ""
#define PACKAGE_NAME "Rcplex"
#define PACKAGE_STRING "Rcplex 0.3.2"
#define PACKAGE_TARNAME "rcplex"
#define PACKAGE_VERSION "0.3.2"
#define STDC_HEADERS 1

configure: exit 0

1 个答案:

答案 0 :(得分:1)

您应该将-L用于lib目录,而不是-l

尝试使用以下内容:

R CMD INSTALL --configure-args="PKG_CFLAGS='-m64 -fPIC' 
PKG_CPPFLAGS=-I/Applications/CPLEX_Studio129/cplex/include 
PKG_LIBS='-L/Applications/CPLEX_Studio129/cplex/lib/x86-64_osx/static_pic 
-lcplex -m64 -lm -lpthread -framework CoreFoundation -framework IOKit'" Rcplex