簡體   English   中英

在 Mac M1 上安裝最新版本的 Ruby 時編譯器不工作

[英]Compiler not working when installing latest version of Ruby on Mac M1

我正在嘗試在我的 mac m1 上安裝 Jekyll,但我不能,因為 Ruby m1 mac 不是最新的。 我正在嘗試將 Ruby 更新為 3.2.0 或任何可用的版本,但出現以下情況:

checking whether the C compiler works... no
configure: error: in `/Users/OliviaLee/src/ruby-3.2.0':
configure: error: C compiler cannot create executables
See `config.log' for more details
!!! Configuration of ruby 3.2.0 failed!

這是 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.71.  Invocation command line was

  $ ./configure --prefix=/Users/OliviaLee/.rubies/ruby-3.2.0 --with-opt-dir=/opt/homebrew/opt/openssl@1.1:/opt/homebrew/opt/readline:/opt/homebrew/opt/libyaml:/opt/homebrew/opt/gdbm

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

hostname = MacBook-Pro-162.local
uname -m = arm64
uname -r = 22.2.0
uname -s = Darwin
uname -v = Darwin Kernel Version 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103

/usr/bin/uname -p = arm
/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 22.2.0: Fri Nov 11 02:04:44 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T8103
Kernel configured for up to 8 processors.
8 processors are physically available.
8 processors are logically available.
Processor type: arm64e (ARM64E)
Processors active: 0 1 2 3 4 5 6 7
Primary memory available: 8.00 gigabytes
Default processor set: 440 tasks, 2772 threads, 8 processors
Load average: 10.08, Mach factor: 1.78
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /opt/homebrew/bin/
PATH: /opt/homebrew/sbin/
PATH: /Users/OliviaLee/.rbenv/shims/
PATH: /opt/homebrew/bin/
PATH: /opt/homebrew/sbin/
PATH: /Library/Frameworks/Python.framework/Versions/3.9/bin/
PATH: /Users/OliviaLee/opt/anaconda3/bin/
PATH: /Users/OliviaLee/opt/anaconda3/condabin/
PATH: /usr/local/bin/
PATH: /System/Cryptexes/App/usr/bin/
PATH: /usr/bin/
PATH: /bin/
PATH: /usr/sbin/
PATH: /sbin/
PATH: /Library/Apple/usr/bin/


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

configure:3464: looking for aux files: install-sh config.guess config.sub
configure:3477:  trying ./tool/
configure:3488:   ./tool/install-sh found
configure:3506:   ./tool/config.guess found
configure:3506:   ./tool/config.sub found
configure:3698: checking for ruby
configure:3721: found /usr/bin/ruby
configure:3734: result: /usr/bin/ruby
configure:3859: checking build system type
configure:3874: result: x86_64-apple-darwin13.4.0
configure:3894: checking host system type
configure:3908: result: x86_64-apple-darwin13.4.0
configure:3928: checking target system type
configure:3942: result: x86_64-apple-darwin13.4.0
configure:4403: checking for x86_64-apple-darwin13.4.0-cl.exe
configure:4435: result: clang
configure:4956: checking for llvm-ar
configure:4988: result: x86_64-apple-darwin13.4.0-ar
configure:5002: checking for clang++
configure:5034: result: x86_64-apple-darwin13.4.0-clang++
configure:5047: checking for llvm-nm
configure:5079: result: x86_64-apple-darwin13.4.0-nm
configure:5092: checking for llvm-objcopy
configure:5113: found /Users/OliviaLee/opt/anaconda3/bin/llvm-objcopy
configure:5124: result: llvm-objcopy
configure:5137: checking for llvm-objdump
configure:5158: found /Users/OliviaLee/opt/anaconda3/bin/llvm-objdump
configure:5169: result: llvm-objdump
configure:5182: checking for llvm-ranlib
configure:5214: result: x86_64-apple-darwin13.4.0-ranlib
configure:5227: checking for llvm-strip
configure:5259: result: x86_64-apple-darwin13.4.0-strip
configure:5536: checking for x86_64-apple-darwin13.4.0-gcc
configure:5568: result: clang
configure:5966: checking for C compiler version
configure:5975: clang --version >&5
clang version 12.0.0
Target: x86_64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Users/OliviaLee/opt/anaconda3/bin
configure:5986: $? = 0
configure:5975: clang -v >&5
clang version 12.0.0
Target: x86_64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Users/OliviaLee/opt/anaconda3/bin
configure:5986: $? = 0
configure:5975: clang -V >&5
clang-12: error: argument to '-V' is missing (expected 1 value)
clang-12: error: no input files
configure:5986: $? = 1
configure:5975: clang -qversion >&5
clang-12: error: unknown argument '-qversion'; did you mean '--version'?
clang-12: error: no input files
configure:5986: $? = 1
configure:5975: clang -version >&5
clang-12: error: unknown argument '-version'; did you mean '--version'?
clang-12: error: no input files
configure:5986: $? = 1
configure:6006: checking whether the C compiler works
configure:6028: clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/OliviaLee/opt/anaconda3/include -D_FORTIFY_SOURCE=2 -isystem /Users/OliviaLee/opt/anaconda3/include -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/OliviaLee/opt/anaconda3/lib -L/Users/OliviaLee/opt/anaconda3/lib conftest.c  >&5
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
configure:6032: $? = 1
configure:6072: 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 (void)
| {
| 
|   ;
|   return 0;
| }
configure:6077: error: in `/Users/OliviaLee/src/ruby-3.2.0':
configure:6079: error: C compiler cannot create executables
See `config.log' for more details

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

