BUILD FAILED error when installing ruby ​​2.4.3

BUILD FAILED error when installing ruby ​​2.4.3

Error occurred when installing ruby ​​2.4.3 on MacOS Big Sur 11.2.2

% rbenv install 2.4.3
Downloading openssl-1.1.1k.tar.gz...
-> https://dqw8nmjcqpjn7.cloudfront.net/892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5
Installing openssl-1.1.1k...
Installed openssl-1.1.1k to /Users/satou/.rbenv/versions/2.4.3

Downloading ruby-2.4.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.3.tar.bz2
Installing ruby-2.4.3...

WARNING: ruby-2.4.3 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.

ruby-build: using readline from homebrew

BUILD FAILED (macOS 11.2.2 using ruby-build 20210423)

Inspect or clean up the working tree at /var/folders/h3/4830l_xd6hj1msdhp0v_s3j40000gn/T/ruby-build.20210429133129.9166.uvvuHD
Results logged to /var/folders/h3/4830l_xd6hj1msdhp0v_s3j40000gn/T/ruby-build.20210429133129.9166.log

Last 10 log lines:
compiling fiber.c
linking shared-object fiber.bundle
compiling closure.c
closure.c:263:14: error: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    result = ffi_prep_closure(pcl, cif, callback, (void *)self);
             ^
1 error generated.
make[2]: *** [closure.o] Error 1
make[1]: *** [ext/fiddle/all] Error 2
make: *** [build-ext] Error 2

solve

Solved by the following command

% RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC rbenv install 2.4.3  


Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *