Skip to content

gem install trtl fails to install the gem #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Hellfar opened this issue May 2, 2017 · 6 comments
Open

gem install trtl fails to install the gem #5

Hellfar opened this issue May 2, 2017 · 6 comments

Comments

@Hellfar
Copy link

Hellfar commented May 2, 2017

Hi,

It seems that we can't install the gem using gem install trtl.

Under ruby --version (2.3.0):

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

    current directory: /home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/tk-0.1.2/ext/tk
/home/user/.rbenv/versions/2.3.0/bin/ruby -r ./siteconf20170502-12888-1ct74ew.rb extconf.rb
check functions.checking for ruby_native_thread_p() in ruby.h... yes
checking for rb_errinfo() in ruby.h... yes
checking for rb_safe_level() in ruby.h... yes
checking for rb_hash_lookup() in ruby.h... yes
checking for rb_proc_new() in ruby.h... yes
checking for rb_obj_untrust() in ruby.h... yes
checking for rb_obj_taint() in ruby.h... yes
checking for rb_set_safe_level_force() in ruby.h... yes
checking for rb_sourcefile() in ruby.h... yes
checking for rb_thread_alive_p() in ruby.h... no
checking for rb_thread_check_trap_pending() in ruby.h... yes
checking for ruby_enc_find_basename() in ruby.h... yes
check libraries.checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for dlopen() in -ldl... yes
checking for log() in -lm... yes
Use ActiveTcl libraries (if available).
Search tclConfig.sh and tkConfig.sh.
Fail to find [tclConfig.sh, tkConfig.sh]
Use X11 libraries (or use TK_XINCLUDES/TK_XLIBSW information on tkConfig.sh).
checking for XOpenDisplay() in -lX11... yes
Search tcl.h
checking for tcl.h... no
Search tk.h
checking for tk.h... no
Search Tcl library............Search Tcl library............*** 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=/home/user/.rbenv/versions/2.3.0/bin/$(RUBY_BASE_NAME)
	--enable-shared
	--disable-shared
	--with-tk-old-extconf
	--without-tk-old-extconf
	--with-tk-old-extconf
	--without-tk-old-extconf
	--with-ActiveTcl
	--without-ActiveTcl
	--with-tk-shlib-search-path
	--without-tk-shlib-search-path
	--with-tcltkversion
	--without-tcltkversion
	--with-tcl-build-dir
	--without-tcl-build-dir
	--with-tk-build-dir
	--without-tk-build-dir
	--with-tcl-config
	--without-tcl-config
	--with-tk-config
	--without-tk-config
	--with-tclConfig-dir
	--without-tclConfig-dir
	--with-tkConfig-dir
	--without-tkConfig-dir
	--with-tclConfig-file
	--without-tclConfig-file
	--with-tkConfig-file
	--without-tkConfig-file
	--with-tcllib
	--without-tcllib
	--with-tklib
	--without-tklib
	--with-tcl-dir
	--without-tcl-dir
	--with-tk-dir
	--without-tk-dir
	--with-tcl-include
	--without-tcl-include
	--with-tk-include
	--without-tk-include
	--with-tcl-lib
	--without-tcl-lib
	--with-tk-lib
	--without-tk-lib
	--with-tcltk-framework
	--without-tcltk-framework
	--with-tcl-framework-dir
	--without-tcl-framework-dir
	--with-tk-framework-dir
	--without-tk-framework-dir
	--with-tcl-framework-header
	--without-tcl-framework-header
	--with-tk-framework-header
	--without-tk-framework-header
	--with-X11
	--without-X11
	--with-X11-dir
	--without-X11-dir
	--with-X11-include
	--without-X11-include
	--with-X11-lib
	--without-X11-lib
	--enable-tcltk-stubs
	--disable-tcltk-stubs
	--enable-tcl-h-ver-check
	--disable-tcl-h-ver-check
	--enable-tk-h-ver-check
	--disable-tk-h-ver-check
	--enable-mac-tcltk-framework
	--disable-mac-tcltk-framework
	--enable-tcltk-framework
	--disable-tcltk-framework
	--enable-pthread
	--disable-pthread
	--enable-tcl-thread
	--disable-tcl-thread
	--enable-space-on-tk-libpath
	--disable-space-on-tk-libpath
	--with-nsllib
	--without-nsllib
	--with-socketlib
	--without-socketlib
	--with-dllib
	--without-dllib
	--with-mlib
	--without-mlib
	--with-tcl-build-dir
	--without-tcl-build-dir
	--with-tk-build-dir
	--without-tk-build-dir
	--with-tcltkversion
	--without-tcltkversion
	--with-ActiveTcl
	--without-ActiveTcl
	--enable-space-on-tk-libpath
	--disable-space-on-tk-libpath
	--enable-tcltk-stubs
	--disable-tcltk-stubs
	--with-tcltk-stubs
	--without-tcltk-stubs
	--with-tcl-dir
	--without-tcl-dir
	--with-tcl-include
	--without-tcl-include=${tcl-dir}/include
	--with-tcl-lib
	--without-tcl-lib=${tcl-dir}/lib
	--with-tk-dir
	--without-tk-dir
	--with-tk-include
	--without-tk-include=${tk-dir}/include
	--with-tk-lib
	--without-tk-lib=${tk-dir}/lib
	--with-tclConfig-file
	--without-tclConfig-file
	--with-tkConfig-file
	--without-tkConfig-file
	--with-tclConfig-dir
	--without-tclConfig-dir
	--with-tkConfig-dir
	--without-tkConfig-dir
	--with-tcl-framework-header
	--without-tcl-framework-header
	--with-tk-framework-header
	--without-tk-framework-header
	--with-tcl-framework-dir
	--without-tcl-framework-dir
	--with-tk-framework-dir
	--without-tk-framework-dir
	--with-tcltk-framework
	--without-tcltk-framework
	--enable-tcltk-framework
	--disable-tcltk-framework
	--with-tcltk-framework
	--without-tcltk-framework
	--enable-tcltk-framework
	--disable-tcltk-framework
	--enable-mac-tcltk-framework
	--disable-mac-tcltk-framework
	--with-tk-shlib-search-path
	--without-tk-shlib-search-path
	--with-tklib
	--without-tklib
	--with-tcllib
	--without-tcllib
	--with-X11
	--without-X11
	--with-X11-dir
	--without-X11-dir
	--with-X11-include
	--without-X11-include=${X11-dir}/include
	--with-X11-lib
	--without-X11-lib=${X11-dir}/lib
	--with-X11-lib
	--without-X11-lib
	--with-X11lib
	--without-X11lib
	--enable-tcl-h-ver-check
	--disable-tcl-h-ver-check
	--enable-tk-h-ver-check
	--disable-tk-h-ver-check

Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.

Can't find proper Tcl/Tk libraries. So, can't make tcltklib.so which is required by Ruby/Tk.
If you have Tcl/Tk libraries on your environment, you may be able to use them with configure options (see ext/tk/README.tcltklib).
At present, Tcl/Tk8.6 is not supported. Although you can try to use Tcl/Tk8.6 with configure options, it will not work correctly. I recommend you to use Tcl/Tk8.5 or 8.4.

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

  /home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/tk-0.1.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/tk-0.1.2 for inspection.
Results logged to /home/user/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/tk-0.1.2/gem_make.out

Under ruby --version (2.4.0):

Fetching: tk-0.1.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing trtl:
	ERROR: Failed to build gem native extension.

    current directory: /home/user/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/tk-0.1.2/ext/tk
/home/user/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20170502-25746-1qytk2a.rb extconf.rb
check functions.checking for ruby_native_thread_p() in ruby.h... yes
checking for rb_errinfo() in ruby.h... yes
checking for rb_safe_level() in ruby.h... yes
checking for rb_hash_lookup() in ruby.h... yes
checking for rb_proc_new() in ruby.h... yes
checking for rb_obj_untrust() in ruby.h... yes
checking for rb_obj_taint() in ruby.h... yes
checking for rb_set_safe_level_force() in ruby.h... yes
checking for rb_sourcefile() in ruby.h... yes
checking for rb_thread_alive_p() in ruby.h... no
checking for rb_thread_check_trap_pending() in ruby.h... yes
checking for ruby_enc_find_basename() in ruby.h... yes
check libraries.checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for dlopen() in -ldl... yes
checking for log() in -lm... yes
Use ActiveTcl libraries (if available).
Search tclConfig.sh and tkConfig.sh.
Fail to find [tclConfig.sh, tkConfig.sh]
Use X11 libraries (or use TK_XINCLUDES/TK_XLIBSW information on tkConfig.sh).
checking for XOpenDisplay() in -lX11... yes
Search tcl.h
checking for tcl.h... no
Search tk.h
checking for tk.h... no
Search Tcl library............Search Tcl library............*** 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=/home/user/.rbenv/versions/2.4.0/bin/$(RUBY_BASE_NAME)
	--enable-shared
	--disable-shared
	--with-tk-old-extconf
	--without-tk-old-extconf
	--with-tk-old-extconf
	--without-tk-old-extconf
	--with-ActiveTcl
	--without-ActiveTcl
	--with-tk-shlib-search-path
	--without-tk-shlib-search-path
	--with-tcltkversion
	--without-tcltkversion
	--with-tcl-build-dir
	--without-tcl-build-dir
	--with-tk-build-dir
	--without-tk-build-dir
	--with-tcl-config
	--without-tcl-config
	--with-tk-config
	--without-tk-config
	--with-tclConfig-dir
	--without-tclConfig-dir
	--with-tkConfig-dir
	--without-tkConfig-dir
	--with-tclConfig-file
	--without-tclConfig-file
	--with-tkConfig-file
	--without-tkConfig-file
	--with-tcllib
	--without-tcllib
	--with-tklib
	--without-tklib
	--with-tcl-dir
	--without-tcl-dir
	--with-tk-dir
	--without-tk-dir
	--with-tcl-include
	--without-tcl-include
	--with-tk-include
	--without-tk-include
	--with-tcl-lib
	--without-tcl-lib
	--with-tk-lib
	--without-tk-lib
	--with-tcltk-framework
	--without-tcltk-framework
	--with-tcl-framework-dir
	--without-tcl-framework-dir
	--with-tk-framework-dir
	--without-tk-framework-dir
	--with-tcl-framework-header
	--without-tcl-framework-header
	--with-tk-framework-header
	--without-tk-framework-header
	--with-X11
	--without-X11
	--with-X11-dir
	--without-X11-dir
	--with-X11-include
	--without-X11-include
	--with-X11-lib
	--without-X11-lib
	--enable-tcltk-stubs
	--disable-tcltk-stubs
	--enable-tcl-h-ver-check
	--disable-tcl-h-ver-check
	--enable-tk-h-ver-check
	--disable-tk-h-ver-check
	--enable-mac-tcltk-framework
	--disable-mac-tcltk-framework
	--enable-tcltk-framework
	--disable-tcltk-framework
	--enable-pthread
	--disable-pthread
	--enable-tcl-thread
	--disable-tcl-thread
	--enable-space-on-tk-libpath
	--disable-space-on-tk-libpath
	--with-nsllib
	--without-nsllib
	--with-socketlib
	--without-socketlib
	--with-dllib
	--without-dllib
	--with-mlib
	--without-mlib
	--with-tcl-build-dir
	--without-tcl-build-dir
	--with-tk-build-dir
	--without-tk-build-dir
	--with-tcltkversion
	--without-tcltkversion
	--with-ActiveTcl
	--without-ActiveTcl
	--enable-space-on-tk-libpath
	--disable-space-on-tk-libpath
	--enable-tcltk-stubs
	--disable-tcltk-stubs
	--with-tcltk-stubs
	--without-tcltk-stubs
	--with-tcl-dir
	--without-tcl-dir
	--with-tcl-include
	--without-tcl-include=${tcl-dir}/include
	--with-tcl-lib
	--without-tcl-lib=${tcl-dir}/lib
	--with-tk-dir
	--without-tk-dir
	--with-tk-include
	--without-tk-include=${tk-dir}/include
	--with-tk-lib
	--without-tk-lib=${tk-dir}/lib
	--with-tclConfig-file
	--without-tclConfig-file
	--with-tkConfig-file
	--without-tkConfig-file
	--with-tclConfig-dir
	--without-tclConfig-dir
	--with-tkConfig-dir
	--without-tkConfig-dir
	--with-tcl-framework-header
	--without-tcl-framework-header
	--with-tk-framework-header
	--without-tk-framework-header
	--with-tcl-framework-dir
	--without-tcl-framework-dir
	--with-tk-framework-dir
	--without-tk-framework-dir
	--with-tcltk-framework
	--without-tcltk-framework
	--enable-tcltk-framework
	--disable-tcltk-framework
	--with-tcltk-framework
	--without-tcltk-framework
	--enable-tcltk-framework
	--disable-tcltk-framework
	--enable-mac-tcltk-framework
	--disable-mac-tcltk-framework
	--with-tk-shlib-search-path
	--without-tk-shlib-search-path
	--with-tklib
	--without-tklib
	--with-tcllib
	--without-tcllib
	--with-X11
	--without-X11
	--with-X11-dir
	--without-X11-dir
	--with-X11-include
	--without-X11-include=${X11-dir}/include
	--with-X11-lib
	--without-X11-lib=${X11-dir}/lib
	--with-X11-lib
	--without-X11-lib
	--with-X11lib
	--without-X11lib
	--enable-tcl-h-ver-check
	--disable-tcl-h-ver-check
	--enable-tk-h-ver-check
	--disable-tk-h-ver-check

