Building ext/tk on Ubuntu 14.04

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
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.

Hi,

From: Joel VanderWerf [email protected]
Subject: building ext/tk on Ubuntu 14.04
Date: Sat, 09 Aug 2014 15:34:42 -0700
Message-ID: [email protected]

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.

Hi,

Try to load the tk.42 from the disk-nottheload.

Mr Brandon M. Ericsson
Student Colorado Technical University
major Computer Engineering


From: ruby-talk [email protected] on behalf of Hidetoshi
NAGAI [email protected]
Sent: Saturday, August 9, 2014 9:01 PM
To: [email protected]
Subject: Re: building ext/tk on Ubuntu 14.04

Hi,

From: Joel VanderWerf [email protected]
Subject: building ext/tk on Ubuntu 14.04
Date: Sat, 09 Aug 2014 15:34:42 -0700
Message-ID: [email protected]

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.

On 08/09/2014 08:01 PM, Hidetoshi NAGAI wrote:

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 tried more options:

CONFIGURE_ARGS=’–with-tcl-include=/usr/include/tcl8.5
–with-tcllib=tcl8.5 --with-tklib=tk8.5 --with-tcltkversion=8.5
–with-tk-include=/usr/include/tcl8.5
–with-tcl-lib=/usr/lib/x86_64-linux-gnu/
–with-tk-lib=/usr/lib/x86_64-linux-gnu/
–with-tclConfig-file=/usr/lib/tcl8.5/tclConfig.sh
–with-tkConfig-file=/usr/lib/tk8.5/tkConfig.sh’

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.

Brandon Ericsson <brandon.ericsson my.cs.coloradotech.edu> writes:

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.

Solved the mystery with 4 symlinks:

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
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

I guess the installation has some assumptions on the paths of those
files.

Mr. Brandon M. Ericsson
studentID: 14B8281076
[email protected]


From: ruby-talk [email protected] on behalf of Joel
VanderWerf [email protected]
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:

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 tried more options:

CONFIGURE_ARGS=‘–with-tcl-include=/usr/include/tcl8.5
–with-tcllib=tcl8.5 --with-tklib=tk8.5 --with-tcltkversion=8.5
–with-tk-include=/usr/include/tcl8.5
–with-tcl-lib=/usr/lib/x86_64-linux-gnu/
–with-tk-lib=/usr/lib/x86_64-linux-gnu/
–with-tclConfig-file=/usr/lib/tcl8.5/tclConfig.sh
–with-tkConfig-file=/usr/lib/tk8.5/tkConfig.sh’

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.