无法在linux上编译C代码

时间:2014-01-30 01:03:17

标签: c linux r gcc install

我正在尝试在Linux 13.10“云”/虚拟服务器上安装rJave / JRI(允许您在Java应用程序中运行R命令的代码)。

如果我从R中尝试install.packages(“rJava”),我会得到“

* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... no
configure: error: in `/tmp/RtmpW6xdRi/R.INSTALLbff775d77a6/rJava':
configure: error: C compiler cannot create executables
See `config.log' for more details

不幸的是,我不知道config.log在哪里,find / -name "config.log"找不到任何东西。所以我下载了源代码并尝试安装:

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... 
configure: error: C compiler cannot create executables
See `config.log' for more details.

现在,至少,我有一个配置日志。任何解释为什么失败的原因将不胜感激:

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

It was created by JRI configure 0.3, which was
generated by GNU Autoconf 2.61.  Invocation command line was

  $ ./configure 

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

hostname = greg1304
uname -m = x86_64
uname -r = 3.8.0-33-generic
uname -s = Linux
uname -v = #48-Ubuntu SMP Wed Oct 23 09:16:58 UTC 2013

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

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /home/gregd/bin


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

configure:1722: checking build system type
configure:1740: result: x86_64-unknown-linux-gnu
configure:1762: checking host system type
configure:1777: result: x86_64-unknown-linux-gnu
configure:1910: checking for gcc
configure:1937: result: gcc -std=gnu99
configure:2175: checking for C compiler version
configure:2182: gcc -std=gnu99 --version >&5
gcc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2185: $? = 0
configure:2192: gcc -std=gnu99 -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-l
anguages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr
/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --ena
ble-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with
-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1) 
configure:2195: $? = 0
configure:2202: gcc -std=gnu99 -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:2205: $? = 4
configure:2228: checking for C compiler default output file name
configure:2255: gcc -std=gnu99 -O2 -pipe -g   conftest.c  >&5
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
/usr/bin/ld: cannot find -lc
/usr/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
configure:2258: $? = 1
configure:2296: result: 
configure: failed program was:
| /* confdefs.h.  */
| #define PACKAGE_NAME "JRI"
| #define PACKAGE_TARNAME "jri"
| #define PACKAGE_VERSION "0.3"
| #define PACKAGE_STRING "JRI 0.3"
| #define PACKAGE_BUGREPORT "simon.urbanek@r-project.org"
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:2303: error: C compiler cannot create executables
See `config.log' for more details.

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

ac_cv_build=x86_64-unknown-linux-gnu
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_LIBS_set=
ac_cv_env_LIBS_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_host=x86_64-unknown-linux-gnu
ac_cv_prog_ac_ct_CC='gcc -std=gnu99'

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

CC='gcc -std=gnu99'
CFLAGS='-O2 -pipe -g'
CPICF=''
CPP='gcc -std=gnu99 -E'
CPPFLAGS=''
DEFFLAGS=''
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
GREP=''
JAR=''
JAVAC=''
JAVAH=''
JAVA_CFLAGS=''
JAVA_HOME='/usr/lib/jvm/java-6-openjdk'
JAVA_INC=''
JAVA_LD_PATH=''
JAVA_LIBS=''
JAVA_PROG=''
JNILD=''
JNIPREFIX=''
JNISO=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LTLIBOBJS=''
OBJEXT=''
PACKAGE_BUGREPORT='simon.urbanek@r-project.org'
PACKAGE_NAME='JRI'
PACKAGE_STRING='JRI 0.3'
PACKAGE_TARNAME='jri'
PACKAGE_VERSION='0.3'
PATH_SEPARATOR=':'
RINC='-I/usr/share/R/include'
RLD='-L/usr/lib/R/lib -lR'
R_DOC_DIR='/usr/share/R/doc'
R_HOME='/usr/lib/R'
R_INCLUDE_DIR='/usr/share/R/include'
R_SHARE_DIR='/usr/share/R/share'
SHELL='/bin/bash'
ac_ct_CC='gcc -std=gnu99'
bindir='${exec_prefix}/bin'
build='x86_64-unknown-linux-gnu'
build_alias=''
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='unknown'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-unknown-linux-gnu'
host_alias=''
host_cpu='x86_64'
host_os='linux-gnu'
host_vendor='unknown'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

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

#define PACKAGE_NAME "JRI"
#define PACKAGE_TARNAME "jri"
#define PACKAGE_VERSION "0.3"
#define PACKAGE_STRING "JRI 0.3"
#define PACKAGE_BUGREPORT "simon.urbanek@r-project.org"

configure: exit 77

3 个答案:

答案 0 :(得分:0)

我不确定你的C问题,但我不认为如果它用这些标志测试你的C ++编译器你会得到任何地方 - 我认为-std = gnu99对c ++是无效的(尽管它适用于c,因此我假设你已经有其他一些问题了)

编辑: 还不确定这是否是一个版本控制的东西(我的gcc是4.8.1),虽然我对此表示怀疑,但你有一个64位目标,但gcc没有64位库,据我所知?我对gcc-std = gnu99 -v的输出包括底部附近的几个标志,你有一些但不是全部:

--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu

如果程序正在检查64位已编译的可执行文件(假设您的系统是x64_86?),那么问题就在于此处。

答案 1 :(得分:0)

所以我将13.04升级到13.10,这显然将我的gcc从4.7升级到4.8。所以我再次尝试,这次一切正常。

所以我打算把它称为gcc 4.7 bug。

感谢您的帮助。

答案 2 :(得分:0)

供参考:在Ubuntu 16.04上你必须安装' libc6-dev'