In case anyone else is struggling with getting the Tk extension to work on Ubuntu 14.04, ruby 2.1:
Don't use the system (deb) versions of tk8.5 (which should work) or tk8.6 (which is known not to work with tkruby). Instead, get tcl and tk tarballs from http://tcl.tk, and configure with pthreads:
./configure --enable-threads
Build and install normally.
Then build tk and tkutil normally:
cd <ruby-source-dir>
cd ext/tk
ruby extconf.rb && make && sudo make install
cd tkutil
ruby extconf.rb && make && sudo make install
I don't know why the packaged tk8.5 doesn't work, even with all relevant CONFIGURE_ARGS set for extconf.rb.
From: Joel VanderWerf <joelvanderwerf@gmail.com>
Subject: building ext/tk on Ubuntu 14.04
Date: Sat, 09 Aug 2014 15:34:42 -0700
Message-ID: <53E6A202.7050106@gmail.com>
I don't know why the packaged tk8.5 doesn't work, even with all
relevant CONFIGURE_ARGS set for extconf.rb.
Would you try to give proper options for tcltklib decribed in
"ext/tk/README.tcltklib" ?
tcltklib.so should be compiled, when extconf.rb finds proper
tclConfig.sh/tkConfig.sh by auto or configure options.
If multiple versions of Tcl/Tk on your environment, please teach
the proper files by configure options.
When you fail to compile even if give enough options,
please report messages and logs.
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
Department of Artificial Intelligence, Kyushu Institute of Technology
Mr Brandon M. Ericsson
Student Colorado Technical University
major Computer Engineering
···
________________________________________
From: ruby-talk <ruby-talk-bounces@ruby-lang.org> on behalf of Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
Sent: Saturday, August 9, 2014 9:01 PM
To: ruby-talk@ruby-lang.org
Subject: Re: building ext/tk on Ubuntu 14.04
Hi,
From: Joel VanderWerf <joelvanderwerf@gmail.com>
Subject: building ext/tk on Ubuntu 14.04
Date: Sat, 09 Aug 2014 15:34:42 -0700
Message-ID: <53E6A202.7050106@gmail.com>
I don't know why the packaged tk8.5 doesn't work, even with all
relevant CONFIGURE_ARGS set for extconf.rb.
Would you try to give proper options for tcltklib decribed in
"ext/tk/README.tcltklib" ?
tcltklib.so should be compiled, when extconf.rb finds proper
tclConfig.sh/tkConfig.sh by auto or configure options.
If multiple versions of Tcl/Tk on your environment, please teach
the proper files by configure options.
When you fail to compile even if give enough options,
please report messages and logs.
--
Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)
Department of Artificial Intelligence, Kyushu Institute of Technology
cd ext/tk && make distclean && CONFIGURE_ARGS='--with-tcl-include=/usr/include/tcl8.5 --with-tcllib=tcl8.5 --with-tklib=tk8.5' ruby extconf.rb
This used to work for me a few years ago (ubuntu 12.04 and ruby 2.0, IIRC). (Building tkutil the same way.)
After doing this, `ldd *.so` says that libtk8.6.so is a dependency, and the examples segfault, probably as expected. In the makefile, I noticed "-ltk", which should have been "-ltk8.5".
I also removed the 8.6 installation. IIRC, this got me to the point of correctly linking with 8.5, but then there was something else... IIRC it was the warning that pthreads should be enabled in both or disabled in both. Anyway, I wanted to keep 8.6 because some other packages depend on it. So I gave up and built from source.
···
On 08/09/2014 08:01 PM, Hidetoshi NAGAI wrote:
Hi,
From: Joel VanderWerf <joelvanderwerf@gmail.com>
Subject: building ext/tk on Ubuntu 14.04
Date: Sat, 09 Aug 2014 15:34:42 -0700
Message-ID: <53E6A202.7050106@gmail.com>
I don't know why the packaged tk8.5 doesn't work, even with all
relevant CONFIGURE_ARGS set for extconf.rb.
Would you try to give proper options for tcltklib decribed in
"ext/tk/README.tcltklib" ?
tcltklib.so should be compiled, when extconf.rb finds proper
tclConfig.sh/tkConfig.sh by auto or configure options.
If multiple versions of Tcl/Tk on your environment, please teach
the proper files by configure options.
When you fail to compile even if give enough options,
please report messages and logs.
Mr. Brandon M. Ericsson
studentID: 14B8281076
brandon.ericsson@coloradotech.edu
···
________________________________________
From: ruby-talk <ruby-talk-bounces@ruby-lang.org> on behalf of Joel VanderWerf <joelvanderwerf@gmail.com>
Sent: Sunday, August 10, 2014 1:10 PM
To: Ruby users
Subject: Re: building ext/tk on Ubuntu 14.04
On 08/09/2014 08:01 PM, Hidetoshi NAGAI wrote:
Hi,
From: Joel VanderWerf <joelvanderwerf@gmail.com>
Subject: building ext/tk on Ubuntu 14.04
Date: Sat, 09 Aug 2014 15:34:42 -0700
Message-ID: <53E6A202.7050106@gmail.com>
I don't know why the packaged tk8.5 doesn't work, even with all
relevant CONFIGURE_ARGS set for extconf.rb.
Would you try to give proper options for tcltklib decribed in
"ext/tk/README.tcltklib" ?
tcltklib.so should be compiled, when extconf.rb finds proper
tclConfig.sh/tkConfig.sh by auto or configure options.
If multiple versions of Tcl/Tk on your environment, please teach
the proper files by configure options.
When you fail to compile even if give enough options,
please report messages and logs.
Here's what I tried first:
cd ext/tk && make distclean &&
CONFIGURE_ARGS='--with-tcl-include=/usr/include/tcl8.5
--with-tcllib=tcl8.5 --with-tklib=tk8.5' ruby extconf.rb
This used to work for me a few years ago (ubuntu 12.04 and ruby 2.0,
IIRC). (Building tkutil the same way.)
After doing this, `ldd *.so` says that libtk8.6.so is a dependency, and
the examples segfault, probably as expected. In the makefile, I noticed
"-ltk", which should have been "-ltk8.5".
I also removed the 8.6 installation. IIRC, this got me to the point of
correctly linking with 8.5, but then there was something else... IIRC it
was the warning that pthreads should be enabled in both or disabled in
both. Anyway, I wanted to keep 8.6 because some other packages depend on
it. So I gave up and built from source.
I also removed the 8.6 installation. IIRC, this got me to the point of
correctly linking with 8.5, but then there was something else... IIRC it
was the warning that pthreads should be enabled in both or disabled in
both. Anyway, I wanted to keep 8.6 because some other packages depend on
it. So I gave up and built from source.