For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > August 2004 > GD.pm and GD::Graph









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author GD.pm and GD::Graph
Isarin Sathitruangsak

2004-08-04, 3:55 pm



Hello.

Could someone could shed some light what I should do. Please point me if
I should send to a different list.

Although my script ran fine on the command line. I've got the following
errors when running my script on apache

[Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] Premature end
of script headers: graph
[Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] Uncaught
exception from user code:
[Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] \tCan't load
'/dssweb/local-perl/lib/site_perl/5.8.\
3/sun4-solaris/auto/GD/GD.so' for module GD: ld.so.1:
/dssweb/local-perl/bin/perl: fatal: libgcc_s.so.1: open \
failed: No such file or directory at
/dssweb/local-perl/lib/5.8.3/sun4-solaris/DynaLoader.pm line 229.
[Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] at
/dssweb/local-perl/lib/site_perl/5.8.3/GD/Graph\
/pie.pm line 20
[Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] Compilation
failed in require at /dssweb/local-perl\
/lib/site_perl/5.8.3/GD/Graph/pie.pm line 20.
[Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] BEGIN
failed--compilation aborted at /dssweb/local-\
perl/lib/site_perl/5.8.3/GD/Graph/pie.pm line 20.
[Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] Compilation
failed in require at /dssweb/apache2/cg\
i-bin/tst/graph line 6.
[Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] BEGIN
failed--compilation aborted at /dssweb/apache\
2/cgi-bin/tst/graph line 6.

Thanks,
Isarin


hatyai@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org
Isarin Sathitruangsak

2004-08-04, 3:55 pm


It is my test script and pretty much I took it from module's
documentation.

**** The odd thing is that it ran fine on command line but failed
on the browser.*******

According to my googling search, it might be something to do with
LD_LIBRARY_PATH or RPATH. I located the path for libgcc.so.1 and
added it to LD_LIBRARY_PATH but it didn't help. I don't know how
to add it to RPATH. When I installed both modules, they passed
the make tests.

Anyways, here is my code:


#!/dssweb/local-perl/bin/perl

use strict;
use warnings;
use diagnostics;
use GD::Graph::pie;
use CGI;


my @data = (
["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"],
[ 1, 2, 5, 6, 3, 1.5, 1, 3, 4],
[ sort { $a <=> $b } (1, 2, 5, 6, 3, 1.5, 1, 3, 4) ]
);

my $graph = GD::Graph::pie->new(400, 300);

my $format = $graph->export_format;
my $q = new CGI;
print $q->header("image/$format");
binmode STDOUT;
print $graph->plot(\@data)->$format();





On Wed, 4 Aug 2004, Sean Davis wrote:

> Date: Wed, 4 Aug 2004 10:27:10 -0400
> From: Sean Davis <sdavis2@mail.nih.gov>
> To: Isarin Sathitruangsak <hatyai@sdf.lonestar.org>
> Subject: Re: GD.pm and GD::Graph
>
> You'll have to send some code.
>
> Sean
>
> On Aug 4, 2004, at 10:20 AM, Isarin Sathitruangsak wrote:
>
>
>


hatyai [at] sdf.lonestar.org
http://hatyai.gomen.org
SDF Public Access UNIX System - http://sdf.lonestar.org
Wiggins D Anconia

2004-08-04, 3:55 pm

>
>
> Hello.
>
> Could someone could shed some light what I should do. Please point me if
> I should send to a different list.
>
> Although my script ran fine on the command line. I've got the following
> errors when running my script on apache
>
> [Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] Premature end
> of script headers: graph
> [Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] Uncaught
> exception from user code:
> [Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] \tCan't load
> '/dssweb/local-perl/lib/site_perl/5.8.\
> 3/sun4-solaris/auto/GD/GD.so' for module GD: ld.so.1:
> /dssweb/local-perl/bin/perl: fatal: libgcc_s.so.1: open \
> failed: No such file or directory at
> /dssweb/local-perl/lib/5.8.3/sun4-solaris/DynaLoader.pm line 229.
> [Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] at
> /dssweb/local-perl/lib/site_perl/5.8.3/GD/Graph\
> /pie.pm line 20
> [Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] Compilation
> failed in require at /dssweb/local-perl\
> /lib/site_perl/5.8.3/GD/Graph/pie.pm line 20.
> [Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] BEGIN
> failed--compilation aborted at /dssweb/local-\
> perl/lib/site_perl/5.8.3/GD/Graph/pie.pm line 20.
> [Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] Compilation
> failed in require at /dssweb/apache2/cg\
> i-bin/tst/graph line 6.
> [Tue Aug 03 15:54:14 2004] [error] [client 172.16.140.146] BEGIN
> failed--compilation aborted at /dssweb/apache\
> 2/cgi-bin/tst/graph line 6.
>
> Thanks,
> Isarin
>