ac_cv_build=x86_64-apple-darwin13.4.0
ac_cv_env_AR_set=set
ac_cv_env_AR_value=x86_64-apple-darwin13.4.0-ar
ac_cv_env_AS_set=set
ac_cv_env_AS_value=x86_64-apple-darwin13.4.0-as
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=set
ac_cv_env_CC_value=clang
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/OliviaLee/opt/anaconda3/include'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='-D_FORTIFY_SOURCE=2 -isystem /Users/OliviaLee/opt/anaconda3/include'
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXFLAGS_set=set
ac_cv_env_CXXFLAGS_value='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -isystem /Users/OliviaLee/opt/anaconda3/include'
ac_cv_env_CXX_set=set
ac_cv_env_CXX_value=x86_64-apple-darwin13.4.0-clang++
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/OliviaLee/opt/anaconda3/lib -L/Users/OliviaLee/opt/anaconda3/lib'
ac_cv_env_LD_set=set
ac_cv_env_LD_value=x86_64-apple-darwin13.4.0-ld
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_NM_set=set
ac_cv_env_NM_value=x86_64-apple-darwin13.4.0-nm
ac_cv_env_OBJCOPY_set=
ac_cv_env_OBJCOPY_value=
ac_cv_env_OBJDUMP_set=
ac_cv_env_OBJDUMP_value=
ac_cv_env_RANLIB_set=set
ac_cv_env_RANLIB_value=x86_64-apple-darwin13.4.0-ranlib
ac_cv_env_STRIP_set=set
ac_cv_env_STRIP_value=x86_64-apple-darwin13.4.0-strip
ac_cv_env_build_alias_set=set
ac_cv_env_build_alias_value=x86_64-apple-darwin13.4.0
ac_cv_env_cflags_set=
ac_cv_env_cflags_value=
ac_cv_env_cppflags_set=
ac_cv_env_cppflags_value=
ac_cv_env_cxxflags_set=
ac_cv_env_cxxflags_value=
ac_cv_env_host_alias_set=set
ac_cv_env_host_alias_value=x86_64-apple-darwin13.4.0
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_func_malloc_0_nonnull=yes
ac_cv_func_realloc_0_nonnull=yes
ac_cv_host=x86_64-apple-darwin13.4.0
ac_cv_path_BASERUBY=/usr/bin/ruby
ac_cv_prog_AR=x86_64-apple-darwin13.4.0-ar
ac_cv_prog_CC=clang
ac_cv_prog_CXX=x86_64-apple-darwin13.4.0-clang++
ac_cv_prog_NM=x86_64-apple-darwin13.4.0-nm
ac_cv_prog_OBJCOPY=llvm-objcopy
ac_cv_prog_OBJDUMP=llvm-objdump
ac_cv_prog_RANLIB=x86_64-apple-darwin13.4.0-ranlib
ac_cv_prog_STRIP=x86_64-apple-darwin13.4.0-strip
ac_cv_target=x86_64-apple-darwin13.4.0

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

