如何修复配置:错误:C编译器无法创建可执行文件


16

用过的

./configure DFLAGS="-03"

这是config.log

checking build system type... i686-pc-linux-gnu  
checking host system type... i686-pc-linux-gnu  
checking target system type... i686-pc-linux-gnu  
checking for a BSD-compatible install... /usr/bin/install -c  
checking whether build environment is sane... yes  
checking for a thread-safe mkdir -p... /bin/mkdir -p  
checking for gawk... gawk  
checking whether make sets $(MAKE)... yes  
checking whether make supports nested variables... yes  
checking whether to enable maintainer-specific portions of Makefiles... no  
checking for style of include used by make... GNU  
checking for gcc... gcc  
checking whether the C compiler works... no  
configure: error: in `/home/mike/cpuminer-2.4.2':  
configure: error: C compiler cannot create executables  

我的系统是ubuntu 14.04,系统详细信息说操作系统是32位。任何帮助都将是非常有用的,因为无论何时我尝试使用它,编译器都会失败,而不仅限于此安装。

config.log输出:

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

It was created by cpuminer configure 2.4.2, which was  
generated by GNU Autoconf 2.69.  Invocation command line was  

  $ ./configure CFLAGS=-03  

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

hostname = mike-Dell-DM051  
uname -m = i686  
uname -r = 3.13.0-57-generic  
uname -s = Linux  
uname -v = #95-Ubuntu SMP Fri Jun 19 09:27:48 UTC 2015  

/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: /usr/local/game  

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

configure:2336: checking build system type  
configure:2350: result: i686-pc-linux-gnu  
configure:2370: checking host system type  
configure:2383: result: i686-pc-linux-gnu  
configure:2403: checking target system type  
configure:2416: result: i686-pc-linux-gnu  
configure:2460: checking for a BSD-compatible install  
configure:2528: result: /usr/bin/install -c  
configure:2539: checking whether build environment is sane  
configure:2594: result: yes  
configure:2745: checking for a thread-safe mkdir -p  
configure:2784: result: /bin/mkdir -p  
configure:2791: checking for gawk  
configure:2807: found /usr/bin/gawk  
configure:2818: result: gawk  
configure:2829: checking whether make sets $(MAKE)  
configure:2851: result: yes  
configure:2880: checking whether make supports nested variables  
configure:2897: result: yes  
configure:3026: checking whether to enable maintainer-specific portions of Make$  
configure:3035: result: no  
configure:3061: checking for style of include used by make  
configure:3089: result: GNU  
configure:3160: checking for gcc  
configure:3176: found /usr/bin/gcc  
configure:3187: result: gcc  
configure:3416: checking for C compiler version  
configure:3425: gcc --version >&5  
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4  
Copyright (C) 2013 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:3436: $? = 0  
configure:3425: gcc -v >&5  
Using built-in specs.  
COLLECT_GCC=gcc  
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.8/lto-wrapper  
Target: i686-linux-gnu  
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.4-2ubuntu1~1$  
Thread model: posix  
gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)  
configure:3436: $? = 0  
configure:3425: gcc -V >&5  
gcc: error: unrecognized command line option '-qversion'  
gcc: fatal error: no input files  
compilation terminated.  
configure:3436: $? = 4  
configure:3456: checking whether the C compiler works  
configure:3478: gcc -03   conftest.c  >&5  
gcc: error: unrecognized command line option '-03'  
configure:3482: $? = 1  
configure:3520: result: no  
configure: failed program was:  
| /* confdefs.h */  
| #define PACKAGE_NAME "cpuminer"  
| #define PACKAGE_TARNAME "cpuminer"  
| #define PACKAGE_VERSION "2.4.2"  
| #define PACKAGE_STRING "cpuminer 2.4.2"  
| #define PACKAGE_BUGREPORT ""  
| #define PACKAGE_URL ""| #define PACKAGE "cpuminer"  
| #define VERSION "2.4.2"  
| /* end confdefs.h.  */  
|  
| int  
| main ()  
| {  
|  
|   ;  
|   return 0;  
| }  
configure:3525: error: in `/home/mike/cpuminer-2.4.2':  
configure:3527: error: C compiler cannot create executables  
See `config.log' for more details  

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

ac_cv_build=i686-pc-linux-gnu  
ac_cv_env_CCASFLAGS_set=  
ac_cv_env_CCASFLAGS_value=  
ac_cv_env_CCAS_set=  
ac_cv_env_CCAS_value=  
ac_cv_env_CC_set=  
ac_cv_env_CC_value=  
ac_cv_env_CFLAGS_set=set  
ac_cv_env_CFLAGS_value=-03  
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=i686-pc-linux-gnu  
ac_cv_path_install='/usr/bin/install -c'ac_cv_path_mkdir=/bin/mkdir  
ac_cv_prog_AWK=gawk  
ac_cv_prog_ac_ct_CC=gcc  
ac_cv_prog_make_make_set=yes  
ac_cv_target=i686-pc-linux-gnu  
am_cv_make_support_nested_variables=yes  

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

ACLOCAL='${SHELL} /home/mike/cpuminer-2.4.2/missing aclocal-1.14'  
ALLOCA=''    
AMDEPBACKSLASH='\'  
AMDEP_FALSE='#'  
AMDEP_TRUE=''  
AMTAR='$${TAR-tar}'  
AM_BACKSLASH='\'  
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'  
AM_DEFAULT_VERBOSITY='1'  
AM_V='$(V)'  
ARCH_ARM_FALSE=''ARCH_ARM_TRUE=''  
ARCH_PPC_FALSE=''  
ARCH_PPC_TRUE=''  
ARCH_x86_64_FALSE=''  
ARCH_x86_64_TRUE=''  
ARCH_x86_FALSE=''  
ARCH_x86_TRUE=''  
AUTOCONF='${SHELL} /home/mike/cpuminer-2.4.2/missing autoconf'  
AUTOHEADER='${SHELL} /home/mike/cpuminer-2.4.2/missing autoheader'  
AUTOMAKE='${SHELL} /home/mike/cpuminer-2.4.2/missing automake-1.14'  
AWK='gawk'  
CC='gcc'  
CCAS=''  
CCASDEPMODE=''  
CCASFLAGS=''  
CCDEPMODE=''  
CFLAGS='-03'  
CPP=''  
CPPFLAGS=''  
CYGPATH_W='echo'  
DEFS=''  
DEPDIR='.deps'  
ECHO_C=''  
ECHO_N='-n'  
ECHO_T=''  
EGREP=''  
EXEEXT=''  
GREP=''  
HAVE_WINDOWS_FALSE=''  
HAVE_WINDOWS_TRUE=''  
INSTALL_DATA='${INSTALL} -m 644'  
INSTALL_PROGRAM='${INSTALL}'  
INSTALL_SCRIPT='${INSTALL}'  
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'  
JANSSON_LIBS=''  
LDFLAGS=''  
LIBCURL=''  
LIBCURL_CPPFLAGS=''  
LIBOBJS=''  
LIBS=''  
LTLIBOBJS=''  
MAINT='#'  
MAINTAINER_MODE_FALSE=''  
MAINTAINER_MODE_TRUE='#'MAKEINFO='${SHELL} /home/mike/cpuminer-2.4.2/missing makeinfo'  
MKDIR_P='/bin/mkdir -p'  
OBJEXT=''  
PACKAGE='cpuminer'  
PACKAGE_BUGREPORT=''  
PACKAGE_NAME='cpuminer'  
PACKAGE_STRING='cpuminer 2.4.2'  
PACKAGE_TARNAME='cpuminer'  
PACKAGE_URL=''  
PACKAGE_VERSION='2.4.2'  
PATH_SEPARATOR=':'  
PTHREAD_FLAGS=''  
PTHREAD_LIBS=''  
RANLIB=''  
SET_MAKE=''  
SHELL='/bin/bash'  
STRIP=''  
USE_ASM_FALSE=''  
USE_ASM_TRUE=''  
VERSION='2.4.2'  
WANT_JANSSON_FALSE=''  
WANT_JANSSON_TRUE=''  
S2_LIBS=''  
_libcurl_config=''  
ac_ct_CC='gcc'  
am__EXEEXT_FALSE=''  
am__EXEEXT_TRUE=''  
am__fastdepCCAS_FALSE=''  
am__fastdepCCAS_TRUE=''  
am__fastdepCC_FALSE=''  
am__fastdepCC_TRUE=''  
am__include='include'  
am__isrc=''  
am__leading_dot='.'  
am__nodep='_no'  
am__quote=''  
am__tar='$${TAR-tar} chof - "$$tardir"'  
am__untar='$${TAR-tar} xf -'  
bindir='${exec_prefix}/bin'  
build='i686-pc-linux-gnu'  
build_alias=''  
build_cpu='i686'  
build_os='linux-gnu'  
build_vendor='pc'htmldir='${docdir}'  
includedir='${prefix}/include'  
infodir='${datarootdir}/info'  
install_sh='${SHELL} /home/mike/cpuminer-2.4.2/install-sh'  
libdir='${exec_prefix}/lib'  
libexecdir='${exec_prefix}/libexec'  
localedir='${datarootdir}/locale'  
localstatedir='${prefix}/var'  
mandir='${datarootdir}/man'  
mkdir_p='$(MKDIR_P)'  
oldincludedir='/usr/include'  
pdfdir='${docdir}'  
sbindir='${exec_prefix}/sbin'  
sharedstatedir='${prefix}/com'  
sysconfdir='${prefix}/etc'  
target='i686-pc-linux-gnu'  
target_alias=''  
target_cpu='i686'  
target_os='linux-gnu'  
target_vendor='pc'  

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

/* confdefs.h */  
#define PACKAGE_NAME "cpuminer"  
#define PACKAGE_TARNAME "cpuminer"  
#define PACKAGE_VERSION "2.4.2"  
#define PACKAGE_STRING "cpuminer 2.4.2"  
#define PACKAGE_BUGREPORT ""  
#define PACKAGE_URL ""  
#define PACKAGE "cpuminer"  
#define VERSION "2.4.2"  

configure: exit 77  

您确定您拥有cpuminer-2.4.2目录吗?
ubfan1

尝试用引号引起来的命令来隔离权限问题---“ echo” void main(){printf(\“ hello world \ n \”);}“ | gcc -xc--o / tmp / hello; / tmp / hello “ ...执行后,您应该会看到控制台上印有“ hello world”
Arul Selvan 2015年

我使用git来获取文件并创建了目录,我没有在git中使用超级用户,只是git,目录是在我的主目录中创建的,所以我认为我确实拥有该目录。
Mike O

是,在我执行echo“ void main(){printf(\” hello world \ n \“);}”之后| gcc -xc--o / tmp / hello; / tmp / hello我得到了hello world
Mike O

检查目录上的权限,它是我的.....
Mike O

Answers:


24

我的猜测是您已经安装了基本的C编译器,但没有安装标准库的标头。尝试:

sudo apt install libc6-dev

[编辑:这会产生类似的症状,但事实并非如此。CFLAGS的答案似乎是正确的。]


libc6-dev已经是最新版本。
Mike O

在这种情况下,请查看config.log文件,该文件应包含有关错误原因的信息。
科林·沃森

config.log的输出在原始文章的顶部
Mike O

我的坏,以为我已经在原来贴的config.log,现在加入.......
麦克Ø

19

来自config.log

configure:3478: gcc -03   conftest.c  >&5  
gcc: error: unrecognized command line option '-03'  

该选项-O3带有字母O,而不是数字0(零)。因此,您应该按照自述文件中的说明运行:

./configure CFLAGS="-O3"

4

看起来您的CFLAGS具有零而不是大写的O。这是无效的,并导致编译失败。您可以修复它,但实际上是寻找已修复的软件包的更高版本。


首先尝试了较新的版本,但失败了,所以我删除了该文件,并尝试了此版本,但失败了,所以我发现还有其他问题。感谢您的修复
Mike O

3

我在尝试在Linux Mint 17.3的基本版本上安装tivodecode时遇到了同样的问题。我尝试了:

./configure DFLAGS="-O3"

命令,但无效。所以我尝试了:

sudo apt install libc6-dev

安装最新的C标头。我./configure再次尝试了没有变量的命令,一切顺利。该makemake install命令也顺利完成。我的建议是确保安装了最新的C标头,然后运行您的./configure命令。


-1

我有同样的问题。

我通过在终端中键入以下命令来解决它:

须藤apt-get install --reinstall build-essential

sudo apt-get install-重新安装gcc

sudo dpkg-reconfigure构建必需

须藤dpkg重新配置gcc

之后我没问题。


您确定这是同样的问题吗?奇怪的是,由于参数错误(在这种情况下为-O3的-03 intead),可以通过重新安装/重新配置解决问题。
Marc Vanhoomissen '17

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.