Warning:: cannot find Tcl library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options.

Can't find proper Tcl/Tk libraries. So, can't make tcltklib.so which is required by Ruby/Tk.
If you have Tcl/Tk libraries on your environment, you may be able to use them with configure options (see ext/tk/README.tcltklib).
At present, Tcl/Tk8.6 is not supported. Although you can try to use Tcl/Tk8.6 with configure options, it will not work correctly. I recommend you to use Tcl/Tk8.5 or 8.4.

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

  /home/user/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/tk-0.1.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/user/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/tk-0.1.2 for inspection.
Results logged to /home/user/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/tk-0.1.2/gem_make.out

Do not hesitate for more informations if I can help :) .

@peterc
Copy link
Owner

peterc commented May 2, 2017

Unfortunately the Tk system that Trtl relies upon was no longer included with Ruby as of.. Ruby 2.1-ish, so now it's installed as a regular third party gem. The downside is this means on setups without the right system libraries, it can be tricky to install.

Both error messages in your case are complaining that the Tcl libraries required to install Ruby's bindings to Tk are not available, so you'd need to install those at the system level first. What OS are you on? I'm guessing a Linux of some sort based on one of the pathnames.

You'll want to search for "tcl/tk libraries" for your platform, particularly version 8.5, as 8.6 is not supported by Ruby's tk gem. If you're on Ubuntu you might try apt-get install tk8.5-dev tk8.5 but I can't guarantee that.