ADDITIONAL_DLDFLAGS=''
ALLOCA=''
AR='x86_64-apple-darwin13.4.0-ar'
ARCHFILE=''
ARCH_FLAG=''
ARFLAGS=''
AS='x86_64-apple-darwin13.4.0-as'
ASFLAGS=''
ASMEXT=''
BASERUBY='/usr/bin/ruby --disable=gems'
BTESTRUBY=''
BUILTIN_ENCOBJS=''
BUILTIN_TRANSOBJS=''
BUILTIN_TRANSSRCS=''
CAPITARGET=''
CARGO=''
CARGO_BUILD_ARGS=''
CC='clang'
CCDLFLAGS=''
CC_VERSION=''
CC_VERSION_MESSAGE=''
CC_WRAPPER=''
CFLAGS='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -isystem /Users/OliviaLee/opt/anaconda3/include'
CHDIR=''
COMMON_HEADERS=''
COMMON_LIBS=''
COMMON_MACROS=''
CONFIGURE=''
COROUTINE_TYPE=''
COUTFLAG=''
CP=''
CPP=''
CPPFLAGS='-D_FORTIFY_SOURCE=2 -isystem /Users/OliviaLee/opt/anaconda3/include'
CPPOUTFILE=''
CROSS_COMPILING=''
CSRCFLAG=''
CXX='x86_64-apple-darwin13.4.0-clang++'
CXXFLAGS='-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 -isystem /Users/OliviaLee/opt/anaconda3/include'
DEFS=''
DESTDIR=''
DLDFLAGS=''
DLDLIBS=''
DLDSHARED=''
DLEXT=''
DLLWRAP=''
DLNOBJ=''
DOT=''
DOXYGEN=''
DTRACE=''
DTRACE_EXT=''
DTRACE_OBJ=''
DTRACE_OPT=''
DTRACE_REBUILD=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ENABLE_DEBUG_ENV=''
ENABLE_SHARED=''
ENCOBJS=''
ENCSTATIC=''
EXECUTABLE_EXTS=''
EXEEXT=''
EXPORT_PREFIX=''
EXTDLDFLAGS=''
EXTLDFLAGS=''
EXTOBJS=''
EXTOUT=''
EXTSTATIC=''
GCC=''
GIT='git'
GNU_LD=''
GREP=''
HAVE_BASERUBY='yes'
HAVE_GIT='yes'
INSTALLDOC=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
INSTALL_STATIC_LIBRARY=''
LD='x86_64-apple-darwin13.4.0-ld'
LDFLAGS='-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/OliviaLee/opt/anaconda3/lib -L/Users/OliviaLee/opt/anaconda3/lib'
LDSHARED=''
LDSHAREDXX=''
LIBEXT=''
LIBOBJS=''
LIBPATHENV=''
LIBPATHFLAG=''
LIBRUBY=''
LIBRUBYARG=''
LIBRUBYARG_SHARED=''
LIBRUBYARG_STATIC=''
LIBRUBY_A=''
LIBRUBY_ALIASES=''
LIBRUBY_A_OBJS=''
LIBRUBY_DLDFLAGS=''
LIBRUBY_LDSHARED=''
LIBRUBY_RELATIVE=''
LIBRUBY_SO=''
LIBRUBY_SONAME=''
LIBS=''
LINK_SO=''
LN_S=''
LTLIBOBJS=''
MAINLIBS=''
MAJOR='3'
MAKEDIRS=''
MAKEFILES=''
MANTYPE=''
MINIOBJS=''
MINIRUBY=''
MINOR='2'
MJIT_CC=''
MJIT_CFLAGS=''
MJIT_DEBUGFLAGS=''
MJIT_HEADER_FLAGS=''
MJIT_HEADER_INSTALL_DIR=''
MJIT_LDSHARED=''
MJIT_OPTFLAGS=''
MJIT_SUPPORT=''
MJIT_TABS=''
MKDIR_P=''
MKMF_VERBOSE=''
NM='x86_64-apple-darwin13.4.0-nm'
NULLCMD=''
OBJCOPY='llvm-objcopy'
OBJDUMP='llvm-objdump'
OBJEXT=''
OUTFLAG=''
PACKAGE=''
PACKAGE_BUGREPORT=''
PACKAGE_NAME=''
PACKAGE_STRING=''
PACKAGE_TARNAME=''
PACKAGE_URL=''
PACKAGE_VERSION=''
PATH_SEPARATOR=':'
PKG_CONFIG=''
PLATFORM_DIR=''
POSTLINK=''
PRELOADENV=''
PREP=''
RANLIB='x86_64-apple-darwin13.4.0-ranlib'
RDOCTARGET=''
RI_BASE_NAME=''
RM=''
RMALL=''
RMDIR=''
RMDIRS=''
RPATHFLAG=''
RUBYW_BASE_NAME='rubyw'
RUBYW_INSTALL_NAME=''
RUBY_API_VERSION='$(MAJOR).$(MINOR)'
RUBY_BASE_NAME='ruby'
RUBY_DEVEL=''
RUBY_EXEC_PREFIX=''
RUBY_INSTALL_NAME=''
RUBY_LIB_VERSION=''
RUBY_LIB_VERSION_STYLE=''
RUBY_PROGRAM_VERSION='$(MAJOR).$(MINOR).$(TEENY)'
RUBY_SEARCH_PATH=''
RUBY_SO_NAME=''
RUBY_VERSION_NAME='${RUBY_BASE_NAME}-${ruby_version}'
RUNRUBY=''
RUNRUBY_COMMAND=''
RUSTC=''
SET_MAKE=''
SHELL='/bin/sh'
SOEXT=''
SOLIBS=''
STATIC=''
STRIP='x86_64-apple-darwin13.4.0-strip'
SYMBOL_PREFIX=''
TEENY='0'
TEST_RUNNABLE=''
THREAD_MODEL=''
TRY_LINK=''
UNIVERSAL_ARCHNAMES=''
UNIVERSAL_INTS=''
USE_RUBYGEMS=''
WASMOPT=''
WERRORFLAG=''
WINDRES=''
XCC_WRAPPER=''
XCFLAGS=''
XLDFLAGS=''
XRUBY=''
XRUBY_LIBDIR=''
XRUBY_LIBPATHENV_WRAPPER=''
XRUBY_RUBYHDRDIR=''
XRUBY_RUBYLIBDIR=''
X_COROUTINE_H=''
X_COROUTINE_SRC=''
YJIT_LIBS=''
YJIT_OBJ=''
YJIT_SUPPORT=''
ac_ct_AR=''
ac_ct_AS=''
ac_ct_CC=''
ac_ct_CXX=''
ac_ct_LD=''
ac_ct_NM=''
ac_ct_OBJCOPY=''
ac_ct_OBJDUMP=''
ac_ct_STRIP=''
arch=''
archincludedir=''
archlibdir=''
bindir='${exec_prefix}/bin'
build='x86_64-apple-darwin13.4.0'
build_alias='x86_64-apple-darwin13.4.0'
build_cpu='x86_64'
build_os='darwin13.4.0'
build_vendor='apple'
cflags=''
cleanlibs=''
codesign=''
configure_args=''
cppflags=''
cxxflags=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
debugflags=''
docdir='${datarootdir}/doc/${PACKAGE}'
dsymutil=''
dvidir='${docdir}'
exec=''
exec_prefix='NONE'
host='x86_64-apple-darwin13.4.0'
host_alias='x86_64-apple-darwin13.4.0'
host_cpu='x86_64'
host_os='darwin13.4.0'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libdirname=''
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
optflags=''
pdfdir='${docdir}'
prefix='/Users/OliviaLee/.rubies/ruby-3.2.0'
program_transform_name='s&^&&'
psdir='${docdir}'
ridir=''
ruby_pc=''
ruby_version=''
rubyarchdir=''
rubyarchhdrdir=''
rubyarchprefix=''
rubyhdrdir=''
rubylibdir=''
rubylibprefix=''
rubysitearchprefix=''
rubyw_install_name=''
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
setup=''
sharedstatedir='${prefix}/com'
sitearch=''
sitearchdir=''
sitearchhdrdir=''
sitearchincludedir=''
sitearchlibdir=''
sitedir=''
sitehdrdir=''
sitelibdir=''
strict_warnflags=''
sysconfdir='${prefix}/etc'
target='x86_64-apple-darwin13.4.0'
target_alias=''
target_cpu='x86_64'
target_os='darwin13.4.0'
target_vendor='apple'
try_header=''
vendorarchdir=''
vendorarchhdrdir=''
vendordir=''
vendorhdrdir=''
vendorlibdir=''
warnflags=''
wasmoptflags=''

