-1

I have tried at least 10 ways to install/ update ruby to a newer version atleast 2.7.6 but no luck so far. I have zero experience with ruby. Please help

I have tried to install it using homebrew, rvm, rbenv frum etc. Always end up with this error:

making srcs under enc
error in initial header file:
In file included from /var/folders/s_/1yp2b6hj1z14nmx2g31dl3gr0000gn/T/20230224-83651-xeut39.c:1:
/var/folders/s_/1yp2b6hj1z14nmx2g31dl3gr0000gn/T/20230224-83651-jc45np.h:5930:66: fatal error: expected identifier or '('
pthread_override_qos_class_end_np(pthread_override_t __override);#pragma clang assume_nonnull end
                                                                 ^
1 error generated.
make: *** [.ext/include/x86_64-darwin22/rb_mjit_min_header-2.7.5.h] Error 1
make: *** Waiting for unfinished jobs....
make[1]: Nothing to be done for `srcs'.

**below is the log file with error:

/var/folders/s_/1yp2b6hj1z14nmx2g31dl3gr0000gn/T/ruby-build.20230224175237.75587.o0df3h ~
/var/folders/s_/1yp2b6hj1z14nmx2g31dl3gr0000gn/T/ruby-build.20230224175237.75587.o0df3h/ruby-2.7.5 /var/folders/s_/1yp2b6hj1z14nmx2g31dl3gr0000gn/T/ruby-build.20230224175237.75587.o0df3h ~
checking for ruby... /usr/bin/ruby
...

...
checking if make is GNU make... yes
.ext/include/x86_
64-darwin22/ruby/config.h updated
configure: ruby library version = 2.7.0
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating Makefile
config.status: creating ruby-2.7.pc**
---
Configuration summary for ruby version 2.7.5

   * Installation prefix: /Users/sumeet/.rbenv/versions/2.7.5
   * exec prefix:         ${prefix}
   * arch:                x86_64-darwin22
   * 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:           darwin22
   * compiler:            clang
   * with pthread:        yes
   * with coroutine:      amd64
   * enable shared libs:  yes
   * dynamic library ext: bundle
   * CFLAGS:              ${optflags} ${debugflags} ${warnflags}
   * LDFLAGS:             -L. -L/Users/sumeet/.rbenv/versions/2.7.5/lib  \
                          -fstack-protector-strong -L/usr/local/lib
   * DLDFLAGS:            -L/Users/sumeet/.rbenv/versions/2.7.5/lib  \
                          -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-cast-function-type \
                          -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.10p210 (2022-04-12 revision 67958) \
                          [universal.x86_64-darwin22]

---
    BASERUBY = /usr/bin/ruby --disable=gems
    CC = clang
    LD = ld
    LDSHARED = clang -dynamiclib
    CFLAGS = -g -O2 -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-darwin22 -I./include -I. -I./enc/unicode/12.1.0
    CPPFLAGS = -I/Users/sumeet/.rbenv/versions/2.7.5/include  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   
    DLDFLAGS = -L/Users/sumeet/.rbenv/versions/2.7.5/lib  -Wl,-multiply_defined,suppress -install_name /Users/sumeet/.rbenv/versions/2.7.5/lib/libruby.2.7.dylib -compatibility_version 2.7 -current_version 2.7.5  -fstack-protector-strong -framework Security -framework Foundation  -fstack-protector-strong -framework Security -framework Foundation  
    SOLIBS = -lpthread -lgmp -ldl -lobjc
    LANG = en_US.UTF-8
    LC_ALL = en_US.UTF-8
    LC_CTYPE = UTF-8
    MFLAGS = - --jobserver-fds=7,8 -j
Apple clang version 13.0.0 (https://github.com/apple/llvm-project.git 597c04db307f4ed6e19ba0676d791f5c384b62ac)
Target: x86_64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Library/Developer/Toolchains/swift-5.7-DEVELOPMENT-SNAPSHOT-2022-10-03-a.xctoolchain/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
compiling compile.c
compiling complex.c
compiling cont.c
compiling debug.c
. ./vm_opts.h
compiling debug_counter.c
compiling dir.c
compiling dln_find.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 encoding.c
compiling enum.c
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) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
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
compiling inits.c
compiling io.c
compiling iseq.c
compiling load.c
1 warning generated.
compiling marshal.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) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
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
compiling pack.c
compiling parse.c
compiling proc.c
1 warning generated.
compiling process.c
compiling random.c
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
1 warning generated.
compiling safe.c
1 warning generated.
compiling signal.c
compiling sprintf.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 st.c
compiling strftime.c
compiling string.c
compiling struct.c
compiling symbol.c
compiling thread.c
1 warning generated.
compiling time.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 transcode.c
compiling transient_heap.c
compiling util.c
compiling variable.c
compiling vm.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_backtrace.c
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 vm_dump.c
compiling vm_trace.c
compiling ./missing/explicit_bzero.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) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
compiling ./missing/setproctitle.c
compiling addr2line.c
compiling dmyenc.c
compiling dln.c
compiling localeinit.c
compiling array.c
compiling mjit.c
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; \
    ^~~~
assembling coroutine/amd64/Context.S
config.status: creating ruby-runner.h
compiling enc/ascii.c
compiling enc/us_ascii.c
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) {
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
compiling enc/unicode.c
compiling enc/utf_8.c
compiling enc/trans/newline.c
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.
./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.
1 warning generated.
2 warnings generated.
2 warnings generated.
building rb_mjit_header.h
linking miniruby
rb_mjit_header.h updated
generating encdb.h
building .ext/include/x86_64-darwin22/rb_mjit_min_header-2.7.5.h
./miniruby -I./lib -I. -I.ext/common  ./tool/transform_mjit_header.rb "clang  -g -O2 -fno-common -pipe " rb_mjit_header.h .ext/include/x86_64-darwin22/rb_mjit_min_header-2.7.5.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
verconf.h updated
compiling loadpath.c
making srcs under enc
error in initial header file:
In file included from /var/folders/s_/1yp2b6hj1z14nmx2g31dl3gr0000gn/T/20230224-83651-xeut39.c:1:
/var/folders/s_/1yp2b6hj1z14nmx2g31dl3gr0000gn/T/20230224-83651-jc45np.h:5930:66: fatal error: expected identifier or '('
pthread_override_qos_class_end_np(pthread_override_t __override);#pragma clang assume_nonnull end
                                                                 ^
1 error generated.
make: *** [.ext/include/x86_64-darwin22/rb_mjit_min_header-2.7.5.h] Error 1
make: *** Waiting for unfinished jobs....make[1]: Nothing to be done for `srcs'.



