C编译器无法创建可执行文件


9

我正在尝试在Linux Mint 17.1上安装wine。我以./configured为根目录进行安装。

输入:

cd Downloads/wine-1.6.2
./configure

输出:

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/(my username)/Downloads/wine-1.6.2':
configure: error: C compiler cannot create executables
See `config.log' for more details

config.log:此文件包含编译器在运行configure时生成的所有消息,以帮助在configure出错时进行调试。

    It was created by Wine configure 1.6.2, which was
    generated by GNU Autoconf 2.69.  Invocation command line was

      $ ./configure 

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

    hostname = Math2
    uname -m = x86_64
    uname -r = 3.13.0-37-generic
    uname -s = Linux
    uname -v = #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014

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


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

    configure:2879: checking build system type
    configure:2893: result: x86_64-unknown-linux-gnu
    configure:2913: checking host system type
    configure:2926: result: x86_64-unknown-linux-gnu
    configure:2956: checking whether make sets $(MAKE)
    configure:2978: result: yes
    configure:3035: checking for gcc
    configure:3051: found /usr/bin/gcc
    configure:3062: result: gcc
    configure:3291: checking for C compiler version
    configure:3300: gcc --version >&5
    gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
    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:3311: $? = 0
    configure:3300: gcc -v >&5
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
    Target: x86_64-linux-gnu
    Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --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
    Thread model: posix
    gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) 
    configure:3311: $? = 0
    configure:3300: gcc -V >&5
    gcc: error: unrecognized command line option '-V'
    gcc: fatal error: no input files
    compilation terminated.
    configure:3311: $? = 4
    configure:3300: gcc -qversion >&5
    gcc: error: unrecognized command line option '-qversion'
    gcc: fatal error: no input files
    compilation terminated.
    configure:3311: $? = 4
    configure:3331: checking whether the C compiler works
    configure:3353: gcc    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:3357: $? = 1
    configure:3395: result: no
    configure: failed program was:
    | /* confdefs.h */
    | #define PACKAGE_NAME "Wine"
    | #define PACKAGE_TARNAME "wine"
    | #define PACKAGE_VERSION "1.6.2"
    | #define PACKAGE_STRING "Wine 1.6.2"
    | #define PACKAGE_BUGREPORT "wine-devel@winehq.org"
    | #define PACKAGE_URL "http://www.winehq.org"
    | /* end confdefs.h.  */
    | 
    | int
    | main ()
    | {
    | 
    |   ;
    |   return 0;
    | }
    configure:3400: error: in `/home/(my username)/Desktop/Other_Games/wine-1.6.2':
    configure:3402: 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_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_CXXFLAGS_set=
    ac_cv_env_CXXFLAGS_value=
    ac_cv_env_CXX_set=
    ac_cv_env_CXX_value=
    ac_cv_env_DBUS_CFLAGS_set=
    ac_cv_env_DBUS_CFLAGS_value=
    ac_cv_env_DBUS_LIBS_set=
    ac_cv_env_DBUS_LIBS_value=
    ac_cv_env_FREETYPE_CFLAGS_set=
    ac_cv_env_FREETYPE_CFLAGS_value=
    ac_cv_env_FREETYPE_LIBS_set=
    ac_cv_env_FREETYPE_LIBS_value=
    ac_cv_env_GNUTLS_CFLAGS_set=
    ac_cv_env_GNUTLS_LIBS_value=
    ac_cv_env_GPHOTO2_CFLAGS_set=
    ac_cv_env_GPHOTO2_CFLAGS_value=
    ac_cv_env_GPHOTO2_LIBS_set=
    ac_cv_env_GPHOTO2_LIBS_value=
    ac_cv_env_GPHOTO2_PORT_CFLAGS_set=
    ac_cv_env_GPHOTO2_PORT_CFLAGS_value=
    ac_cv_env_GPHOTO2_PORT_LIBS_set=
    ac_cv_env_GPHOTO2_PORT_LIBS_value=
    ac_cv_env_GSTREAMER_CFLAGS_set=
    ac_cv_env_GSTREAMER_CFLAGS_value=
    ac_cv_env_GSTREAMER_LIBS_set=
    ac_cv_env_GSTREAMER_LIBS_value=
    ac_cv_env_HAL_CFLAGS_set=
    ac_cv_env_HAL_CFLAGS_value=
    ac_cv_env_HAL_LIBS_set=
    ac_cv_env_HAL_LIBS_value=
    ac_cv_env_LCMS2_CFLAGS_set=
    ac_cv_env_LCMS2_CFLAGS_value=
    ac_cv_env_LCMS2_LIBS_set=
    ac_cv_env_LCMS2_LIBS_value=
    ac_cv_env_LDFLAGS_set=
    ac_cv_env_LDFLAGS_value=
    ac_cv_env_LIBS_set=
    ac_cv_env_LIBS_value=
    ac_cv_env_PNG_CFLAGS_set=
    ac_cv_env_PNG_CFLAGS_value=
    ac_cv_env_PNG_LIBS_set=
    ac_cv_env_PNG_LIBS_value=
    ac_cv_env_SANE_CFLAGS_set=
    ac_cv_env_SANE_CFLAGS_value=
    ac_cv_env_SANE_LIBS_set=
    ac_cv_env_SANE_LIBS_value=
    ac_cv_env_XMKMF_set=
    ac_cv_env_XMKMF_value=
    ac_cv_env_XML2_CFLAGS_set=
    ac_cv_env_XML2_CFLAGS_value=
    ac_cv_env_XML2_LIBS_set=
    ac_cv_env_XML2_LIBS_value=
    ac_cv_env_XSLT_CFLAGS_set=
    ac_cv_env_XSLT_CFLAGS_value=
    ac_cv_env_XSLT_LIBS_set=
    ac_cv_env_XSLT_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
    ac_cv_prog_make_make_set=yes

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

    ALL_TEST_RESOURCES=''
    ALSALIBS=''
    APPKITLIB=''
    APPLICATIONSERVICESLIB=''
    AR=''
    ARFLAGS=''
    BISON=''
    BUILTINFLAG=''
    CARBONLIB=''
    CC='gcc'
    CFLAGS=''
    CONVERT=''
    COREAUDIO=''
    COREFOUNDATIONLIB=''
    CORESERVICESLIB=''
    CPP=''
    CPPBIN=''
    CPPFLAGS=''
    CROSSCC=''
    CROSSTARGET=''
    CROSSTEST_DISABLE=''
    CUPSINCL=''
    CXX=''
    CXXFLAGS=''
    DBUS_CFLAGS=''
    DBUS_LIBS=''
    DEFS=''
    DISKARBITRATIONLIB=''
    DLLEXT=''
    DLLFLAGS=''
    DLLTOOL=''
    ECHO_C=''
    ECHO_N='-n'
    ECHO_T=''
    EGREP=''
    EXEEXT=''
    EXTRACFLAGS=''
    EXTRA_BINARIES=''
    FLEX=''
    FONTCONFIGINCL=''
    FONTFORGE=''
    FORCEFEEDBACKLIB=''
    FRAMEWORK_OPENAL=''
    FREETYPE_CFLAGS=''
    FREETYPE_LIBS=''
    GNUTLS_CFLAGS=''
    GNUTLS_LIBS=''
    GPHOTO2_CFLAGS=''
    GPHOTO2_LIBS=''
    GPHOTO2_PORT_CFLAGS=''
    GPHOTO2_PORT_LIBS=''
    GREP=''
    GSTREAMER_CFLAGS=''
    GSTREAMER_LIBS=''
    HAL_CFLAGS=''
    HAL_LIBS=''
    ICOTOOL=''
    IMPLIBEXT=''
    INSTALL_DATA=''
    INSTALL_PROGRAM=''
    INSTALL_SCRIPT=''
    IOKITLIB=''
    LCMS2_CFLAGS=''
    LCMS2_LIBS=''
    LDAPLIBS=''
    LDCONFIG=''
    LDD=''
    LDDLLFLAGS=''
    LDEXECFLAGS=''
    LDFLAGS=''
    LDPATH=''
    LDRPATH_INSTALL=''
    LDRPATH_LOCAL=''
    LIBDL=''
    LIBGETTEXTPO=''
    LIBKSTAT=''
    LIBMPG123=''
    LIBOBJS=''
    LIBOPENAL=''
    LIBOPENCL=''
    LIBPOLL=''
    LIBPTHREAD=''
    LIBRT=''
    LIBS=''
    LIBWINE_RULES=''
    LINGUAS=''
    LINT=''
    LINTFLAGS=''
    LN_S=''
    LTLIBOBJS=''
    MAINTAINER_MODE=''
    MAIN_BINARY=''
    MSGFMT=''
    OBJEXT=''
    OPENGL_LIBS=''
    OSS4INCL=''
    PACKAGE_BUGREPORT='wine-devel@winehq.org'
    PACKAGE_NAME='Wine'
    PACKAGE_STRING='Wine 1.6.2'
    PACKAGE_TARNAME='wine'
    PACKAGE_URL='http://www.winehq.org'
    PACKAGE_VERSION='1.6.2'
    PATH_SEPARATOR=':'
    PKG_CONFIG=''
    PNG_CFLAGS=''
    PNG_LIBS=''
    PORCFLAGS=''
    PRELINK=''
    QUICKTIMELIB=''
    RANLIB=''
    READELF=''
    RESOLVLIBS=''
    RSVG=''
    SANE_CFLAGS=''
    SANE_LIBS=''
    SECURITYLIB=''
    SET_MAKE=''
    SHELL='/bin/bash'
    SOCKETLIBS=''
    TARGETFLAGS=''
    TOOLSDIR=''
    TOOLSEXT=''
    UNWINDFLAGS=''
    WOW64_DISABLE=''
    XLIB=''
    XMKMF=''
    XML2_CFLAGS=''
    XML2_LIBS=''
    XSLT_CFLAGS=''
    XSLT_LIBS=''
    X_CFLAGS=''
    X_EXTRA_LIBS=''
    X_LIBS=''
    X_PRE_LIBS=''
    ZLIB=''
    ac_ct_AR=''
    ac_ct_CC='gcc'
    ac_ct_CXX=''
    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=''

    ## ------------------- ##
    ## File substitutions. ##
    ## ------------------- ##

    MAKE_DLL_RULES=''
    MAKE_IMPLIB_RULES=''
    MAKE_PROG_RULES=''
    MAKE_RULES=''
    MAKE_TEST_RULES=''

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

    /* confdefs.h */
    #define PACKAGE_NAME "Wine"
    #define PACKAGE_TARNAME "wine"
    #define PACKAGE_VERSION "1.6.2"
    #define PACKAGE_STRING "Wine 1.6.2"
    #define PACKAGE_BUGREPORT "wine-devel@winehq.org"
    #define PACKAGE_URL "http://www.winehq.org"

    configure: exit 77

    (END)

