1. 環境
- rbenv: apt経由でインストール済
$ uname -a
Linux kali 6.19.14+kali-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.19.14-1+kali1 (2026-05-05) x86_64 GNU/Linux
$ sudo apt list --installed | grep -E "rbenv|ruby-build"
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
rbenv/kali-rolling,now 1.3.2-1 all [installed]
ruby-build/kali-rolling,now 20260902-1 all [installed,automatic]
ruby-builder/kali-rolling,now 3.3.0-1 all [installed,automatic]
$ ruby -v
ruby 3.3.8 (2025-04-09 revision b200bad6cd) [x86_64-linux-gnu]
$ rbenv -v
rbenv 1.3.2
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-linux-gnu/15/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 15.2.0-17' --with-bugurl=file:///usr/share/doc/gcc-15/README.Bugs --enable-languages=c,ada,c++,go,d,fortran,objc,obj-c++,m2,rust,cobol,algol68 --prefix=/usr --with-gcc-major-version-only --program-suffix=-15 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/libexec --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-libstdcxx-backtrace --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/reproducible-path/gcc-15-15.2.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/reproducible-path/gcc-15-15.2.0/debian/tmp-gcn/usr --enable-offload-defaulted --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=3
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.2.0 (Debian 15.2.0-17)
2. 普通にインストールを試みるとエラー
$ rbenv install 2.5.1
==> Downloading openssl-1.1.1w.tar.gz...
-> curl -q -fL -o openssl-1.1.1w.tar.gz https://www.openssl.org/source/openssl-1.1.1w.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 169 100 169 0 0 486 0 0
0 0 0 0 0 0 0 0 0
100 9.43M 100 9.43M 0 0 8.75M 0 00:01 00:01 0
==> Installing openssl-1.1.1w...
-> ./config "--prefix=$HOME/.rbenv/versions/2.5.1/openssl" "--openssldir=$HOME/.rbenv/versions/2.5.1/openssl/ssl" --libdir=lib zlib-dynamic no-ssl3 shared "-Wl,-rpath,$HOME/.rbenv/versions/2.5.1/openssl/lib"
-> make -j 4
-> make install_sw install_ssldirs
==> Installed openssl-1.1.1w to /home/kali/.rbenv/versions/2.5.1
==> Downloading ruby-2.5.1.tar.bz2...
-> curl -q -fL -o ruby-2.5.1.tar.bz2 https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.bz2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.35M 100 13.35M 0 0 7.53M 0 00:01 00:01 1.24M
==> Installing ruby-2.5.1...
WARNING: ruby-2.5.1 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
-> ./configure "--prefix=$HOME/.rbenv/versions/2.5.1" "--with-openssl-dir=$HOME/.rbenv/versions/2.5.1/openssl" --enable-shared --with-ext=openssl,psych,+
-> make -j 4
BUILD FAILED (Kali 2026.2 on x86_64 using ruby-build 20260902)
You can inspect the build directory at /tmp/ruby-build.20261010161916.132734.yq3j3S
See the full build log at /tmp/ruby-build.20261010161916.132734.log
ログのエラー箇所(抜粋)を以下に示す。
In file included from ./enc/euc_jp.c:503:
enc/jis/props.kwd:146:1: error: conflicting types for ‘onig_jis_property’; have ‘const struct enc_property *(const
char *, size_t)’ {aka ‘const struct enc_property *(const char *, long unsigned int)’}
enc/jis/props.kwd:40:35: note: previous declaration of ‘onig_jis_property’ with type ‘const struct enc_property *(v
oid)’
40 | static const struct enc_property *onig_jis_property(/*!ANSI{*/const char *str, unsigned int len/*}!ANSI*/);
| ^~~~~~~~~~~~~~~~~
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostic
s
cc1: note: unrecognized command-line option ‘-Wno-constant-logical-operand’ may have been intended to silence earli
er diagnostics
cc1: note: unrecognized command-line option ‘-Wno-parentheses-equality’ may have been intended to silence earlier d
iagnostics
make[1]: *** [enc.mk:620: enc/euc_jp.o] Error 1
make[1]: Leaving directory '/tmp/ruby-build.20261010161916.132734.yq3j3S/ruby-2.5.1'
make: *** [uncommon.mk:744: enc] Error 2
make: *** Waiting for unfinished jobs....
3. CFLAGSを設定するとインストール成功
参考: Ruby 3.1.3 fails to build on Fedora 42 · rbenv ruby-build · Discussion #2529 · GitHub
$ CFLAGS="-std=gnu17" rbenv install 2.5.1
==> Downloading openssl-1.1.1w.tar.gz...
-> curl -q -fL -o openssl-1.1.1w.tar.gz https://www.openssl.org/source/openssl-1.1.1w.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 169 100 169 0 0 367 0 0
0 0 0 0 0 0 0 0 0
100 9.43M 100 9.43M 0 0 6.61M 0 00:01 00:01 0
==> Installing openssl-1.1.1w...
-> ./config "--prefix=$HOME/.rbenv/versions/2.5.1/openssl" "--openssldir=$HOME/.rbenv/versions/2.5.1/openssl/ssl" --libdir=lib zlib-dynamic no-ssl3 shared "-Wl,-rpath,$HOME/.rbenv/versions/2.5.1/openssl/lib"
-> make -j 4
-> make install_sw install_ssldirs
==> Installed openssl-1.1.1w to /home/kali/.rbenv/versions/2.5.1
==> Downloading ruby-2.5.1.tar.bz2...
-> curl -q -fL -o ruby-2.5.1.tar.bz2 https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.bz2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.35M 100 13.35M 0 0 17.63M 0 0
==> Installing ruby-2.5.1...
WARNING: ruby-2.5.1 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
-> ./configure "--prefix=$HOME/.rbenv/versions/2.5.1" "--with-openssl-dir=$HOME/.rbenv/versions/2.5.1/openssl" --enable-shared --with-ext=openssl,psych,+
-> make -j 4
-> make install
==> Installed ruby-2.5.1 to /home/kali/.rbenv/versions/2.5.1
NOTE: to activate this Ruby version as the new default, run: rbenv global 2.5.1
4. 補足:RUBY_CONFIGURE_OPTSを使用した場合はエラー
上記同様の箇所でエラーが発生した。
$ RUBY_CONFIGURE_OPTS="--with-cflags=-std=gnu17" rbenv install 2.5.1
==> Downloading openssl-1.1.1w.tar.gz...
-> curl -q -fL -o openssl-1.1.1w.tar.gz https://www.openssl.org/source/openssl-1.1.1w.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 169 100 169 0 0 155 0 00:01 00:01 0
0 0 0 0 0 0 0 0 00:01 0
100 9.43M 100 9.43M 0 0 5.12M 0 00:01 00:01 0
==> Installing openssl-1.1.1w...
-> ./config "--prefix=$HOME/.rbenv/versions/2.5.1/openssl" "--openssldir=$HOME/.rbenv/versions/2.5.1/openssl/ssl" --libdir=lib zlib-dynamic no-ssl3 shared "-Wl,-rpath,$HOME/.rbenv/versions/2.5.1/openssl/lib"
-> make -j 4
-> make install_sw install_ssldirs
==> Installed openssl-1.1.1w to /home/kali/.rbenv/versions/2.5.1
==> Downloading ruby-2.5.1.tar.bz2...
-> curl -q -fL -o ruby-2.5.1.tar.bz2 https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.bz2
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.35M 100 13.35M 0 0 20.36M 0 0
==> Installing ruby-2.5.1...
WARNING: ruby-2.5.1 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
-> ./configure "--prefix=$HOME/.rbenv/versions/2.5.1" "--with-openssl-dir=$HOME/.rbenv/versions/2.5.1/openssl" --enable-shared --with-ext=openssl,psych,+ --with-cflags=-std=gnu17
-> make -j 4
BUILD FAILED (Kali 2026.2 on x86_64 using ruby-build 20260902)
You can inspect the build directory at /tmp/ruby-build.20261010170218.2521.J5WuFM
See the full build log at /tmp/ruby-build.20261010170218.2521.log







