Wooters has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks I'm running Perl 5.12.1 on Ubuntu 10.04 and I've tried installing the Tk module for Perl thusly:
sudo perl -MCPAN -e "install Tk"
However, the installation process always fails giving me this:
: libpng.a make[2]: Leaving directory `/home/james/.local/share/.cpan/build/Tk-80 +4.029-XzKN_H/PNG/libpng' make[2]: Entering directory `/home/james/.local/share/.cpan/build/Tk-8 +04.029-XzKN_H/PNG/libpng' cc -fPIC -c -Wall -O2 -I../zlib pngtest.c cc -fPIC -s -L../zlib -o pngtest pngtest.o libpng.a -lz -lm libpng.a(png.o): In function `png_init_mmx_flags': png.c:(.text+0x8f): undefined reference to `png_mmx_support' libpng.a(pngread.o): In function `png_read_row': pngread.c:(.text+0xc61): undefined reference to `png_combine_row' pngread.c:(.text+0xc87): undefined reference to `png_combine_row' pngread.c:(.text+0xd16): undefined reference to `png_combine_row' pngread.c:(.text+0xd2f): undefined reference to `png_combine_row' pngread.c:(.text+0xd63): undefined reference to `png_read_filter_row' pngread.c:(.text+0xd8b): undefined reference to `png_do_read_interlace +' pngread.c:(.text+0xdde): undefined reference to `png_combine_row' pngread.c:(.text+0xe2a): undefined reference to `png_combine_row' pngread.c:(.text+0xe5d): undefined reference to `png_combine_row' pngread.c:(.text+0xe9f): undefined reference to `png_combine_row' pngread.c:(.text+0xed9): undefined reference to `png_combine_row' libpng.a(pngread.o):pngread.c:(.text+0xf08): more undefined references + to `png_combine_row' follow collect2: ld returned 1 exit status make[2]: *** [pngtest] Error 1 make[2]: Leaving directory `/home/james/.local/share/.cpan/build/Tk-80 +4.029-XzKN_H/PNG/libpng' make[1]: *** [subdirs] Error 2 make[1]: Leaving directory `/home/james/.local/share/.cpan/build/Tk-80 +4.029-XzKN_H/PNG' make: *** [subdirs] Error 2 SREZIC/Tk-804.029.tar.gz /usr/bin/make -- NOT OK Running make test Can't test without successful make Running make install Make had returned bad status, install seems impossible
I've search Perl Monks and the Internet have not found a similar problem. How do I fix this problem?

Replies are listed 'Best First'.
Re: Trouble installing Tk on Ubuntu
by Anonymous Monk on Jun 27, 2010 at 18:56 UTC
    Try upgrading libpng manually first; Ubuntu's is too old. (A Google search for the phrase "undefined reference to `png_combine_row'" returns relevant results, the first of which was this similar comp.lang.perl.tk entry from 2008.)
      This is apparently a problem even running the latest Ubuntu and CPAN client. If you're an Ubuntu newbie, like me, it might take a while to find out how to make use of Anonymous Monk's excellent advice. Here is the magic line (that worked for me). (I searched the DB here before I decided to post it. But if this is already handled somewhere I'll take no umbrage should this post not pass muster, or otherwise requires some editing (including the removal of this and the containing parenthetical).) sudo apt-get install libpng-dev Thanks to Damian on Google forum (comp.lang.perl.tk) for the detail.
        Thank you
Re: Trouble installing Tk on Ubuntu
by duelafn (Parson) on Jun 27, 2010 at 20:48 UTC

    Unless you specifically need to compile yourself, use:

    sudo aptitude install perl-tk

    This is one of those packages that does not follow the libfoo-perl naming convention.

    Good Day,
        Dean