每次我尝试编译configure sh时,都会收到此错误。哪个不重要。
我安装并重新安装了g ++和cpp以及其他许多。这是一个想法:
echo "void main(){printf(\"hello world\n\");}" |gcc -x c - -o /tmp/hello;/tmp/hello
<stdin>: In function ‘main’:
<stdin>:1:13: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
<stdin>:1:13: warning: incompatible implicit declaration of built-in function ‘printf’
<stdin>:1:13: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
bash: /tmp/hello: No such file or directory
来自其中一个文件的config.log。
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
configure:555: checking host system type
configure:577: checking host specific optimization flag
configure:593: checking for gcc
configure:706: checking whether the C compiler (gcc -O6 -fomit frame-pointer ) wor$
configure:722: gcc -o conftest -O6 -fomit-frame-pointer conftest.c 1>&5
configure:719:1: warning: return type defaults to 'int' [-Wimplicit-int]
main(){return(0);}
^~~~
/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
configure: failed program was:
#line 717 "configure"
这是另一个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 OpenFst configure 1.6.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ configure
## --------- ##
## Platform. ##
## --------- ##
hostname = CybernetiX
uname -m = x86_64
uname -r = 4.14.0-kali1-amd64
uname -s = Linux
uname -v = #1 SMP Debian 4.14.2-1kali1 (2017-12-04)
/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
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2373: checking for a BSD-compatible install
configure:2441: result: /usr/bin/install -c
configure:2452: checking whether build environment is sane
configure:2507: result: yes
configure:2658: checking for a thread-safe mkdir -p
configure:2697: result: /bin/mkdir -p
configure:2704: checking for gawk
configure:2720: found /usr/bin/gawk
configure:2731: result: gawk
configure:2742: checking whether make sets $(MAKE)
configure:2764: result: yes
configure:2793: checking whether make supports nested variables
configure:2810: result: yes
configure:2947: checking for style of include used by make
configure:2975: result: GNU
configure:3046: checking for gcc
configure:3062: found /usr/bin/gcc
configure:3073: result: gcc
configure:3302: checking for C compiler version
configure:3311: gcc --version >&5
gcc (Debian 7.2.0-18) 7.2.0
Copyright (C) 2017 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:3322: $? = 0
configure:3311: gcc -v >&5
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 7.2.0-18' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.2.0 (Debian 7.2.0-18)
configure:3322: $? = 0
configure:3311: gcc -V >&5
gcc: error: unrecognized command line option '-V'
gcc: fatal error: no input files
compilation terminated.
configure:3322: $? = 1
configure:3311: gcc -qversion >&5
gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
gcc: fatal error: no input files
compilation terminated.
configure:3322: $? = 1
configure:3342: checking whether the C compiler works
configure:3364: gcc conftest.c >&5
/usr/local/bin/ld: this linker was not configured to use sysroots
collect2: error: ld returned 1 exit status
configure:3368: $? = 1
configure:3406: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "OpenFst"
| #define PACKAGE_TARNAME "openfst"
| #define PACKAGE_VERSION "1.6.5"
| #define PACKAGE_STRING "OpenFst 1.6.5"
| #define PACKAGE_BUGREPORT "help@www.openfst.org"
| #define PACKAGE_URL ""
| #define PACKAGE "openfst"
| #define VERSION "1.6.5"
| /* end confdefs.h. */
|
| int
| main ()
| {
|
| ;
| return 0;
| }
configure:3411: error: in `/root/Downloads/openfst-1.6.5':
configure:3413: error: C compiler cannot create executables
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
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_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_PYTHON_VERSION_set=
ac_cv_env_PYTHON_VERSION_value=
ac_cv_env_PYTHON_set=
ac_cv_env_PYTHON_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_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
am_cv_make_support_nested_variables=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='${SHELL} /root/Downloads/openfst-1.6.5/missing aclocal-1.14'
AMDEPBACKSLASH='\'
AMDEP_FALSE='#'
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
AR=''
AUTOCONF='${SHELL} /root/Downloads/openfst-1.6.5/missing autoconf'
AUTOHEADER='${SHELL} /root/Downloads/openfst-1.6.5/missing autoheader'
AUTOMAKE='${SHELL} /root/Downloads/openfst-1.6.5/missing automake-1.14'
AWK='gawk'
CC='gcc'
CCDEPMODE=''
CFLAGS=''
CPP=''
CPPFLAGS=''
CXX=''
CXXCPP=''
CXXDEPMODE=''
CXXFLAGS=''
CYGPATH_W='echo'
DEFS=''
DEPDIR='.deps'
DLLTOOL=''
DL_LIBS=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GREP=''
HAVE_BIN_FALSE=''
HAVE_BIN_TRUE=''
HAVE_COMPACT_FALSE=''
HAVE_COMPACT_TRUE=''
HAVE_COMPRESS_FALSE=''
HAVE_COMPRESS_TRUE=''
HAVE_CONST_FALSE=''
HAVE_CONST_TRUE=''
HAVE_FAR_FALSE=''
HAVE_FAR_TRUE=''
HAVE_GRM_FALSE=''
HAVE_GRM_TRUE=''
HAVE_LINEAR_FALSE=''
HAVE_LINEAR_TRUE=''
HAVE_LOOKAHEAD_FALSE=''
HAVE_LOOKAHEAD_TRUE=''
HAVE_MPDT_FALSE=''
HAVE_MPDT_TRUE=''
HAVE_NGRAM_FALSE=''
HAVE_NGRAM_TRUE=''
HAVE_PDT_FALSE=''
HAVE_PDT_TRUE=''
HAVE_PYTHON_FALSE=''
HAVE_PYTHON_TRUE=''
HAVE_SCRIPT_FALSE=''
HAVE_SCRIPT_TRUE=''
HAVE_SPECIAL_FALSE=''
HAVE_SPECIAL_TRUE=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
MAKEINFO='${SHELL} /root/Downloads/openfst-1.6.5/missing makeinfo'
MANIFEST_TOOL=''
MKDIR_P='/bin/mkdir -p'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='openfst'
PACKAGE_BUGREPORT='help@www.openfst.org'
PACKAGE_NAME='OpenFst'
PACKAGE_STRING='OpenFst 1.6.5'
PACKAGE_TARNAME='openfst'
PACKAGE_URL=''
PACKAGE_VERSION='1.6.5'
PATH_SEPARATOR=':'
PYTHON=''
PYTHON_CPPFLAGS=''
PYTHON_EXEC_PREFIX=''
PYTHON_EXTRA_LDFLAGS=''
PYTHON_EXTRA_LIBS=''
PYTHON_LDFLAGS=''
PYTHON_PLATFORM=''
PYTHON_PREFIX=''
PYTHON_SITE_PKG=''
PYTHON_VERSION=''
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
VERSION='1.6.5'
ac_ct_AR=''
ac_ct_CC='gcc'
ac_ct_CXX=''
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__fastdepCXX_FALSE=''
am__fastdepCXX_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=''
build_alias=''
build_cpu=''
build_os=''
build_vendor=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host=''
host_alias=''
host_cpu=''
host_os=''
host_vendor=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /root/Downloads/openfst-1.6.5/install-sh'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
libfstdir=''
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='/usr/include'
pdfdir='${docdir}'
pkgpyexecdir=''
pkgpythondir=''
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
pyexecdir=''
pythondir=''
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define PACKAGE_NAME "OpenFst"
#define PACKAGE_TARNAME "openfst"
#define PACKAGE_VERSION "1.6.5"
#define PACKAGE_STRING "OpenFst 1.6.5"
#define PACKAGE_BUGREPORT "help@www.openfst.org"
#define PACKAGE_URL ""
#define PACKAGE "openfst"
#define VERSION "1.6.5"
configure: exit 77"
投票 0 投票 接受
root @ CybernetiX:〜/ Downloads / julius-4.3.1 #bash配置加载缓存./config.cache检查主机系统类型... x86_64-unknown-linux-gnu检查主机特定优化标志...支持/ cflags.x86_64-unknown-linux-gnu检查gcc ... gcc检查C编译器(gcc -O6 -fomit-frame-pointer)是否正常工作...没有配置:错误:安装或配置问题:C编译器无法创建可执行文件。答案 0 :(得分:0)
您使用自定义链接器(ld)吗?看来是这样的(/ usr / local / bin / ld)。 Gcc将一些选项传递给链接器(在本例中为--sysroot),链接器不支持它们。您必须重建binutils(链接器来自哪里)或将一些选项传递给gcc(我不知道是什么)。在Web上搜索有关链接器的错误消息。
答案 1 :(得分:-1)
该行
echo "void main(){printf(\"hello world\n\");}" |gcc -x c - -o /tmp/hello;/tmp/hello
将在第一个声明中失败
gcc -x c - -o /tmp/hello
,因为
void main(){
printf("hello world\n");
}
不是有效的c或c ++代码。因此没有生成可执行文件,因此没有可执行文件(/tmp/hello
)。
我能想到的最简单的有效(shell嵌入式)c代码将会有
echo "#include <stdio.h>
int main(int argc, char* argv[]) {printf(\"hello world\n\");}" |
gcc -std=c99 -Wall -pedantic -x c - -o /tmp/hello; /tmp/hello
请参阅Live Demo