I ran the following command:
 RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)" rbenv install 2.7.6

Taryn East
  • 27,486
  • 9
  • 86
  • 108
Sumeet
  • 1
  • Are you truly claiming that when you attempt to install Ruby with Homebrew, rbenv, RVM and frum, *every single one of them returns* precisely *that exact error message*? Because frankly I do not believe you. – anothermh Feb 24 '23 at 22:07
  • I am not a pro also this I what I think is happening I can share all the make logs.I might be wrong too. But It seems to be failing with the same error each time. I am sharing make log files. RVM - https://file.io/0eMLFedAcwlG frum - https://file.io/ThirTQyxQWa7 rbenv - https://file.io/fISxnWcC0X1Q please check and revert @anothermh – Sumeet Feb 27 '23 at 11:59

1 Answers1

0

Hi and welcome to Stack Overflow.

I googled the error message you have:

In file included from iseq.c:30:
./mjit.h:131:17: warning: cast to smaller integer type 'enum rb_mjit_iseq_func'

and found the discussion linked below, which suggests that installing XCode might be your problem. https://github.com/rbenv/ruby-build/discussions/1888

Can you try (re)installing Xcode on your system to see if that helps? It doesn't look like it's a problem with ruby itself - the error is coming from one of the C header-files.

Taryn East
  • 27,486
  • 9
  • 86
  • 108
  • 1
    I was finally able to do it by following steps from this post https://stackoverflow.com/questions/66128681/ruby-build-failed-macos-11-2-using-ruby-build-20210119-mac-big-sur – Sumeet Mar 07 '23 at 12:01