简体   繁体   English

在 Mac M1 上安装最新版本的 Ruby 时编译器不工作

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

I am trying to install Jekyll on my mac m1, but I cannot because the Ruby m1 macs come with is not up to date.我正在尝试在我的 mac m1 上安装 Jekyll,但我不能,因为 Ruby m1 mac 不是最新的。 I'm trying to update Ruby to 3.2.0 or to any useable version but this comes up:我正在尝试将 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!

Here is the config.log file:这是 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

Please let me know: All I want to do is create a nice github pages site to apply for jobs :) Thank you!请让我知道:我只想创建一个漂亮的 github 页面网站来申请工作:) 谢谢!

I tried我试过了

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

I tried asdf, uninstalling and reinstalling homebrew and everything.我尝试了 asdf,卸载并重新安装自制软件和所有内容。 Please let me know.请告诉我。 Thank you!谢谢!

The log indicates that you have clang --version with a value of 12.0.0 and that clang is targeting x86_64.日志表明您的clang --version值为12.0.0 ,而 clang 的目标是 x86_64。 An up-to-date version of macOS with up-to-date version of the Xcode Command Line Tools should have version 14.0.0 and it should target arm64.具有最新版本 Xcode 命令行工具的最新版本的 macOS 应该具有版本14.0.0 ,并且应该以 arm64 为目标。

Open a Terminal and run this command:打开终端并运行此命令:

clang --version

You should see this:你应该看到这个:

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

If you do not then run this command to install the Command Line Tools:如果不这样做,则运行此命令来安装命令行工具:

xcode-select --install

If you are told the tools are already installed then make sure they are up to date:如果您被告知工具已经安装,请确保它们是最新的:

softwareupdate -l

If they are installed and up to date then make sure that you are running Terminal without emulating x86_64 by opening a Terminal and running:如果它们已安装并且是最新的,那么请确保您正在运行终端而不通过打开终端并运行来模拟 x86_64:

arch

If you see i386 then your Terminal is running with Rosetta emulation and that needs to be disabled so that all your commands run as native arm64 commands.如果您看到i386 ,那么您的终端正在使用 Rosetta 仿真运行,需要禁用它,以便您的所有命令都作为本机 arm64 命令运行。 To fix this:要解决此问题:

  1. Open Finder and browse to /Applications/Utilities打开 Finder 并浏览到/Applications/Utilities
  2. Right-click Terminal and click Get Info右键单击Terminal并单击Get Info
  3. In the window that opens uncheck the box Open using Rosetta在打开的 window 中取消勾选使用 Rosetta 打开
  4. Quit Terminal completely ( Terminal menu > Quit Terminal )完全退出终端(终端菜单>退出终端
  5. Re-open Terminal重新打开终端
  6. Run arch again and confirm it says arm64再次运行arch并确认它arm64
  7. Retry installing Ruby重试安装 Ruby

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM