Mac OS 默认C编译器是clang和gcc不兼容,安装phpredis扩展报错

发布于 2022-09-11 20:26:34 字数 15064 浏览 23 评论 0

问题描述

我系统上用brew install的gcc是9.1.1,但是phpize后默认找的cc是/usr/bin/cc

checking for cc... cc
checking whether the C compiler works... no
configure: error: in `/Users/ruibinhong/Downloads/softwares/phpredis':
configure: error: C compiler cannot create executables

问题出现的平台版本及自己尝试过哪些方法

相关代码

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

hostname = localhost
uname -m = x86_64
uname -r = 18.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 18.2.0: Fri Oct  5 19:40:55 PDT 2018; root:xnu-4903.221.2~1/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 18.2.0: Fri Oct  5 19:40:55 PDT 2018; root:xnu-4903.221.2~1/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: 369 tasks, 1732 threads, 4 processors
Load average: 1.89, Mach factor: 2.27
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/go/bin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /usr/local/bin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /usr/local/bin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /usr/local/bin


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

configure:2305: checking for grep that handles long lines and -e
configure:2363: result: /usr/bin/grep
configure:2368: checking for egrep
configure:2430: result: /usr/bin/grep -E
configure:2435: checking for a sed that does not truncate output
configure:2489: result: /usr/bin/sed
configure:2626: checking for cc
configure:2642: found /usr/bin/cc
configure:2653: result: cc
configure:2684: checking for C compiler version
configure:2693: cc --version >&5
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:2704: $? = 0
configure:2693: cc -v >&5
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:2704: $? = 0
configure:2693: cc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:2704: $? = 1
configure:2693: cc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:2704: $? = 1
configure:2724: checking whether the C compiler works
configure:2746: cc    conftest.c  >&5
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd:4:18: error: unknown enumerated scalar
platform:        zippered
                 ^~~~~~~~
 file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:2750: $? = 1
configure:2788: 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 ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2793: error: in `/Users/ruibinhong/Downloads/softwares/phpredis':
configure:2795: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

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_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_path_EGREP='/usr/bin/grep -E'
ac_cv_path_GREP=/usr/bin/grep
ac_cv_prog_ac_ct_CC=cc
lt_cv_path_SED=/usr/bin/sed

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

AR=''
AWK=''
CC='cc'
CFLAGS=''
CONFIGURE_COMMAND=' '\''./configure'\'' '
CONFIGURE_OPTIONS=''
CPP=''
CPPFLAGS=''
DEFS=''
DSYMUTIL=''
ECHO='/bin/echo'
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP='/usr/bin/grep -E'
EXEEXT=''
GIT=''
GREP='/usr/bin/grep'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LN_S=''
LTLIBOBJS=''
NMEDIT=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RE2C=''
SED='/usr/bin/sed'
SHELL='/bin/sh'
SHLIB_DL_SUFFIX_NAME=''
SHLIB_SUFFIX_NAME=''
STRIP=''
ac_ct_CC='cc'
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'
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=''
target_alias=''
target_cpu=''
target_os=''
target_vendor=''

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

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""

configure: exit 77
localhost:phpredis ruibinhong$ cat ~/.bash_profile
export GOROOT=/usr/local/go

export GOPATH=/Users/ruibinhong/go

export PATH=$PATH:${GOPATH//://bin:}/bin:/usr/local/Cellar/mtr/0.92/sbin:/usr/local/bin
export PATH="/usr/local/opt/php@7.2/bin:$PATH"
export PATH="/usr/local/opt/php@7.2/sbin:$PATH"
export PATH="/usr/local/Cellar/gcc/9.1.0/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/php@7.2/lib"
export CPPFLAGS="-I/usr/local/opt/php@7.2/include"

alias gcc='gcc-9'
alias cc='gcc-9'
alias g++='g++-9'
alias c++='c++-9'
localhost:phpredis ruibinhong$ cat ~/.bash_profile
export GOROOT=/usr/local/go

export GOPATH=/Users/ruibinhong/go

export PATH=$PATH:${GOPATH//://bin:}/bin:/usr/local/Cellar/mtr/0.92/sbin:/usr/local/bin
export PATH="/usr/local/opt/php@7.2/bin:$PATH"
export PATH="/usr/local/opt/php@7.2/sbin:$PATH"
export PATH="/usr/local/Cellar/gcc/9.1.0/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/php@7.2/lib"
export CPPFLAGS="-I/usr/local/opt/php@7.2/include"

alias gcc='gcc-9'
alias cc='gcc-9'
alias g++='g++-9'
alias c++='c++-9'
localhost:phpredis ruibinhong$ cat 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 configure, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure

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

hostname = localhost
uname -m = x86_64
uname -r = 18.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 18.2.0: Fri Oct  5 19:40:55 PDT 2018; root:xnu-4903.221.2~1/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 18.2.0: Fri Oct  5 19:40:55 PDT 2018; root:xnu-4903.221.2~1/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: 369 tasks, 1732 threads, 4 processors
Load average: 1.89, Mach factor: 2.27
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/Cellar/gcc/9.1.0/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/opt/php@7.2/sbin
PATH: /usr/local/opt/php@7.2/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /usr/local/go/bin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /usr/local/bin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /usr/local/bin
PATH: /Users/ruibinhong/go/bin
PATH: /usr/local/Cellar/mtr/0.92/sbin
PATH: /usr/local/bin


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

configure:2305: checking for grep that handles long lines and -e
configure:2363: result: /usr/bin/grep
configure:2368: checking for egrep
configure:2430: result: /usr/bin/grep -E
configure:2435: checking for a sed that does not truncate output
configure:2489: result: /usr/bin/sed
configure:2626: checking for cc
configure:2642: found /usr/bin/cc
configure:2653: result: cc
configure:2684: checking for C compiler version
configure:2693: cc --version >&5
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:2704: $? = 0
configure:2693: cc -v >&5
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
configure:2704: $? = 0
configure:2693: cc -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:2704: $? = 1
configure:2693: cc -qversion >&5
clang: error: unknown argument: '-qversion'
clang: error: no input files
configure:2704: $? = 1
configure:2724: checking whether the C compiler works
configure:2746: cc    conftest.c  >&5
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd:4:18: error: unknown enumerated scalar
platform:        zippered
                 ^~~~~~~~
 file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
configure:2750: $? = 1
configure:2788: 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 ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2793: error: in `/Users/ruibinhong/Downloads/softwares/phpredis':
configure:2795: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

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_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_path_EGREP='/usr/bin/grep -E'
ac_cv_path_GREP=/usr/bin/grep
ac_cv_prog_ac_ct_CC=cc
lt_cv_path_SED=/usr/bin/sed

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

AR=''
AWK=''
CC='cc'
CFLAGS=''
CONFIGURE_COMMAND=' '\''./configure'\'' '
CONFIGURE_OPTIONS=''
CPP=''
CPPFLAGS=''
DEFS=''
DSYMUTIL=''
ECHO='/bin/echo'
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP='/usr/bin/grep -E'
EXEEXT=''
GIT=''
GREP='/usr/bin/grep'
LDFLAGS=''
LIBOBJS=''
LIBS=''
LIBTOOL=''
LN_S=''
LTLIBOBJS=''
NMEDIT=''
OBJEXT=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
RANLIB=''
RE2C=''
SED='/usr/bin/sed'
SHELL='/bin/sh'
SHLIB_DL_SUFFIX_NAME=''
SHLIB_SUFFIX_NAME=''
STRIP=''
ac_ct_CC='cc'
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'
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=''
target_alias=''
target_cpu=''
target_os=''
target_vendor=''

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

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""

configure: exit 77

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

多像笑话 2022-09-18 20:26:34

那你装个docker嘛,在docker里面编译

感受沵的脚步 2022-09-18 20:26:34

大哥请问你这个问题是怎么解决的呢?我现在也遇到了这个问题,百思不得其解,望大哥指点一二

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文