Tags:
create new tag
view all tags

Question

I’m having a number of problems getting the ChartPlugin operational and hope for some good advice from those who have been more successful.

I’ve looked at ThomasWeigert notes in ChartPluginDev and have browsed though the Support web including PluginErrorRequiredPerlModuleNotFound, and have followed the tips suggested in those Topics.

The Perl GD module seems to be correctly installed, but accessing either ChartPlugin or ChartPluginTests on my server fails with an “Internal Server Error”. An examination of the httpd logs provides the error message:

Can't locate object method "png" via package "GD::Image" at …/twiki/lib/TWiki/Plugins/ChartPlugin/Chart.pm line 1461.

I’ve been digging around in the GD & related modules, but it’s unclear where the method png() is defined and/or inherited from.

Environment

TWiki version: TWikiRelease03Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin, NotificationPlugin, ChartPlugin and others
Server OS: RedHat ES release 3 (Taroon Update 6)
Web server: Apache/2.0.46
Perl version: v5.8.0 built for i386-linux-thread-multi
Client OS: Windows Xp Pro
Web Browser: Mozilla Firefox 1.07 for Windows
Categories: Plugins

-- BillKanawyer - 06 Apr 2006

Answer

The GD-2.32/README file provides the primary clue:

4. My scripts fail with "Can't locate object method 'png' via package "GD::Image".

   libgd can now be built with support for one or more of the PNG, GIF, XPM or
   JPEG formats. If one or more of these formats are not supported by libgd, then
   the corresponding GD::Image methods will be unavailable.  Unfortunately, many
   older scripts assume that the png() method will always be present.  You can
   work around this issue with code like the following:

      my $image = $gd->can('png') ? $gd->png : $gd->gif;

   or if you prefer eval {}

      my $image = eval {$gd->png} || $gd->gif;

   As of libgd 2.0.33, GIF support is always compiled in, so (for the time being!)
   this is a safe fallback.

Running perl Makefile.PL -h provides the additional clue:

# perl Makefile.PL -h
Configuring for libgd version 2.0.33.
Unknown option: h
Usage: perl Makefile.PL [options]

Configure GD module.

 Options:
     -options       "JPEG,FT,PNG,GIF,XPM,ANIMGIF"   feature options, separated by commas
     -lib_gd_path   path            path to libgd
     -lib_ft_path   path            path to Freetype library
     -lib_png_path  path            path to libpng
     -lib_jpeg_path path            path to libjpeg
     -lib_xpm_path  path            path to libxpm
     -lib_zlib_path path            path to libpng

If no options are passed on the command line.  The program will
attempt to autoconfigure itself with the gdlib-config program (present
in GD versions 2.0.27 or later).  Otherwise it will prompt for these
values interactively.
Included Features:          GD_PNG GD_GIF GD_UNCLOSEDPOLY GD_ANIMGIF GD_FTCIRCLE VERSION_33
GD library used from:       /usr/local

If you experience compile problems, please check the @INC, @LIBPATH and @LIBS
arrays defined in Makefile.PL and manually adjust, if necessary.

In my partictular case, the build was looking for libraries in the wrong place.

Because RedHat installs most of the required libraries in /usr/lib rather then /usr/local/lib the gdlib-config tool fails to find the libraries and thus quietly disables support for those features in the module.

Correcting the library path resolved this issue for me.

-- BillKanawyer - 07 Apr 2006

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2006-04-07 - BillKanawyer
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.