To avoid the internal server error you could use fatalsToBrowser. But
your error is because GD can't be loaded, specifically because it may
not have been installed correctly, or libgd is either not found or not
installed. Did you install GD through CPAN or using the standard 4 step
build process? Did 'make test' succeed? Is libgd installed and in a
normal location? You may need to provide an LD_LIBRARY_PATH or similar
in your web environment.

http://danconia.org
Isarin Sathitruangsak

2004-08-04, 3:55 pm


is libgcc.so.1 same as libgd? I think my libgd is good. and the
error message refers to libgcc.so.1.

I installed GD through the four steps. It passed the make test.
I added the path to libgcc.so.1 to LD_LIBRARY_PATH but not to the
libgd? Should I add it?

Thanks.

And here are the paths to the modules:


/dssweb/local-perl/lib/site_perl/5.8.3/sun4-solaris:
drwxr-xr-x 2 dssweb dssdev 96 Aug 3 15:37 GD
-r--r--r-- 1 dssweb dssdev 60054 Jul 22 16:11 GD.pm

/dssweb/local-perl/lib/site_perl/5.8.3/GD:
total 130
drwxr-xr-x 4 dssweb dssdev 96 Jul 30 10:30 .
drwxr-xr-x 45 dssweb dssdev 2048 Aug 3 10:56 ..
drwxr-xr-x 2 dssweb dssdev 1024 Jul 30 10:30 Graph
-r--r--r-- 1 dssweb dssdev 45395 Jul 1 2003 Graph.pm
drwxr-xr-x 2 dssweb dssdev 96 Jul 30 10:29 Text
-r--r--r-- 1 dssweb dssdev 16996 Jun 18 2003 Text.pm

/dssweb/lib:
-rw-r--r-- 1 dssweb dssdev 708028 Jul 30 11:21 libgd.a
-rwxr-xr-x 1 dssweb dssdev 717 Jul 30 11:21 libgd.la
-> libgd.so.2.0.0
lrwxrwxrwx 1 dssweb dssdev 14 Jul 30 11:21 libgd.so.2 ->
libgd.so.2.0.0
-rwxr-xr-x 1 dssweb dssdev 484989 Jul 30 11:21 libgd.so.2.0.0
lrwxrwxrwx 1 dssweb dssdev 10 Jul 28 16:18 libpng.a ->
libpng12.a
lrwxrwxrwx 1 dssweb dssdev 11 Jul 28 16:18 libpng.so ->
libpng.so.3
lrwxrwxrwx 1 dssweb dssdev 17 Jul 28 16:18 libpng.so.3 ->
libpng.so.3.1.2.5
-rwxr-xr-x 1 dssweb dssdev 170112 Jul 28 16:18 libpng.so.3.1.2.5
-rw-r--r-- 1 dssweb dssdev 192464 Jul 28 16:18 libpng12.a
lrwxrwxrwx 1 dssweb dssdev 19 Jul 28 16:18 libpng12.so ->
libpng12.so.0.1.2.5
lrwxrwxrwx 1 dssweb dssdev 19 Jul 28 16:18 libpng12.so.0 ->
libpng12.so.0.1.2.5
-rwxr-xr-x 1 dssweb dssdev 170116 Jul 28 16:18
libpng12.so.0.1.2.5



On Wed, 4 Aug 2004, Wiggins d Anconia wrote:

> Date: Wed, 4 Aug 2004 08:30:31 -0600
> From: Wiggins d Anconia <wiggins@danconia.org>
> To: Isarin Sathitruangsak <hatyai@sdf.lonestar.org>, beginners-cgi@perl.org
> Subject: Re: GD.pm and GD::Graph
>
>
> To avoid the internal server error you could use fatalsToBrowser. But
> your error is because GD can't be loaded, specifically because it may
> not have been installed correctly, or libgd is either not found or not
> installed. Did you install GD through CPAN or using the standard 4 step
> build process? Did 'make test' succeed? Is libgd installed and in a
> normal location? You may need to provide an LD_LIBRARY_PATH or similar
> in your web environment.
>
> http://danconia.org
>
> --
> To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org
> For additional commands, e-mail: beginners-cgi-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>


hatyai [at] sdf.lonestar.org
http://hatyai.gomen.org
SDF Public Access UNIX System - http://sdf.lonestar.org
Isarin Sathitruangsak

2004-08-04, 8:55 pm


OK I got it. Just like to share what I've done. My cgi didn't see
libgcc. Therefore, I need to setEnv LD_LIBRARY_PATH to libgcc's
path in my httpd.conf

cheers.


On Wed, 4 Aug 2004, Wiggins d Anconia wrote:

> Date: Wed, 4 Aug 2004 13:13:38 -0600
> From: Wiggins d Anconia <wiggins@danconia.org>
> To: Isarin Sathitruangsak <hatyai@sdf.lonestar.org>, beginners-cgi@perl.org
> Subject: Re: GD.pm and GD::Graph
>
> Please bottom post...
>
>
> No (at least I don't think) libgcc is I suspect something provided by
> gcc, which is presumably your compiler. I wonder if the issue is that
> your Perl is compiled with a different compiler? I am not an expert to
> know whether that is libgcc complaining that it can't load GD.so, or if
> that is Perl complaining that it can't load libgcc.
>
>
> Certainly can't hurt right? Is the Perl used to install GD the same as
> that you are calling in your scripts? Better to double check.
>
>
> Since the script works command line then it is almost certainly
> something about the web environment that is different, the linker path
> is really the only thing I could see as having this particular affect.
> If this doesn't get it you might redirect your query to
> beginners@perl.org as there may be others more experienced with
> internals specifics that can help there that don't peruse the CGI group.
>
> beginners-cgi@perl.org
> me if
> following
> Premature end
>
>


hatyai [at] sdf.lonestar.org
http://hatyai.gomen.org
SDF Public Access UNIX System - http://sdf.lonestar.org
Wiggins D Anconia

2004-08-04, 8:55 pm

Please bottom post...

>
> is libgcc.so.1 same as libgd? I think my libgd is good. and the
> error message refers to libgcc.so.1.
>


No (at least I don't think) libgcc is I suspect something provided by
gcc, which is presumably your compiler. I wonder if the issue is that
your Perl is compiled with a different compiler? I am not an expert to
know whether that is libgcc complaining that it can't load GD.so, or if
that is Perl complaining that it can't load libgcc.

> I installed GD through the four steps. It passed the make test.
> I added the path to libgcc.so.1 to LD_LIBRARY_PATH but not to the
> libgd? Should I add it?


Certainly can't hurt right? Is the Perl used to install GD the same as
that you are calling in your scripts? Better to double check.

>
> Thanks.


Since the script works command line then it is almost certainly
something about the web environment that is different, the linker path
is really the only thing I could see as having this particular affect.
If this doesn't get it you might redirect your query to
beginners@perl.org as there may be others more experienced with
internals specifics that can help there that don't peruse the CGI group.
[color=darkred]
>
> And here are the paths to the modules:
>
>
> /dssweb/local-perl/lib/site_perl/5.8.3/sun4-solaris:
> drwxr-xr-x 2 dssweb dssdev 96 Aug 3 15:37 GD
> -r--r--r-- 1 dssweb dssdev 60054 Jul 22 16:11 GD.pm
>
> /dssweb/local-perl/lib/site_perl/5.8.3/GD:
> total 130
> drwxr-xr-x 4 dssweb dssdev 96 Jul 30 10:30 .
> drwxr-xr-x 45 dssweb dssdev 2048 Aug 3 10:56 ..
> drwxr-xr-x 2 dssweb dssdev 1024 Jul 30 10:30 Graph
> -r--r--r-- 1 dssweb dssdev 45395 Jul 1 2003 Graph.pm
> drwxr-xr-x 2 dssweb dssdev 96 Jul 30 10:29 Text
> -r--r--r-- 1 dssweb dssdev 16996 Jun 18 2003 Text.pm
>
> /dssweb/lib:
> -rw-r--r-- 1 dssweb dssdev 708028 Jul 30 11:21 libgd.a
> -rwxr-xr-x 1 dssweb dssdev 717 Jul 30 11:21 libgd.la
> -> libgd.so.2.0.0
> lrwxrwxrwx 1 dssweb dssdev 14 Jul 30 11:21 libgd.so.2 ->
> libgd.so.2.0.0
> -rwxr-xr-x 1 dssweb dssdev 484989 Jul 30 11:21 libgd.so.2.0.0
> lrwxrwxrwx 1 dssweb dssdev 10 Jul 28 16:18 libpng.a ->
> libpng12.a
> lrwxrwxrwx 1 dssweb dssdev 11 Jul 28 16:18 libpng.so ->
> libpng.so.3
> lrwxrwxrwx 1 dssweb dssdev 17 Jul 28 16:18 libpng.so.3 ->
> libpng.so.3.1.2.5
> -rwxr-xr-x 1 dssweb dssdev 170112 Jul 28 16:18 libpng.so.3.1.2.5
> -rw-r--r-- 1 dssweb dssdev 192464 Jul 28 16:18 libpng12.a
> lrwxrwxrwx 1 dssweb dssdev 19 Jul 28 16:18 libpng12.so ->
> libpng12.so.0.1.2.5
> lrwxrwxrwx 1 dssweb dssdev 19 Jul 28 16:18 libpng12.so.0 ->
> libpng12.so.0.1.2.5
> -rwxr-xr-x 1 dssweb dssdev 170116 Jul 28 16:18
> libpng12.so.0.1.2.5
>
>
>
> On Wed, 4 Aug 2004, Wiggins d Anconia wrote:
>
beginners-cgi@perl.org[color=darkred]
me if[color=darkred]
following[color=darkred]
Premature end[color=darkred]

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com