我潜伏在这里和互联网的其他地方,找不到运气的答案,所以我在这里。


2
如果创建一个琐碎的C程序foo.c并说出来会gcc foo.c怎样?如果失败了,那就是您的问题,您应该将问题重点放在此问题上(不要介意您正在尝试安装wine的事实)。如果gcc成功,您应该在问题中提到这一点。
G-Man说'恢复莫妮卡'

2
自己进行编译非常有帮助...尤其是当它成为组编译对象时,因为OP并不了解他在做什么(有一个线索,需要进行实际的修改和理解)...但是,总有很多人可用回答问题。这虽然当问题其实并不是真正的问题所在丢人...

Answers:


17

不用担心这些错误:

 gcc: error: unrecognized command line option '-V'

gcc: error: unrecognized command line option '-qversion'

这些是不成功的探测,但configure脚本会坚持不懈。

不必担心这些:

/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

这些文件是libc6-dev软件包的一部分,是构建任何类型的常规可执行文件所必需的。您可能缺少该软件包。尝试安装它(如果已经安装,则重新安装-可能已损坏)。

更好的是,安装build-essential软件包。这是一个元数据包,它将提取所有用于编译事物的基本要点。


1
build-essential是正确的方法
2015年

4
@ eyoung100问题为什么编译源失败。答案不可能是“不要这样做,请使用二进制文件”。也许他想设置不同的构建选项。也许他想打补丁。也许他只是想学习如何构建它。
abligh

1个基本构建需求
ZZ9

13

首先,不要将其构建为root。通常,sudo只有在将其安装到系统中的最后一步时才需要root特权。

./configure
make
sudo make install

根据所述config.log,您无法构建可执行文件,因为您的系统上缺少libc和其他库。在基于Debian的系统上,您可以通过运行以下命令安装必要的工具和库:

sudo apt-get install build-essential

除此之外,您还需要各种有关Win32 / Win64的依赖项和复杂的设置来自己构建Wine,这是相当困难的。在这里那里仔细阅读开发人员的文档。您可以找到建议的Ubuntu方法。


0

您可能设置了无法识别的CFLAGS。

尝试使用

export CFLAGS="-march=native -O2 -pipe"

在运行./configure之前


-1

经过一番谷歌搜索...

尝试这个:

sudo apt-get install clang
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.