TaKO8Ki / frum

A little bit fast and modern Ruby version manager written in Rust
MIT License
628 stars 15 forks source link

Cannot install ruby with m1 mac #127

Closed aubri61 closed 1 year ago

aubri61 commented 1 year ago

Hi, I was installing ruby 2.7.6 on rbenv but the error came out. So I installed frum and tried this code

RUBY_CFLAGS='-DUSE_FFI_CLOSURE_ALLOC -Wno-error=implicit-function-declaration' frum install 2.7.6 --with-openssl-dir=$(brew --prefix openssl@1.0) --enable-shared

And then this error came out

Error: No available formula with the name "openssl@1.0". Did you mean openssl@1.1 or openssl@3? ==> Downloading https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.xz ==> Extracting ruby-2.7.6.tar.xz ==> Building Ruby 2.7.6 error: Can't build Ruby: make install: Generating RI format into /Users/jueon/.frum/versions/.downloads/.tmp6dBID1/ruby-2.7.6/.ext/rdoc... /Users/jueon/.frum/versions/.downloads/.tmp6dBID1/ruby-2.7.6/lib/rubygems/core_ext/kernel_require.rb:83:in require': cannot load such file -- openssl (LoadError) from /Users/jueon/.frum/versions/.downloads/.tmp6dBID1/ruby-2.7.6/lib/rubygems/core_ext/kernel_require.rb:83:inrequire' from /Users/jueon/.frum/versions/.downloads/.tmp6dBID1/ruby-2.7.6/lib/rubygems/specification.rb:2430:in to_ruby' from ./tool/rbinstall.rb:846:inblock (2 levels) in install_default_gem' from ./tool/rbinstall.rb:279:in open_for_install' from ./tool/rbinstall.rb:845:inblock in install_default_gem' from ./tool/rbinstall.rb:835:in each' from ./tool/rbinstall.rb:835:ininstall_default_gem' from ./tool/rbinstall.rb:799:in block in <main>' from ./tool/rbinstall.rb:950:inblock in

' from ./tool/rbinstall.rb:947:in each' from ./tool/rbinstall.rb:947:in
' make: *** [do-install-all] Error 1

So I tried to fix typo as openssol@1.1 but it said

error: Version already installed at "/Users/jueon/.frum/versions/2.7.6"

so i deleted 2.7.6 dir and re installed it but the same error came out RUBY_CFLAGS='-DUSE_FFI_CLOSURE_ALLOC -Wno-error=implicit-function-declaration' frum install 2.7.6 --with-openssl-dir=$(brew --prefix openssl@1.1) --enable-shared

==> Downloading https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.xz ==> Extracting ruby-2.7.6.tar.xz ==> Building Ruby 2.7.6 error: Can't build Ruby: make install: Generating RI format into /Users/jueon/.frum/versions/.downloads/.tmpm51eRo/ruby-2.7.6/.ext/rdoc... /Users/jueon/.frum/versions/.downloads/.tmpm51eRo/ruby-2.7.6/lib/rubygems/core_ext/kernel_require.rb:83:in require': cannot load such file -- openssl (LoadError) from /Users/jueon/.frum/versions/.downloads/.tmpm51eRo/ruby-2.7.6/lib/rubygems/core_ext/kernel_require.rb:83:inrequire' from /Users/jueon/.frum/versions/.downloads/.tmpm51eRo/ruby-2.7.6/lib/rubygems/specification.rb:2430:in to_ruby' from ./tool/rbinstall.rb:846:inblock (2 levels) in install_default_gem' from ./tool/rbinstall.rb:279:in open_for_install' from ./tool/rbinstall.rb:845:inblock in install_default_gem' from ./tool/rbinstall.rb:835:in each' from ./tool/rbinstall.rb:835:ininstall_default_gem' from ./tool/rbinstall.rb:799:in block in <main>' from ./tool/rbinstall.rb:950:inblock in

' from ./tool/rbinstall.rb:947:in each' from ./tool/rbinstall.rb:947:in
' make: *** [do-install-all] Error 1

and when i try frum install 2.7.6 --with-openssl-dir=brew --prefix openssl@1.1``

