Forum: Ruby building ext/tk on Ubuntu 14.04

0e6ac58dab6125c1cd2e7ac645076b6f?d=identicon&s=25 Joel VanderWerf (Guest)
on 2014-08-10 00:35
(Received via mailing list)
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.
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2014-08-10 05:01
(Received via mailing list)
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.
3933dc21a448bdfebdba4b769e643706?d=identicon&s=25 Brandon Ericsson (Guest)
on 2014-08-10 06:39
(Received via mailing list)
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 <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.
0e6ac58dab6125c1cd2e7ac645076b6f?d=identicon&s=25 Joel VanderWerf (Guest)
on 2014-08-10 21:11
(Received via mailing list)
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.
3933dc21a448bdfebdba4b769e643706?d=identicon&s=25 Brandon Ericsson (Guest)
on 2014-08-11 02:02
(Received via mailing list)
>

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:
> 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.
Ee662a0ddb22652f614486f529bb06ec?d=identicon&s=25 P W (Guest)
on 2014-11-18 04:38
(Received via mailing list)
Brandon Ericsson <brandon.ericsson <at> 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.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.