## ----------- ##
## 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

請讓我知道:我只想創建一個漂亮的 github 頁面網站來申請工作:) 謝謝!

我試過了

RUBY_CFLAGS="-Wno-error=implicit-function-declaration" rbenv install 3.2.0 

我嘗試了 asdf,卸載並重新安裝自制軟件和所有內容。 請告訴我。 謝謝!

日志表明您的clang --version值為12.0.0 ,而 clang 的目標是 x86_64。 具有最新版本 Xcode 命令行工具的最新版本的 macOS 應該具有版本14.0.0 ,並且應該以 arm64 為目標。

打開終端並運行此命令:

clang --version

你應該看到這個:

Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

如果不這樣做,則運行此命令來安裝命令行工具:

xcode-select --install

如果您被告知工具已經安裝,請確保它們是最新的:

softwareupdate -l

如果它們已安裝並且是最新的,那么請確保您正在運行終端而不通過打開終端並運行來模擬 x86_64:

arch

如果您看到i386 ,那么您的終端正在使用 Rosetta 仿真運行,需要禁用它,以便您的所有命令都作為本機 arm64 命令運行。 要解決此問題:

  1. 打開 Finder 並瀏覽到/Applications/Utilities
  2. 右鍵單擊Terminal並單擊Get Info
  3. 在打開的 window 中取消勾選使用 Rosetta 打開
  4. 完全退出終端(終端菜單>退出終端
  5. 重新打開終端
  6. 再次運行arch並確認它arm64
  7. 重試安裝 Ruby

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM