77935
### やりたいこと

Ruby2.7.2をインストールしたい

なかなかうまくいかないので教えていただきたいです。  
よろしくお願いします！

### 環境

Ruby 2.6.5  
M1チップ搭載MacOS

### 前提条件

Homebrewインストール済  
rbenvインストール済

### 発生したエラー

```

    Downloading openssl-1.1.1i.tar.gz...
    -> https://dqw8nmjcqpjn7.cloudfront.net/e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242
    Installing openssl-1.1.1i...
    Installed openssl-1.1.1i to /Users/yunyun_jp/.rbenv/versions/2.7.2
    
    Downloading ruby-2.7.2.tar.bz2...
    -> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
    Installing ruby-2.7.2...
    ruby-build: using readline from homebrew
    
    BUILD FAILED (macOS 11.4 using ruby-build 20210119)
    
    Inspect or clean up the working tree at /var/folders/s2/bcsz8yb94990dsrrg332gxw40000gn/T/ruby-build.20210702152126.84842.ESLM2k
    Results logged to /var/folders/s2/bcsz8yb94990dsrrg332gxw40000gn/T/ruby-build.20210702152126.84842.log
    
    Last 10 log lines:
    compiling date_parse.c
    installing default console libraries
    compiling date_strftime.c
    compiling date_strptime.c
    linking shared-object objspace.bundle
    linking shared-object io/nonblock.bundle
    linking shared-object io/console.bundle
    linking shared-object nkf.bundle
    linking shared-object date_core.bundle
    make: *** [build-ext] Error 2
    
```

/var/folders/s2/bcsz8yb94990dsrrg332gxw40000gn/T/ruby-
build.20210702152126.84842.log  
文字数制限のため一部抜粋

```

    linking shared-object gdbm.bundle
    readline.c:1904:37: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
                                        rl_username_completion_function);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                        rl_username_completion_function
    readline.c:79:42: note: expanded from macro 'rl_username_completion_function'
    # define rl_username_completion_function username_completion_function
                                             ^
    /opt/homebrew/opt/readline/include/readline/readline.h:485:14: note: 'rl_username_completion_function' declared here
    extern char *rl_username_completion_function PARAMS((const char *, int));
                 ^
    compiling nonblock.c
    1 error generated.
    make[2]: *** [readline.o] Error 1
    make[1]: *** [ext/readline/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    compiling date_parse.c
    installing default console libraries
    compiling date_strftime.c
    compiling date_strptime.c
    linking shared-object objspace.bundle
    linking shared-object io/nonblock.bundle
    linking shared-object io/console.bundle
    linking shared-object nkf.bundle
    linking shared-object date_core.bundle
    make: *** [build-ext] Error 2
    
    Configuration summary for ruby version 2.7.2
    
       * Installation prefix: /Users/yunyun_jp/.rbenv/versions/2.7.2
       * exec prefix:         ${prefix}
       * arch:                x86_64-darwin20
       * site arch:           ${arch}
       * RUBY_BASE_NAME:      ruby
       * enable shared:       yes
       * ruby lib prefix:     ${libdir}/${RUBY_BASE_NAME}
       * site libraries path: ${rubylibprefix}/${sitearch}
       * vendor path:         ${rubylibprefix}/vendor_ruby
       * target OS:           darwin20
       * compiler:            clang
       * with pthread:        yes
       * with coroutine:      amd64
       * enable shared libs:  yes
       * dynamic library ext: bundle
       * CFLAGS:              ${optflags} ${debugflags} ${warnflags}
       * LDFLAGS:             -L. -L/Users/yunyun_jp/.rbenv/versions/2.7.2/lib  \
                              -fstack-protector-strong -L/usr/local/lib
       * DLDFLAGS:            -L/Users/yunyun_jp/.rbenv/versions/2.7.2/lib  \
                              -Wl,-undefined,dynamic_lookup \
                              -Wl,-multiply_defined,suppress
       * optflags:            -O3
       * debugflags:          -ggdb3
       * warnflags:           -Wall -Wextra -Wdeprecated-declarations \
                              -Wdivision-by-zero \
                              -Wimplicit-function-declaration -Wimplicit-int \
                              -Wmisleading-indentation -Wpointer-arith \
                              -Wshorten-64-to-32 -Wwrite-strings \
                              -Wmissing-noreturn -Wno-constant-logical-operand \
                              -Wno-long-long -Wno-missing-field-initializers \
                              -Wno-overlength-strings -Wno-parentheses-equality \
                              -Wno-self-assign -Wno-tautological-compare \
                              -Wno-unused-parameter -Wno-unused-value \
                              -Wunused-variable -Wextra-tokens
       * strip command:       strip -A -n
       * install doc:         rdoc
       * JIT support:         yes
       * man page type:       doc
       * BASERUBY -v:         ruby 2.6.5p114 (2019-10-01 revision 67812) \
                              [x86_64-darwin20]
    
    ---
        BASERUBY = /Users/yunyun_jp/.rbenv/shims/ruby --disable=gems
        CC = clang
        LD = ld
        LDSHARED = clang -dynamiclib
        CFLAGS = -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -std=gnu99  -fno-common -pipe 
        XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN -I. -I.ext/include/x86_64-darwin20 -I./include -I. -I./enc/unicode/12.1.0
        CPPFLAGS = -I/Users/yunyun_jp/.rbenv/versions/2.7.2/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   
        DLDFLAGS = -L/Users/yunyun_jp/.rbenv/versions/2.7.2/lib  -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -install_name /Users/yunyun_jp/.rbenv/versions/2.7.2/lib/libruby.2.7.dylib -compatibility_version 2.7 -current_version 2.7.2  -fstack-protector-strong -framework Security -framework Foundation  -fstack-protector-strong -framework Security -framework Foundation  
        SOLIBS = -lpthread -ldl -lobjc
        LANG = ja_JP.UTF-8
        LC_ALL = 
        LC_CTYPE = 
        MFLAGS = - --jobserver-fds=6,7 -j
    Apple clang version 12.0.5 (clang-1205.0.22.9)
    Target: x86_64-apple-darwin20.5.0
    Thread model: posix
    InstalledDir: /Library/Developer/CommandLineTools/usr/bin
    compiling ./main.c
    compiling dmydln.c
    compiling miniinit.c
    compiling dmyext.c
    translating probes probes.d
    compiling ast.c
    compiling bignum.c
    compiling class.c
    compiling compar.c
    . ./vm_opts.h
    compiling complex.c
    compiling compile.c
    compiling cont.c
    compiling debug.c
    In file included from cont.c:16:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compiling debug_counter.c
    compiling dir.c
    compiling dln_find.c
    compiling encoding.c
    compiling enum.c
    1 warning generated.
    compiling enumerator.c
    compiling error.c
    compiling eval.c
    compiling file.c
    In file included from eval.c:20:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compiling gc.c
    In file included from gc.c:41:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compiling hash.c
    1 warning generated.
    compiling inits.c
    compiling io.c
    compiling iseq.c
    compiling load.c
    In file included from iseq.c:30:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    iseq.c:3097:27: warning: implicit conversion loses integer precision: 'st_data_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
            int traced_insn = insn;
                ~~~~~~~~~~~   ^~~~
    compiling marshal.c
    compiling math.c
    making mjit_config.h
    compiling mjit_compile.c
    In file included from mjit_compile.c:19:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compiling node.c
    compiling numeric.c
    compiling object.c
    2 warnings generated.
    compiling pack.c
    1 warning generated.
    compiling parse.c
    compiling proc.c
    compiling process.c
    compiling random.c
    1 warning generated.
    compiling range.c
    compiling rational.c
    compiling re.c
    compiling regcomp.c
    compiling regenc.c
    compiling regerror.c
    compiling regexec.c
    compiling regparse.c
    compiling regsyntax.c
    compiling ruby.c
    In file included from ruby.c:55:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compiling safe.c
    compiling signal.c
    compiling sprintf.c
    compiling st.c
    1 warning generated.
    compiling strftime.c
    compiling string.c
    compiling struct.c
    compiling symbol.c
    compiling thread.c
    In file included from thread.c:77:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compiling time.c
    compiling transcode.c
    compiling transient_heap.c
    compiling util.c
    compiling variable.c
    compiling vm.c
    compiling vm_backtrace.c
    compiling vm_dump.c
    In file included from vm.c:341:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compiling vm_trace.c
    1 warning generated.
    compiling ./missing/explicit_bzero.c
    compiling ./missing/setproctitle.c
    In file included from vm_trace.c:28:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from vm.c:350:
    ./vm_method.c:291:32: warning: cast to smaller integer type 'enum method_optimized_type' from 'void *' [-Wvoid-pointer-to-enum-cast]
                def->body.optimize_type = (enum method_optimized_type)opts;
                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compiling addr2line.c
    compiling dmyenc.c
    compiling dln.c
    compiling localeinit.c
    compiling array.c
    compiling mjit.c
    1 warning generated.
    In file included from mjit.c:18:
    In file included from ./mjit_worker.c:76:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    assembling coroutine/amd64/Context.S
    compiling enc/ascii.c
    config.status: creating ruby-runner.h
    compiling enc/us_ascii.c
    compiling enc/unicode.c
    1 warning generated.
    compiling enc/utf_8.c
    compiling enc/trans/newline.c
    ./revision.h unchanged
    compiling version.c
    In file included from version.c:15:
    ./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func' from 'mjit_func_t' (aka 'unsigned long (*)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)') [-Wpointer-to-enum-cast]
            switch ((enum rb_mjit_iseq_func)func) {
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 warning generated.
    2 warnings generated.
    building rb_mjit_header.h
    linking miniruby
    rb_mjit_header.h updated
    generating encdb.h
    building .ext/include/x86_64-darwin20/rb_mjit_min_header-2.7.2.h
    ./miniruby -I./lib -I. -I.ext/common  ./tool/transform_mjit_header.rb "clang  -O3 -ggdb3 -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wmissing-noreturn -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -std=gnu99  -fno-common -pipe " rb_mjit_header.h .ext/include/x86_64-darwin20/rb_mjit_min_header-2.7.2.h
    compiling builtin.c
    encdb.h updated
    ./tool/ifchange "--timestamp=.rbconfig.time" rbconfig.rb rbconfig.tmp
    rbconfig.rb updated
    generating enc.mk
    creating verconf.h
    making srcs under enc
    make[1]: Nothing to be done for `srcs'.
    generating transdb.h
    verconf.h updated
    compiling loadpath.c
    linking static-library libruby.2.7-static.a
    
    Transforming external functions to static:
    transform_mjit_header: making external definition of 'rb_vm_lvar_exposed' static inline
    transform_mjit_header: making external definition of 'Init_vm_stack_canary' static inline
    transform_mjit_header: making external definition of 'rb_vm_opt_struct_aset' static inline
    transform_mjit_header: making external definition of 'rb_vm_opt_struct_aref' static inline
    transform_mjit_header: making external definition of 'rb_eql_opt' static inline
    transform_mjit_header: changing definition of 'rb_equal_opt' to declaration
    transform_mjit_header: changing definition of 'rb_vm_search_method_slowpath' to declaration
    transform_mjit_header: making external definition of 'rb_vm_rewrite_cref' static inline
    transform_mjit_header: making external definition of 'rb_vm_block_ep_update' static inline
    transform_mjit_header: making external definition of 'rb_vm_cref_new_toplevel' static inline
    transform_mjit_header: making external definition of 'rb_vm_frame_block_handler' static inline
    transform_mjit_header: making external definition of 'rb_vm_cframe_empty_keyword_p' static inline
    transform_mjit_header: making external definition of 'rb_vm_cframe_keyword_p' static inline
    transform_mjit_header: making external definition of 'rb_vm_ep_local_ep' static inline
    transform_mjit_header: making declaration of 'rb_vm_lvar_exposed' static inline
    transform_mjit_header: making declaration of 'rb_vm_rewrite_cref' static inline
    transform_mjit_header: making declaration of 'rb_vm_frame_block_handler' static inline
    transform_mjit_header: making declaration of 'rb_vm_block_ep_update' static inline
    transform_mjit_header: making declaration of 'rb_vm_ep_local_ep' static inline
    transform_mjit_header: SKIPPED to transform __sigbits
    transform_mjit_header: making declaration of 'Init_vm_stack_canary' static inline
    transform_mjit_header: making declaration of 'rb_eql_opt' static inline
    transform_mjit_header: SKIPPED to transform __sincospi
    transform_mjit_header: SKIPPED to transform __sincospif
    transform_mjit_header: SKIPPED to transform __sincos
    transform_mjit_header: SKIPPED to transform __sincosf
    transform_mjit_header: SKIPPED to transform __inline_isnormall
    transform_mjit_header: SKIPPED to transform __inline_isnormald
    transform_mjit_header: SKIPPED to transform __inline_isnormalf
    transform_mjit_header: SKIPPED to transform __inline_signbitl
    transform_mjit_header: SKIPPED to transform __inline_signbitd
    transform_mjit_header: SKIPPED to transform __inline_signbitf
    transform_mjit_header: SKIPPED to transform __inline_isnanl
    transform_mjit_header: SKIPPED to transform __inline_isnand
    transform_mjit_header: SKIPPED to transform __inline_isnanf
    transform_mjit_header: SKIPPED to transform __inline_isinfl
    transform_mjit_header: SKIPPED to transform __inline_isinfd
    transform_mjit_header: SKIPPED to transform __inline_isinff
    transform_mjit_header: SKIPPED to transform __inline_isfinitel
    transform_mjit_header: SKIPPED to transform __inline_isfinited
    transform_mjit_header: SKIPPED to transform __inline_isfinitef
    transform_mjit_header: SKIPPED to transform __darwin_fd_clr
    transform_mjit_header: SKIPPED to transform __darwin_fd_set
    transform_mjit_header: SKIPPED to transform __darwin_fd_isset
    transform_mjit_header: SKIPPED to transform __darwin_check_fd_set
    transform_mjit_header: SKIPPED to transform __sputc
    linking shared-library libruby.2.7.dylib
    transdb.h updated
    ln -sf ../../../.ext/include/x86_64-darwin20/rb_mjit_min_header-2.7.2.h include/ruby-2.7.0/x86_64-darwin20/rb_mjit_min_header-2.7.2.h
    generating makefiles ext/configure-ext.mk
    making enc
    making trans
    compiling ./enc/trans/transdb.c
    compiling ./enc/encdb.c
    compiling ./enc/big5.c
    compiling ./enc/cesu_8.c
    compiling ./enc/trans/big5.c
    ext/configure-ext.mk updated
    compiling ./enc/trans/cesu_8.c
    compiling ./enc/cp949.c
    compiling ./enc/emacs_mule.c
    configuring strscan
    compiling ./enc/trans/chinese.c
    compiling ./enc/euc_jp.c
    compiling ./enc/trans/ebcdic.c
    compiling ./enc/euc_kr.c
    configuring monitor
    compiling ./enc/euc_tw.c
    compiling ./enc/trans/emoji.c
    compiling ./enc/gb2312.c
    configuring syslog
    compiling ./enc/trans/emoji_iso2022_kddi.c
    configuring gdbm
    compiling ./enc/gb18030.c
    compiling ./enc/gbk.c
    configuring pty
    compiling ./enc/iso_8859_1.c
    compiling ./enc/iso_8859_2.c
    configuring objspace
    compiling ./enc/trans/emoji_sjis_docomo.c
    compiling ./enc/iso_8859_3.c
    compiling ./enc/trans/emoji_sjis_kddi.c
    compiling ./enc/iso_8859_4.c
    compiling ./enc/iso_8859_5.c
    configuring nkf
    compiling ./enc/trans/emoji_sjis_softbank.c
    compiling ./enc/iso_8859_6.c
    configuring digest
    configuring digest/bubblebabble
    configuring digest/md5
    compiling ./enc/iso_8859_7.c
    compiling ./enc/trans/escape.c
    configuring date
    compiling ./enc/iso_8859_8.c
    compiling ./enc/trans/gb18030.c
    configuring readline
    compiling ./enc/iso_8859_9.c
    compiling ./enc/iso_8859_10.c
    compiling ./enc/trans/gbk.c
    compiling ./enc/iso_8859_11.c
    compiling ./enc/iso_8859_13.c
    compiling ./enc/trans/iso2022.c
    compiling ./enc/trans/japanese.c
    compiling ./enc/iso_8859_14.c
    compiling ./enc/iso_8859_15.c
    configuring io/console
    compiling ./enc/iso_8859_16.c
    compiling ./enc/trans/japanese_euc.c
    configuring etc
    compiling ./enc/koi8_r.c
    compiling ./enc/trans/japanese_sjis.c
    compiling ./enc/koi8_u.c
    compiling ./enc/shift_jis.c
    compiling ./enc/utf_16be.c
    compiling ./enc/utf_16le.c
    configuring io/nonblock
    compiling ./enc/utf_32be.c
    configuring bigdecimal
    compiling ./enc/trans/korean.c
    compiling ./enc/utf_32le.c
    configuring io/wait
    configuring digest/rmd160
    compiling ./enc/windows_31j.c
    compiling ./enc/windows_1250.c
    compiling ./enc/trans/single_byte.c
    compiling ./enc/windows_1251.c
    compiling ./enc/windows_1252.c
    compiling ./enc/windows_1253.c
    compiling ./enc/trans/utf8_mac.c
    compiling ./enc/windows_1254.c
    configuring -test-/arith_seq/extract
    configuring -test-/array/resize
    configuring -test-/bignum
    configuring -test-/bug-14834
    configuring -test-/bug-3571
    configuring -test-/bug-5832
    configuring -test-/bug_reporter
    configuring -test-/class
    configuring -test-/cxxanyargs
    compiling ./enc/windows_1257.c
    linking encoding encdb.bundle
    linking encoding big5.bundle
    configuring -test-/debug
    configuring -test-/dln/empty
    configuring -test-/enumerator_kw
    configuring -test-/exception
    configuring -test-/fatal
    configuring -test-/file
    linking encoding cesu_8.bundle
    configuring fiddle
    linking encoding cp949.bundle
    linking encoding emacs_mule.bundle
    configuring digest/sha1
    linking encoding euc_jp.bundle
    linking encoding euc_kr.bundle
    linking encoding euc_tw.bundle
    linking encoding gb2312.bundle
    compiling ./enc/trans/utf_16_32.c
    linking encoding gb18030.bundle
    linking encoding gbk.bundle
    linking transcoder transdb.bundle
    linking encoding iso_8859_1.bundle
    linking transcoder big5.bundle
    libffi_version: 3.3.0
    linking encoding iso_8859_2.bundle
    linking transcoder cesu_8.bundle
    linking encoding iso_8859_3.bundle
    linking transcoder chinese.bundle
    linking encoding iso_8859_4.bundle
    linking transcoder ebcdic.bundle
    linking encoding iso_8859_5.bundle
    configuring rubyvm
    linking transcoder emoji.bundle
    linking encoding iso_8859_6.bundle
    configuring zlib
    linking transcoder emoji_iso2022_kddi.bundle
    linking encoding iso_8859_7.bundle
    linking transcoder emoji_sjis_docomo.bundle
    linking encoding iso_8859_8.bundle
    configuring -test-/float
    configuring -test-/funcall
    configuring -test-/gvl/call_without_gvl
    configuring -test-/hash
    configuring -test-/integer
    configuring -test-/iseq_load
    configuring -test-/iter
    configuring -test-/load/dot.dot
    configuring -test-/load/protect
    linking transcoder emoji_sjis_kddi.bundle
    configuring -test-/marshal/compat
    configuring -test-/marshal/internal_ivar
    configuring -test-/marshal/usr
    configuring -test-/memory_status
    configuring -test-/method
    configuring -test-/notimplement
    configuring -test-/num2int
    configuring -test-/path_to_class
    configuring -test-/popen_deadlock
    configuring -test-/postponed_job
    configuring -test-/printf
    configuring -test-/proc
    configuring -test-/rational
    configuring -test-/rb_call_super_kw
    linking encoding iso_8859_9.bundle
    configuring -test-/recursion
    configuring -test-/regexp
    configuring -test-/scan_args
    configuring -test-/st/foreach
    configuring -test-/st/numhash
    configuring -test-/st/update
    configuring -test-/string
    configuring -test-/struct
    configuring -test-/symbol
    linking transcoder emoji_sjis_softbank.bundle
    linking encoding iso_8859_10.bundle
    linking transcoder escape.bundle
    configuring digest/sha2
    linking encoding iso_8859_11.bundle
    linking transcoder gb18030.bundle
    linking encoding iso_8859_13.bundle
    linking transcoder gbk.bundle
    configuring -test-/thread_fd_close
    configuring -test-/time
    configuring -test-/tracepoint
    linking encoding iso_8859_14.bundle
    configuring -test-/typeddata
    configuring -test-/vm
    configuring -test-/wait_for_single_fd
    linking transcoder iso2022.bundle
    linking encoding iso_8859_15.bundle
    linking transcoder japanese.bundle
    linking encoding iso_8859_16.bundle
    linking transcoder japanese_euc.bundle
    linking encoding koi8_r.bundle
    linking transcoder japanese_sjis.bundle
    linking encoding koi8_u.bundle
    linking transcoder korean.bundle
    linking encoding shift_jis.bundle
    linking transcoder single_byte.bundle
    linking encoding utf_16be.bundle
    configuring psych
    linking encoding utf_16le.bundle
    linking transcoder utf8_mac.bundle
    linking encoding utf_32be.bundle
    configuring cgi/escape
    linking transcoder utf_16_32.bundle
    configuring json
    configuring json/generator
    configuring json/parser
    linking encoding utf_32le.bundle
    linking encoding windows_31j.bundle
    configuring stringio
    linking encoding windows_1250.bundle
    linking encoding windows_1251.bundle
    linking encoding windows_1252.bundle
    linking encoding windows_1253.bundle
    configuring racc/cparse
    linking encoding windows_1254.bundle
    linking encoding windows_1257.bundle
    configuring fiber
    making encs
    make[1]: Nothing to be done for `encs'.
    configuring sdbm
    configuring continuation
    configuring rbconfig/sizeof
    configuring dbm
    configuring fcntl
    configuring ripper
    configuring openssl
    configuring pathname
    configuring coverage
    configuring socket
    header: ndbm.h
    library: libc
    generating makefile exts.mk
    exts.mk updated
    compiling monitor.c
    compiling strscan.c
    compiling syslog.c
    compiling gdbm.c
    compiling pty.c
    compiling nkf.c
    compiling digest.c
    compiling object_tracing.c
    installing default monitor libraries
    compiling objspace.c
    linking shared-object monitor.bundle
    installing default pty libraries
    linking shared-object syslog.bundle
    linking shared-object pty.bundle
    installing default digest libraries
    linking shared-object digest.bundle
    installing digest libraries
    compiling objspace_dump.c
    installing default syslog libraries
    linking shared-object strscan.bundle
    compiling readline.c
    compiling date_core.c
    compiling console.c
    linking shared-object gdbm.bundle
    readline.c:1904:37: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
                                        rl_username_completion_function);
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                        rl_username_completion_function
    readline.c:79:42: note: expanded from macro 'rl_username_completion_function'
    # define rl_username_completion_function username_completion_function
                                             ^
    /opt/homebrew/opt/readline/include/readline/readline.h:485:14: note: 'rl_username_completion_function' declared here
    extern char *rl_username_completion_function PARAMS((const char *, int));
                 ^
    compiling nonblock.c
    1 error generated.
    make[2]: *** [readline.o] Error 1
    make[1]: *** [ext/readline/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    compiling date_parse.c
    installing default console libraries
    compiling date_strftime.c
    compiling date_strptime.c
    linking shared-object objspace.bundle
    linking shared-object io/nonblock.bundle
    linking shared-object io/console.bundle
    linking shared-object nkf.bundle
    linking shared-object date_core.bundle
    make: *** [build-ext] Error 2
    
```
CC BY-SA 4.0
2021-07-02T06:37:06.270
77921
2021-07-03T15:12:52.863
2021-07-03T15:12:52.863
3060
44865
question
ruby macos rbenv
M1Macでrbenv install 2.7.2を実行時、エラーが発生してインストールできません
以下のコマンドで自己解決しました。