@ghost
Copy link

ghost commented Oct 7, 2017

On the debian-based systems one usually has to uncripple the packages. I always found the biggest hurdle to be to find out the names in use (I use slackware and GoboLinux myself).

By the way, I just compiled both tcl and tk, then installed the tk gem and then the turtle, and it all installed on my system fine. Debian-based systems really get into the way.

URLs I used were:

http://downloads.sourceforge.net/tcl/tcl8.6.7-src.tar.gz
http://downloads.sourceforge.net/tcl/tk8.6.7-src.tar.gz
https://rubygems.org/gems/tk
https://rubygems.org/gems/trtl

The above error is simple to solve - just install the package that includes tcl.h and tk.h.

Or use slackware, it gets less into the way. :D (I track many programs via my cookbooks
gem; I simply got tired of distributions forcing their way onto me many years ago.)

@ericmathison
Copy link

ericmathison commented May 5, 2020

These instructions worked well for me on Ubuntu 18.04:
https://saveriomiroddi.github.io/Installing-ruby-tk-bindings-gem-on-ubuntu/

In addition to installing the packages Peter mentions above, they suggest symlinking the libraries:

sudo ln -s /usr/lib/x86_64-linux-gnu/tcl8.5/tclConfig.sh /usr/lib/tclConfig.sh
sudo ln -s /usr/lib/x86_64-linux-gnu/tk8.5/tkConfig.sh /usr/lib/tkConfig.sh
sudo ln -s /usr/lib/x86_64-linux-gnu/libtcl8.5.so.0 /usr/lib/libtcl8.5.so.0
sudo ln -s /usr/lib/x86_64-linux-gnu/libtk8.5.so.0 /usr/lib/libtk8.5.so.0

@64kramsystem
Copy link

I hope it's not necroposting, but the article has been updated, with a cleaner approach to the issue. Specifically, install the gem via:

$ gem install tk -- \
  --with-tcltkversion="$latest_version" \
  --with-tcl-lib=/usr/lib/x86_64-linux-gnu \
  --with-tk-lib=/usr/lib/x86_64-linux-gnu \
  --with-tcl-include=/usr/include/tcl"$latest_version" \
  --with-tk-include=/usr/include/tcl"$latest_version" \
  --enable-pthread

but the symlinking approach works as well 😄

@peterc
Copy link
Owner

peterc commented Sep 29, 2021

I'm not in a position to test all of this yet, but I will add a note to the README pointing here in case anyone is having difficulties. Thanks!

@hardkorebob
Copy link

hardkorebob commented Oct 11, 2023

sudo gem install tk -- --with-tcltkversion=8.6 \
--with-tcl-lib=/usr/lib/x86_64-linux-gnu \
--with-tk-lib=/usr/lib/x86_64-linux-gnu \
--with-tcl-include=/usr/include/tcl8.6 \
--with-tk-include=/usr/include/tcl8.6 \
--enable-pthread

I can confirm this is working on
Linux kali 6.5.0-kali2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.3-1kali2 (2023-10-03) x86_64 GNU/Linux

┌──(bob㉿kali)-[~]
└─$ sudo gem install trtl
[sudo] password for bob:
Fetching trtl-0.0.2.gem
Successfully installed trtl-0.0.2
Parsing documentation for trtl-0.0.2
Installing ri documentation for trtl-0.0.2
Done installing documentation for trtl after 1 seconds
1 gem installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants