skip to Main Content

I try to build Ruby 3.2 using ruby-build plugin for rbenv but get some strange compilation error:

compiling bignum.c
In file included from vm_core.h:164:0,
                 from iseq.h:14,
                 from mini_builtin.c:3,
                 from miniinit.c:51:
thread_pthread.h:109:39: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘struct’
 RUBY_EXTERN RB_THREAD_LOCAL_SPECIFIER struct rb_execution_context_struct *ruby_current_ec;
                                       ^
In file included from iseq.h:14:0,
                 from mini_builtin.c:3,
                 from miniinit.c:51:
vm_core.h: In function ‘rb_current_execution_context’:
vm_core.h:1864:34: error: ‘ruby_current_ec’ undeclared (first use in this function)
     rb_execution_context_t *ec = ruby_current_ec;
                                  ^
vm_core.h:1864:34: note: each undeclared identifier is reported only once for each function it appears in

Here is the full log: https://gist.github.com/tycooon/c077a1d99299469bd86131211c565ff7.

Ruby 3.1 builds without any problems on the same machine. What could be the problem?

2

Answers


  1. Chosen as BEST ANSWER

    The problem was centos7 being shipped with too old GCC. There was devtoolset-7-gcc.x86_64 package available on the machine in my case, so I was able to install Ruby 3.2 using the following command:

    CC=/opt/rh/devtoolset-7/root/usr/bin/gcc rbenv install 3.2.0 -v
    

    Hope this helps someone.


  2. I also had this problem with CentOS 7 and ruby 3.1.4 and @tycoon’s solution provided the solution here too. For more completeness I’ll add this:

    # As root
    yum install centos-release-scl-rh
    yum install devtoolset-7-gcc-c++
    # As deploying user
    CC=/opt/rh/devtoolset-7/root/usr/bin/gcc rbenv install 3.1.4 -v
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search