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

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

用过的

./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  

答案1

我猜你安装了基本的 C 编译器,但没有安装标准库的头文件。尝试:

sudo apt install libc6-dev

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

答案2

来自config.log

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

该选项-O3以字母为单位O,而不是数字0(零)。因此,您应该按照 README 中所述运行:

./configure CFLAGS="-O3"

答案3

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

答案4

您可以尝试安装 build-essential

sudo apt-get install build-essential

相关内容