==> Downloading https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.6.tar.xz ==> Extracting ruby-2.7.6.tar.xz ==> Building Ruby 2.7.6 error: Can't build Ruby: make failed: . ./vm_opts.h 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) { ^~~~~~~~ 1 warning generated. 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) { ^~~~~~~~ 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) { ^~~~~~~~ 1 warning generated. 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) { ^~~~~~~~ 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) { ^~~~~~~~ 1 warning generated. 1 warning generated. 1 warning generated. 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) { ^~~~~~~~ 1 warning generated. 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) { ^~~~~~~~ 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) { ^~~~~~~~ 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; ^~~~~~~~ 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) { ^~~~~~~~ 1 warning generated. array.c:290:17: warning: expression result unused [-Wunused-value] RB_OBJ_WRITE(buff_owner_ary, &ptr[i+beg], argv[i]); ^~~~~~~~~~~~~~ ./internal.h:2711:34: note: expanded from macro 'RB_OBJ_WRITE'

define RB_OBJ_WRITE(a, slot, b) UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), FILE, LINE))

^~~~~~~~~~~~~~~~~~~~~~ ./internal.h:2703:5: note: expanded from macro 'UNALIGNED_MEMBER_ACCESS' unaligned_member_access_result; \ ^~~~~~~~~~ ./include/ruby/ruby.h:1087:5: note: expanded from macro 'RARRAY_PTR_USE_TRANSIENT' expr; \ ^~~~ 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) { ^~~~~~~~ array.c:1200:2: warning: expression result unused [-Wunused-value] RB_OBJ_WRITE(target_ary, &ptr[idx], item); ^~~~~~~~~ ./internal.h:2711:34: note: expanded from macro 'RB_OBJ_WRITE'

define RB_OBJ_WRITE(a, slot, b) UNALIGNED_MEMBER_ACCESS(rb_obj_write((VALUE)(a), (VALUE *)(slot), (VALUE)(b), FILE, LINE))

^~~~~~~~~~~~~~~~~~~~~~ ./internal.h:2703:5: note: expanded from macro 'UNALIGNED_MEMBER_ACCESS' unaligned_member_access_result; \ ^~~~~~~~~~ ./include/ruby/ruby.h:1087:5: note: expanded from macro 'RARRAY_PTR_USE_TRANSIENT' expr; \ ^~~~ 1 warning generated. 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. 2 warnings generated. ln -sf ../../../.ext/include/x86_64-darwin22/rb_mjit_min_header-2.7.6.h include/ruby-2.7.0/x86_64-darwin22/rb_mjit_min_header-2.7.6.h Undefined symbols for architecture x86_64: "_rb_declare_transcoder", referenced from: _Init_transdb in transdb.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [.ext/x86_64-darwin22/enc/trans/transdb.bundle] Error 1 make[1]: Waiting for unfinished jobs.... make: [trans] Error 2 make: Waiting for unfinished jobs.... Undefined symbols for architecture x86_64: "_rb_enc_set_base", referenced from: _Init_encdb in encdb.o "_rb_enc_set_dummy", referenced from: _Init_encdb in encdb.o "_rb_encdb_alias", referenced from: _Init_encdb in encdb.o "_rb_encdb_declare", referenced from: _Init_encdb in encdb.o "_rb_encdb_dummy", referenced from: _Init_encdb in encdb.o "_rb_encdb_replicate", referenced from: _Init_encdb in encdb.o "_rb_encdb_set_unicode", referenced from: _Init_encdb in encdb.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [.ext/x86_64-darwin22/enc/encdb.bundle] Error 1 make[1]: Waiting for unfinished jobs.... make: *** [enc] Error 2 libffi_version: 3.4.0

this error came out. can you help me out please? :(

and my mac is 13.0 ventura

aubri61 commented 1 year ago

CFLAGS="-Wno-error=implicit-function-declaration" RUBY_CONFIGURE_OPTS='--with-readline-dir=/usr/local/opt/readline/' arch -x86_64 rbenv install 2.7.6

this solved my problem

aubri61 commented 1 year ago

this seems to install intel -x86 version ruby.. any other solutions?