Building Perl-Tk on Fedora x86_64

  • Posted on: 25 May 2004
  • By: agittins

Update: Better than building from source, AT-rpms has a perl-Tk rpm in their yum repository - this is a far cleaner method of installing Tk. Add the following to your /etc/yum.conf:

name=ATrpms for Fedora Core $releasever stable

I would strongly recommend you use the above method rather than installing from source via cpan, but if you must....

Getting Tk working on a Fedora AMD64 box is simple - once you know how, of course. Redhat / the Fedora crew have been kind enough to supply a wrapper for the cpan console, so getting in to start with is really easy...

# cpan

(told you it was easy).

If you haven't used cpan before, it will walk you through setting up your defaults first. It asks for locations of things like wget and so forth, and prompts you to select a suitable mirror based on your location. Fedora doesn't seem to come with ncftp, and right or wrong, I just gave it the path to wget instead. Worst that could happen is it doesn't work or trashes your cpan build area. The other stuff it works out itself pretty well.

Once you have cpan configured, you will end up at a cpan prompt- "cpan>__". Enter the following command:

cpan>_ install Tk

Cpan will trundle off, grab the latest Tk package (804.027 as of right now) and start building it. It will fail (you probably knew that, otherwise why would you have googled for just the right terms to end up here?). make fails with an LD error about not being able to find -lX11 (libX11). Sure, it's on your system, but being an x86_64 build it's in /usr/X11R6/lib64, not /usr/X11R6/lib. This is a common problem when building stuff on an AMD64 rig, so you'll get used to it in time. Anyway, give cpan the "quit" command, and we'll go fix it ourselves.

During the cpan configuration you gave it a temporary path in which to do it's mojo. I think from memory it's something like /home/username/.cpan, I set mine to /tmp/cpan just for fun. Go into the cpan temp directory, then into build, then the Tk dir, and crack open the top-level makefile - in my case:

cd /tmp/cpan/build/Tk-804.027
vi Makefile

Find every occurence of "X11R6/lib" and replace it with "X11R6/lib64". Then save the makefile.

Issue the following - you shouldn't get any errors for this, but check after each step to ensure things have worked (note that cpan already did the configure, and most of the make, so this shouldn't take long).

# make
# make install

You should now be set with a working 64-bit Perl-Tk installation. If you don't believe me, you can run "make test" to get Tk to do it's own self-test thingy, during which it will pop up windows on the screen demonstrating it's features. A number of tests do fail on mine, but I suspect that might be usual, at any rate, it works fine for what I use it for.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.