質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Tcl

Tclは、インタープリタ型のプログラミング言語。リスト処理や連想配列といった特長を持ち、文法もシンプルです。拡張や他言語への組み込みが簡単にでき、アプリケーション拡張にための組み込み言語として用いられます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Q&A

解決済

1回答

3378閲覧

Ruby/Tk インストールできないです

qiyuren

総合スコア29

Tcl

Tclは、インタープリタ型のプログラミング言語。リスト処理や連想配列といった特長を持ち、文法もシンプルです。拡張や他言語への組み込みが簡単にでき、アプリケーション拡張にための組み込み言語として用いられます。

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

0グッド

0クリップ

投稿2020/12/15 05:16

編集2020/12/15 07:57

Ruby/Tkをgem install tkでインストールしようとしたら、以下のエラーが出ました。解決策を調べてもhitせず、お力をお借りできれば幸いです。

Fail to find [tclConfig.sh, tkConfig.sh]が肝だと思うのですが。。

発生している問題・エラーメッセージ

~ $ gem install tk Fetching tk-0.3.0.gem Building native extensions. This could take a while... ERROR: Error installing tk: ERROR: Failed to build gem native extension. current directory: /Users/****/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/tk-0.3.0/ext/tk /Users/****/.rbenv/versions/2.6.5/bin/ruby -I /Users/****/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20201215-2090-g0qb3m.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_hash_lookup() in ruby.h... yes checking for rb_proc_new() 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... 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: ~~~略~~~ Warning:: cannot find X11 library. tcltklib will not be compiled (tcltklib is disabled on your Ruby. That is, Ruby/Tk will not work). Please check configure options. If your Tcl/Tk don't require X11, please try --without-X11. Can't find X11 libraries. So, can't make tcltklib.so which is required by Ruby/Tk. To see why this extension failed to compile, please check the mkmf.log which can be found here: /Users/****/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/tk-0.3.0/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/****/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/tk-0.3.0 for inspection. Results logged to /Users/****/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/tk-0.3.0/gem_make.out

試したこと

mdfindでtclConfig.sh, tkConfig.shを探しましたが存在しました。

/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/tkConfig.sh

/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tcl.framework/Versions/8.5/tclConfig.sh

また、以下のURLを参考に、以下のように実行し、再度インストールしたら、エラーが変わりました。
tk/tclライブラリが見つからないようですが、適切なライブラリがどこにあるのか、わかりません。。

https://qiita.com/ftakao2007/items/230050be7351db49383d
https://github.com/ruby/tk/blob/master/README.tcltklib
http://www.mit.edu/afs.new/sipb/service/restore/ruby-lang/src/ruby-1.8.4/ext/tk/README.tcltklib

$ RUBY_CONFIGURE_OPTS="--with-tcltkversion=8.5 \ --with-tcl-lib=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tcl.framework/Versions/8.5 \ --with-tk-lib=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5 \ --enable-pthread --enable-shared" rbenv install 2.6.5 $ gem install tk Building native extensions. This could take a while... ERROR: Error installing tk: ERROR: Failed to build gem native extension. current directory: /Users/****/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/tk-0.3.0/ext/tk /Users/****/.rbenv/versions/2.6.5/bin/ruby -I /Users/****/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20201215-15693-14ro7nf.rb extconf.rb Configure options for Ruby/Tk may be updated. So, delete files which depend on old configs. check functions.checking for ruby_native_thread_p() in ruby.h... yes checking for rb_errinfo() 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_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 Specified Tcl/Tk version is ["8.5", "8.5"] Use ActiveTcl libraries (if available). Search tclConfig.sh and tkConfig.sh. Fail to find [tclConfig.sh, tkConfig.sh] Search tcl.h checking for tcl.h... yes Search tk.h checking for tk.h... yes Search Tcl library.checking for Tcl_FindExecutable() in -ltclstub8.5... no .checking for Tcl_FindExecutable() in -ltclstub8.5... no .checking for Tcl_FindExecutable() in -ltclstub8.5... no .checking for Tcl_FindExecutable() in -ltclstub8.5... 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: ~~~略~~~ 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: /Users/****/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/tk-0.3.0/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /Users/****/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/tk-0.3.0 for inspection. Results logged to /Users/****/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-19/2.6.0/tk-0.3.0/gem_make.out

補足情報(FW/ツールのバージョンなど)

Ruby 2.6.5
MacOS Catalina10.15.7

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

FKM

2020/12/15 07:58

Tcl/Tk8.6 is not supportedとなっているので、バージョンが合っていないのでは?
qiyuren

2020/12/20 09:24

tclshでtcl_versionを確認したところ8.5でした
guest

回答1

0

自己解決

gem install tk -- --with-tcltkversion=8.5 --with-tcllib=tclstub8.5 --with-tklib=tkstub8.5 --enable-tcltk_stubs

で無事インストールできました。

投稿2020/12/20 09:25

qiyuren

総合スコア29

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問