C 编译器无法创建可执行文件 Ubuntu 16.04 gcc v9.3.0

C 编译器无法创建可执行文件 Ubuntu 16.04 gcc v9.3.0

我正在尝试运行我下载的库./configure的命令cmph_2.0。gcc 和 g++ 版本是9.3.0,我正在使用 Ubuntu 16.04。但是,我收到以下错误:

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

It was created by configure, which was
generated by GNU Autoconf 2.68.  Invocation command line was

  

    $ ./configure --prefix=/~/userB/cmph-2.0
    
    ## --------- ##
    ## Platform. ##
    ## --------- ##
    
    hostname = IIPC121
    uname -m = x86_64
    uname -r = 4.15.0-115-generic
    uname -s = Linux
    uname -v = #116~16.04.1-Ubuntu SMP Wed Aug 26 17:36:48 UTC 2020
    
    /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/cuda-9.0/bin
    PATH: /usr/local/cuda-9.0/bin
    PATH: /home/userA/bin
    PATH: /home/userA/.local/bin
    PATH: /usr/local/sbin
    PATH: /usr/local/bin
    PATH: /usr/sbin
    PATH: /usr/bin
    PATH: /sbin
    PATH: /bin
    PATH: /usr/games
    PATH: /usr/local/games
    PATH: /snap/bin
    PATH: /home/userA/kaldi/tools/irstlm/bin
    
    
    ## ----------- ##
    ## Core tests. ##
    ## ----------- ##
    
    configure:2367: checking for a BSD-compatible install
    configure:2435: result: /usr/bin/install -c
    configure:2446: checking whether build environment is sane
    configure:2496: result: yes
    configure:2637: checking for a thread-safe mkdir -p
    configure:2676: result: /bin/mkdir -p
    configure:2689: checking for gawk
    configure:2705: found /usr/bin/gawk
    configure:2716: result: gawk
    configure:2727: checking whether make sets $(MAKE)
    configure:2749: result: yes
    configure:2837: checking for gawk
    configure:2864: result: gawk
    configure:2923: checking for gcc
    configure:2939: found /usr/bin/gcc
    configure:2950: result: gcc
    configure:3179: checking for C compiler version
    configure:3188: gcc --version >&5
    gcc (Ubuntu 9.3.0-23ubuntu1~16.04) 9.3.0
    Copyright (C) 2019 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:3199: $? = 0
    configure:3188: gcc -v >&5
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
    OFFLOAD_TARGET_NAMES=nvptx-none:hsa
    OFFLOAD_TARGET_DEFAULT=1
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.3.0-23ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --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 --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --with-target-system-zlib=auto --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=/build/gcc-9-oatUX7/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa --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 9.3.0 (Ubuntu 9.3.0-23ubuntu1~16.04) 
    configure:3199: $? = 0
    configure:3188: gcc -V >&5
    gcc: error: unrecognized command line option '-V'
    gcc: fatal error: no input files
    compilation terminated.
    configure:3199: $? = 1
    configure:3188: gcc -qversion >&5
    gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
    gcc: fatal error: no input files
    compilation terminated.
    configure:3199: $? = 1
    configure:3219: checking whether the C compiler works
    configure:3241: gcc /include  /lib conftest.c  >&5
    gcc: error: /include: No such file or directory
    configure:3245: $? = 1
    configure:3283: result: no
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME ""
    | #define PACKAGE_TARNAME ""
    | #define PACKAGE_VERSION ""
    | #define PACKAGE_STRING ""
    | #define PACKAGE_BUGREPORT ""
    | #define PACKAGE_URL ""
    | #define PACKAGE "cmph"
    | #define VERSION "2.0"
    | /* end confdefs.h.  */
    | 
    | int
    | main ()
    | {
    | 
    |   ;
    |   return 0;
    | }
    configure:3288: error: in `/home/userA/userB/cmph-2.0':
    configure:3290: 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=set
    ac_cv_env_CFLAGS_value=/include
    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=set
    ac_cv_env_LDFLAGS_value=/lib
    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_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
    
    ## ----------------- ##
    ## Output variables. ##
    ## ----------------- ##
    
    ACLOCAL='${SHELL} /home/userA/userB/cmph-2.0/missing --run aclocal-1.11'
    AMDEPBACKSLASH=''
    AMDEP_FALSE=''
    AMDEP_TRUE=''
    AMTAR='${SHELL} /home/userA/userB/cmph-2.0/missing --run tar'
    AR=''
    AUTOCONF='${SHELL} /home/userA/userB/cmph-2.0/missing --run autoconf'
    AUTOHEADER='${SHELL} /home/userA/userB/cmph-2.0/missing --run autoheader'
    AUTOMAKE='${SHELL} /home/userA/userB/cmph-2.0/missing --run automake-1.11'
    AWK='gawk'
    CC='gcc'
    CCDEPMODE=''
    CFLAGS='/include'
    CHECK_CFLAGS=''
    CHECK_LIBS=''
    CPP=''
    CPPFLAGS=''
    CXX=''
    CXXCPP=''
    CXXDEPMODE=''
    CXXFLAGS=''
    CXXMPH=''
    CYGPATH_W='echo'
    DEFS=''
    DEPDIR=''
    DLLTOOL=''
    DSYMUTIL=''
    DUMPBIN=''
    ECHO_C=''
    ECHO_N='-n'
    ECHO_T=''
    EGREP=''
    EXEEXT=''
    FGREP=''
    GETCONF=''
    GREP=''
    INSTALL_DATA='${INSTALL} -m 644'
    INSTALL_PROGRAM='${INSTALL}'
    INSTALL_SCRIPT='${INSTALL}'
    INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
    LD=''
    LDFLAGS='/lib'
    LIBM=''
    LIBOBJS=''
    LIBS=''
    LIBTOOL=''
    LIPO=''
    LN_S=''
    LTLIBOBJS=''
    MAKEINFO='${SHELL} /home/userA/userB/cmph-2.0/missing --run makeinfo'
    MANIFEST_TOOL=''
    MKDIR_P='/bin/mkdir -p'
    NM=''
    NMEDIT=''
    OBJDUMP=''
    OBJEXT=''
    OTOOL64=''
    OTOOL=''
    PACKAGE='cmph'
    PACKAGE_BUGREPORT=''
    PACKAGE_NAME=''
    PACKAGE_STRING=''
    PACKAGE_TARNAME=''
    PACKAGE_URL=''
    PACKAGE_VERSION=''
    PATH_SEPARATOR=':'
    RANLIB=''
    SED=''
    SET_MAKE=''
    SHELL='/bin/bash'
    STRIP=''
    USE_CXXMPH_FALSE=''
    USE_CXXMPH_TRUE=''
    USE_LIBCHECK_FALSE=''
    USE_LIBCHECK_TRUE=''
    VERSION='2.0'
    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=''
    am__isrc=''
    am__leading_dot='.'
    am__quote=''
    am__tar='${AMTAR} chof - "$$tardir"'
    am__untar='${AMTAR} xf -'
    bindir='${exec_prefix}/bin'
    build=''
    build_alias=''
    build_cpu=''
    build_os=''
    build_vendor=''
    datadir='${datarootdir}'
    datarootdir='${prefix}/share'
    docdir='${datarootdir}/doc/${PACKAGE}'
    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} /home/userA/userB/cmph-2.0/install-sh'
    libdir='${exec_prefix}/lib'
    libexecdir='${exec_prefix}/libexec'
    localedir='${datarootdir}/locale'
    localstatedir='${prefix}/var'
    mandir='${datarootdir}/man'
    mkdir_p='/bin/mkdir -p'
    oldincludedir='/usr/include'
    pdfdir='${docdir}'
    prefix='/~/userB/cmph-2.0'
    program_transform_name='s,x,x,'
    psdir='${docdir}'
    sbindir='${exec_prefix}/sbin'
    sharedstatedir='${prefix}/com'
    sysconfdir='${prefix}/etc'
    target_alias=''
    
    ## ----------- ##
    ## confdefs.h. ##
    ## ----------- ##
    
    /* confdefs.h */
    #define PACKAGE_NAME ""
    #define PACKAGE_TARNAME ""
    #define PACKAGE_VERSION ""
    #define PACKAGE_STRING ""
    #define PACKAGE_BUGREPORT ""
    #define PACKAGE_URL ""
    #define PACKAGE "cmph"
    #define VERSION "2.0"
    
    configure: exit 77

答案1

回答保罗·汤布林为我做了。

您需要安装 C 的 perl 库。如果您使用的是基于 Debian 的系统(包括 Ubuntu),sudo apt-get install libperl-dev 或类似命令可能就足够了,具体取决于您使用的 perl 版本。

原来我没有这个库;我用sudo apt install libperl-dev

答案2

问题可能并不是 C 编译器无法创建可执行文件,而是它无法创建可执行文件使用给定的参数

尤其,

configure:3241: gcc /include  /lib conftest.c  >&5

gcc /include /lib conftest.c显示 configure 脚本正在执行毫无意义的命令:gcc将非选项参数视为源代码文件。可能应该是这样,gcc -I/include -L/lib conftest.c这更有意义一点,只是/include/lib可能已经分别位于编译器的内置搜索路径中,用于包含文件和库(您可以使用 确认这一点gcc --print-search-dirs)。

由于 autoconf 宏的扩展,参数进入到 configure 脚本中ac_link

ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'

其中变量CXXCXXFLAGSCPPFLAGS和将从同名的环境变量(如果存在)中初始化。LDFLAGS因此LIBS

  • 如果您尝试将这些变量的值传递给脚本,那么您做错了,必须纠正它(例如,在值的-I前面添加)/includeCFLAGS

  • 如果你是不是尝试传递变量的值,然后通过取消设置或取消导出来将它们从环境中彻底清除。在 bash shell 中,您可以在运行脚本之前使用export -nex.执行后者。export -n CFLAGS LDFLAGS./configure

答案3

Ubuntu 16.04,构建示例cmph-2.0.2...系统编译器是gcc-5/g++-5.......gcc-9.3.0用于构建 cmph2。

$ sudo apt install autoconf libtool

gcc93-c++_9.3.0-16_amd64.debhttps://drive.google.com/drive/folders/1xVEATaYAwqvseBzYxKDzJoZ4-Hc_XOJm?usp=sharing

wget http://archive.ubuntu.com/ubuntu/pool/universe/c/cmph/cmph_2.0.2.orig.tar.gz
tar xvf cmph_2.0.2.orig.tar.gz
cd cmph_2.0.2/
wget http://archive.ubuntu.com/ubuntu/pool/universe/c/cmph/cmph_2.0.2-2.debian.tar.xz
tar xvf cmph_2.0.2-2.debian.tar.xz
patch -p1 < debian/patches/stdout_not_stderr.patch
libtoolize && aclocal && autoheader && automake --add-missing && autoconf 
export CC=gcc93 CXX=g++93 && ./configure --prefix=/home/knudfl/tmp1/cmph-2.0.2/usr
make                   ## No errors
make install

相关内容