MacOS:配置:错误:C 编译器无法创建可执行文件
Posted
技术标签:
【中文标题】MacOS:配置:错误:C 编译器无法创建可执行文件【英文标题】:MacOS: configure: error: C compiler cannot create executables 【发布时间】:2017-03-11 13:59:09 【问题描述】:我正在尝试在我的 Macbookd 上安装 opensmile,但遇到以下错误:
配置:错误:C 编译器无法创建可执行文件
我安装了 Xcode 8.2.1。我已经在 *** 上尝试了一些类似主题的答案,但到目前为止没有任何帮助。
/opt/local/bin/port select --list gcc 给我:
gcc 的可用版本: mp-gcc47(主动) 没有
这里是configure.log:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by openSMILE configure 2.3.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --without-portaudio --prefix=/Applications/opensmile/inst --enable-static --enable-shared=no
## --------- ##
## Platform. ##
## --------- ##
hostname = Alexanders-MacBook-Pro.local
uname -m = x86_64
uname -r = 16.4.0
uname -s = Darwin
uname -v = Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
Kernel configured for up to 4 processors.
2 processors are physically available.
4 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3
Primary memory available: 8.00 gigabytes
Default processor set: 276 tasks, 1628 threads, 4 processors
Load average: 2.33, Mach factor: 1.72
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
PATH: /Applications/Xcode.app/Contents/Developer/usr/bin
PATH: /Library/Frameworks/Python.framework/Versions/2.7/bin
PATH: /opt/local/bin
PATH: /opt/local/sbin
PATH: /Library/Frameworks/Python.framework/Versions/2.7/bin
PATH: //anaconda/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /opt/X11/bin
PATH: /usr/local/git/bin
PATH: /Library/TeX/texbin
PATH: /Users/Alex/java
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2496: checking for a BSD-compatible install
configure:2564: result: /usr/bin/install -c
configure:2575: checking whether build environment is sane
configure:2630: result: yes
configure:2781: checking for a thread-safe mkdir -p
configure:2820: result: ./install-sh -c -d
configure:2827: checking for gawk
configure:2843: found /usr/local/bin/gawk
configure:2854: result: gawk
configure:2865: checking whether make sets $(MAKE)
configure:2887: result: yes
configure:2916: checking whether make supports nested variables
configure:2933: result: yes
configure:3110: checking for gcc
configure:3137: result: /usr/local/bin/gcc-4.2
configure:3366: checking for C compiler version
configure:3375: /usr/local/bin/gcc-4.2 --version >&5
i686-apple-darwin11-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 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.
couldn't understand kern.osversion `16.4.0'
configure:3386: $? = 0
configure:3375: /usr/local/bin/gcc-4.2 -v >&5
couldn't understand kern.osversion `16.4.0'
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /Volumes/Media/Builds/gcc-5666.3/build/obj/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++,fortran --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)
configure:3386: $? = 0
configure:3375: /usr/local/bin/gcc-4.2 -V >&5
gcc-4.2: argument to `-V' is missing
configure:3386: $? = 1
configure:3375: /usr/local/bin/gcc-4.2 -qversion >&5
couldn't understand kern.osversion `16.4.0'
i686-apple-darwin11-gcc-4.2.1: no input files
configure:3386: $? = 1
configure:3406: checking whether the C compiler works
configure:3428: /usr/local/bin/gcc-4.2 -O2 -mfpmath=sse -msse2 -D__STATIC_LINK -DOPENSMILE_BUILD -DBUILD_SVMSMO -DBUILD_SVMSMO -DBUILD_LIBSVM -DBUILD_RNN -DBUILD_WITHOUT_EXPERIMENTAL -lrt -lm -lpthread -lc conftest.c >&5
couldn't understand kern.osversion `16.4.0'
ld: library not found for -lrt
collect2: ld returned 1 exit status
configure:3432: $? = 1
configure:3470: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "openSMILE"
| #define PACKAGE_TARNAME "opensmile"
| #define PACKAGE_VERSION "2.3.0"
| #define PACKAGE_STRING "openSMILE 2.3.0"
| #define PACKAGE_BUGREPORT ""
| #define PACKAGE_URL ""
| #define PACKAGE "opensmile"
| #define VERSION "2.3.0"
| /* end confdefs.h. */
|
| int
| main ()
|
|
| ;
| return 0;
|
configure:3475: error: in `/Applications/opensmile':
configure:3477: 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=set
ac_cv_env_CC_value=/usr/local/bin/gcc-4.2
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-O2 -mfpmath=sse -msse2'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='-D__STATIC_LINK -DOPENSMILE_BUILD -DBUILD_SVMSMO -DBUILD_SVMSMO -DBUILD_LIBSVM -DBUILD_RNN -DBUILD_WITHOUT_EXPERIMENTAL'
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=set
ac_cv_env_CXXFLAGS_value='-O2 -mfpmath=sse -msse2'
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-lrt -lm -lpthread -lc'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_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_prog_AWK=gawk
ac_cv_prog_ac_ct_CC=/usr/local/bin/gcc-4.2
ac_cv_prog_make_make_set=yes
am_cv_make_support_nested_variables=yes
## ----------------- ##
## Output variables. ##
## ----------------- ##
ACLOCAL='$SHELL /Applications/opensmile/missing aclocal-1.15'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='$$TAR-tar'
AM_BACKSLASH='\'
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='1'
AM_V='$(V)'
android_LDFLAGS=''
AR=''
AUTOCONF='$SHELL /Applications/opensmile/missing autoconf'
AUTOHEADER='$SHELL /Applications/opensmile/missing autoheader'
AUTOMAKE='$SHELL /Applications/opensmile/missing automake-1.15'
AWK='gawk'
BUILD_SMILExtract_FALSE=''
BUILD_SMILExtract_TRUE=''
CC='/usr/local/bin/gcc-4.2'
CCDEPMODE=''
CFLAGS='-O2 -mfpmath=sse -msse2'
CPP=''
CPPFLAGS='-D__STATIC_LINK -DOPENSMILE_BUILD -DBUILD_SVMSMO -DBUILD_SVMSMO -DBUILD_LIBSVM -DBUILD_RNN -DBUILD_WITHOUT_EXPERIMENTAL'
CXX=''
CXXCPP=''
CXXDEPMODE=''
CXXFLAGS='-O2 -mfpmath=sse -msse2'
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
DLIB=''
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
EXEEXT=''
FGREP=''
GREP=''
INSTALL_DATA='$INSTALL -m 644'
INSTALL_PROGRAM='$INSTALL'
INSTALL_SCRIPT='$INSTALL'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD=''
LDFLAGS='-lrt -lm -lpthread -lc'
LIBOBJS=''
LIBS=''
LIBTOOL=''
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
MAKEINFO='$SHELL /Applications/opensmile/missing makeinfo'
MANIFEST_TOOL=''
MKDIR_P='./install-sh -c -d'
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OPENCV_CPPFLAGS=''
OPENCV_LDFLAGS=''
OPENCV_ROOT=''
OTOOL64=''
OTOOL=''
PACKAGE='opensmile'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='openSMILE'
PACKAGE_STRING='openSMILE 2.3.0'
PACKAGE_TARNAME='opensmile'
PACKAGE_URL=''
PACKAGE_VERSION='2.3.0'
PATH_SEPARATOR=':'
PORTAUDIO_CPPFLAGS=''
PORTAUDIO_LDFLAGS=''
PORTAUDIO_ROOT=''
PTHREAD_CC=''
PTHREAD_CFLAGS=''
PTHREAD_LIBS=''
RANLIB=''
SED=''
SET_MAKE=''
SHELL='/bin/sh'
STRIP=''
VERSION='2.3.0'
ac_ct_AR=''
ac_ct_CC='/usr/local/bin/gcc-4.2'
ac_ct_CXX=''
ac_ct_DUMPBIN=''
acx_pthread_config=''
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__nodep=''
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 /Applications/opensmile/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'
prefix='/Applications/opensmile/inst'
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 "openSMILE"
#define PACKAGE_TARNAME "opensmile"
#define PACKAGE_VERSION "2.3.0"
#define PACKAGE_STRING "openSMILE 2.3.0"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "opensmile"
#define VERSION "2.3.0"
configure: exit 77
【问题讨论】:
您提到了 XCode,但您没有使用 XCode 编译器 (cc)。我 Mac 上的版本是 clang-800.0.42.1。您正在使用 MacPorts 安装 gcc。你确定要这样做吗?你最近更新了 MacPorts 吗? 对我来说,我使用哪个编译器并不重要。我只想要一个有效的。我在安装 gcc 47 之前更新了 MacPort 配置脚本在沟通错误方面通常很糟糕。看看最后一次调用,它失败了:ld: library not found for -lrt
。所以要么你需要那个库,要么你需要说服configure
不要去寻找它。
这里有人为openSMILE
编写了brew
脚本,也许您可以复制他们的一些标志或选项以使其工作? https://gist.github.com/hbuschme/6456249
也许从homebrew
安装autotools
、gcc
等?这就是我安装的,它似乎工作(见下面我的回答)。
【参考方案1】:
librt
似乎丢失了,这在 MacOS 上不存在。 openSMILE
目前似乎在该平台上不受官方支持。
无论如何,你需要做以下事情来构建它:
➜ sed -i -e 's/-lrt//' buildStandalone.sh
➜ ./buildStandalone.sh
【讨论】:
./configure --without-portaudio --enable-static --enable-shared=no 1>/dev/null 给我:无法理解 kern.osversion `16.4.0' @mbpro 你确定你的编译器是最新的吗?尝试运行xcode-select --install
或 brew update && brew upgrade
,具体取决于您安装它的位置。
我都检查了,两者都是最新的。我还检查了我的 PATH 和 /usr/local/bin (自制的 gcc 应该在哪里)。
“sed”命令也将修复 buildWithPortAudio.sh 文件。谢谢,@cfromme!以上是关于MacOS:配置:错误:C 编译器无法创建可执行文件的主要内容,如果未能解决你的问题,请参考以下文章