```

    arch -arm64 rbenv install 2.7.2
    
```

成功時のログ

```

    Downloading openssl-1.1.1i.tar.gz...
    -> https://dqw8nmjcqpjn7.cloudfront.net/e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242
    Installing openssl-1.1.1i...
    Installed openssl-1.1.1i to /Users/yunyun_jp/.rbenv/versions/2.7.2
    
    Downloading ruby-2.7.2.tar.bz2...
    -> https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.2.tar.bz2
    Installing ruby-2.7.2...
    ruby-build: using readline from homebrew
    Installed ruby-2.7.2 to /Users/yunyun_jp/.rbenv/versions/2.7.2
    
```
CC BY-SA 4.0
2021-07-03T04:09:20.840
77931
2021-07-03T04:09:20.840
44865
77921
answer
エラーメッセージから察するに、この issue で track されている問題です <https://github.com/rbenv/ruby-
build/issues/1691>。この回答の投稿時点でまだ open です。

手元に M1 Mac が無く詳しくは調べられていませんが、Rosetta 2 絡みでライブラリか何かの取り扱いに不整合が起こっているように見えます。

[上の issue にあるコメント](https://github.com/rbenv/ruby-
build/issues/1691#issuecomment-750688557)のように Rosetta 2 を使わずに native の ARM
を使うようにするか、他のコメントで触れられている別の workaround を入れると動きそうです。個人的には速度の問題があるので前者がオススメです。
CC BY-SA 4.0
2021-07-03T07:27:01.747
77935
2021-07-03T07:27:01.747
19110
77921
answer