Error installing gtk2 gem

Hi all.

I try to install gtk2 gem on the latest version of kali-linux (based on debian) i have my project on github:

Hostbase
I code in ruby as a hobby.The gtk2 GUI work fine on debian 10 and xubuntu20.04 but seem to be buged on kali-linux latest version

Error appear after
gem instal gtk2

this command give me the following error message:

gem install gtk2
Building native extensions. This could take a while...
ERROR:  Error installing gtk2:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.7.0/gems/gobject-introspection-3.4.3/ext/gobject-introspection
/usr/bin/ruby2.7 -I /usr/local/lib/site_ruby/2.7.0 -r ./siteconf20201219-6486-hnt6dr.rb extconf.rb
checking for --enable-debug-build option... no
checking for -Wall option to compiler... yes
checking for -Waggregate-return option to compiler... yes
checking for -Wcast-align option to compiler... yes
checking for -Wextra option to compiler... yes
checking for -Wformat=2 option to compiler... yes
checking for -Winit-self option to compiler... yes
checking for -Wlarger-than-65500 option to compiler... yes
checking for -Wmissing-declarations option to compiler... yes
checking for -Wmissing-format-attribute option to compiler... yes
checking for -Wmissing-include-dirs option to compiler... yes
checking for -Wmissing-noreturn option to compiler... yes
checking for -Wmissing-prototypes option to compiler... yes
checking for -Wnested-externs option to compiler... no
checking for -Wold-style-definition option to compiler... yes
checking for -Wpacked option to compiler... yes
checking for -Wp,-D_FORTIFY_SOURCE=2 option to compiler... yes
checking for -Wpointer-arith option to compiler... yes
checking for -Wundef option to compiler... yes
checking for -Wout-of-line-declaration option to compiler... no
checking for -Wunsafe-loop-optimizations option to compiler... yes
checking for -Wwrite-strings option to compiler... yes
checking for Homebrew... no
checking for gobject-introspection-1.0... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/bin/$(RUBY_BASE_NAME)2.7
        --enable-debug-build
        --disable-debug-build
        --with-pkg-config
        --without-pkg-config
        --with-override-variables
        --without-override-variables

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.7.0/extensions/x86_64-linux/2.7.0/gobject-introspection-3.4.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.7.0/gems/gobject-introspection-3.4.3 for inspection.
Results logged to /var/lib/gems/2.7.0/extensions/x86_64-linux/2.7.0/gobject-introspection-3.4.3/gem_make.out

Here is my version of ruby:
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux-gnu]

I have already installed ruby-dev, rake, highline and bundler gems before try to install gtk2 gem.Here is my gem list:
*** LOCAL GEMS ***

atk (3.4.3)
benchmark (default: 0.1.0)
bigdecimal (default: 2.0.0)
bundler (2.2.2, default: 2.1.4)
cairo (1.16.6)
cairo-gobject (3.4.3)
cgi (default: 0.1.0)
columnize (0.9.0)
csv (default: 3.1.2)
date (default: 3.0.0)
dbm (default: 1.1.0)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.3.8)
delegate (default: 0.1.0)
did_you_mean (default: 1.4.0)
etc (default: 1.1.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.4.1)
forwardable (default: 1.3.1)
gdbm (default: 2.1.0)
getoptlong (default: 0.1.0)
glib2 (3.4.3)
highline (2.0.3)
io-console (default: 0.5.6)
ipaddr (default: 1.2.2)
irb (default: 1.2.6)
json (default: 2.3.0)
logger (default: 1.4.2)
matrix (default: 0.2.0)
minitest (5.13.0)
mutex_m (default: 0.1.0)
native-package-installer (1.0.9)
net-pop (default: 0.1.0)
net-smtp (default: 0.1.0)
net-telnet (0.1.1)
observer (default: 0.1.0)
open3 (default: 0.1.0)
openssl (default: 2.1.2)
ostruct (default: 0.2.0)
pkg-config (1.4.4)
power_assert (1.1.7)
prime (default: 0.1.1)
pstore (default: 0.1.0)
psych (default: 3.1.0)
racc (default: 1.4.16)
rake (13.0.2, 13.0.1)
rdoc (default: 6.2.1)
readline (default: 0.0.2)
readline-ext (default: 0.1.0)
reline (default: 0.1.5)
rexml (default: 3.2.3)
rss (default: 0.2.8)
sdbm (default: 1.0.0)
singleton (default: 0.1.0)
stringio (default: 0.1.0)
strscan (default: 1.0.3)
test-unit (3.3.5)
timeout (default: 0.1.0)
tracer (default: 0.1.0)
uri (default: 0.10.0)
webrick (default: 1.6.0)
xmlrpc (0.3.0)
yaml (default: 0.1.0)
zlib (default: 1.1.0)

Aby idéa ?

Try running:

$ sudo apt install gobject-introspection 

I think there’s another staright forward way to install it:

sudo apt install ruby-gtk2

You can also try installing GTK3, which is just better than GTK2… Especially with modern themes…

Thanks for you answer, it works !

Im going to show gt3 now :slight_smile: