LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-09-2009, 11:04 AM   #1
exceed1
Member
 
Registered: Mar 2008
Location: oslo
Distribution: debian,redhat
Posts: 199

Rep: Reputation: 31
Question GD graphics lib. not working after install.


Hi

I installed GD graphics lib since i was going to generate some graphs using perl. I installed the GD module and used some sample code to test it out, but when i run in on my webserver i just get this instead of a picture (i have mod_perl installed in apache and its working fine with all other perl scripts):
Code:
‰PNG  ��� IHDR���d���d��z‹MQ���PLTE�������Ž~���tRNS�@f��IDATH‰TKn0`‘#@–.r„zŽ€Tg$˜S,8BUo{آ•:1/~žyckŠ^œqpA?^�p- A“&Œf4Wӏ—Ž—hq³Ž4' _QoŽœ‰{a)Ӹfš‡^B:jR˜h† Hկ5QH%ŽnqnŸ~_—G"ڡ·)„*“„ 8A
So it would probably seem like GD isnt installed, but when i check with the CPAN shell i get this:
Code:
cpan[1]> install GD
CPAN: Storable loaded ok (v2.18)
Going to read /home/exceed/.cpan/Metadata
  Database was generated on Sat, 09 May 2009 00:27:02 GMT
GD is up to date (2.41).

cpan[2]>
And when i use this command "perl -MGD" it shows that the module is installed and should be working properly.

I have installed libpng/libpng-dev, libgd2-xdm/libgd2-xdm-dev as well as other needed libraries before installation, so i cant imagine what this can be.

Everything ran fine when compiling and installing except the "make test" which isnt necessary, but i guess that the module wont work if the "make test" fails ?

This was the output from the "make test" command:
Code:
$ sudo make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/GD..........Can't load './blib/arch/auto/GD/GD.so' for module GD: ./blib/arch/auto/GD/GD.so: failed to map segment fr
om shared object: Operation not permitted at /usr/lib/perl/5.10/DynaLoader.pm line 196.
 at t/GD.t line 14
Compilation failed in require at t/GD.t line 14.
BEGIN failed--compilation aborted at t/GD.t line 14.
t/GD..........dubious                                                        
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 1-12
        Failed 12/12 tests, 0.00% okay
t/Polyline....Can't load '/home/exceed/.cpan/build/GD-2.41-hsZ1xG/blib/arch/auto/GD/GD.so' for module GD: /home/exceed/
.cpan/build/GD-2.41-hsZ1xG/blib/arch/auto/GD/GD.so: failed to map segment from shared object: Operation not permitted a
t /usr/lib/perl/5.10/DynaLoader.pm line 196.
 at /home/exceed/.cpan/build/GD-2.41-hsZ1xG/blib/lib/GD/Polyline.pm line 45
Compilation failed in require at /home/exceed/.cpan/build/GD-2.41-hsZ1xG/blib/lib/GD/Polyline.pm line 45.
BEGIN failed--compilation aborted at /home/exceed/.cpan/build/GD-2.41-hsZ1xG/blib/lib/GD/Polyline.pm line 45.
Compilation failed in require at t/Polyline.t line 10.
BEGIN failed--compilation aborted at t/Polyline.t line 10.
t/Polyline....dubious                                                        
        Test returned status 2 (wstat 512, 0x200)
DIED. FAILED test 1
        Failed 1/1 tests, 0.00% okay
Failed Test  Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/GD.t          2   512    12   23  1-12
t/Polyline.t    2   512     1    2  1
Failed 2/2 test scripts. 13/13 subtests failed.
Files=2, Tests=13,  0 wallclock secs ( 0.08 cusr +  0.00 csys =  0.08 CPU)
Failed 2/2 test programs. 13/13 subtests failed.
make: *** [test_dynamic] Error 2
So it seems like its not able to load a shared library, but it should be able to do this because the shared object is present and im running this installation with sudo privileges.

This is a little wierd since the "make Makefile.PL" as well as the compilation ("make") and installation ("make install") is working without problems and the CPAN shell is also reporting that everything seems to be fine.

Can someone please tell me why the GD module is not working here and why im getting the wierd letters instead of a picture?

All help is appericiated.

Last edited by exceed1; 05-09-2009 at 11:06 AM.
 
Old 05-09-2009, 01:05 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Debian - Ubuntu, related packages :

libgd2-xpm libgd2-xpm-dev libgd-tools libgd-gd2-perl

But the missing one could be 'php5-gd' ?

'libgdchart-gd2-xpm' :
A library for generating nice 2d and 3d graphs with the use of GD.
.....

Last edited by knudfl; 05-09-2009 at 01:14 PM.
 
Old 05-09-2009, 01:34 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

One of the first things we need to figure out is whether this is:
a) a problem with GD/your GD install
... or ...
b) an Apache/Apache configuration issue

SUGGESTIONS:
1. Try out "GD::Simple"", and see if it works (independent of trying to display anything from a web browser):
http://perl.about.com/od/packagesmod...rlgdsimple.htm

2. Here's a more elaborate example:
http://linuxgazette.net/issue81/padala.html

It's not good that "make test" fails, but it's entirely possible that GD is working correctly anyway. Please try either of the above links to verify the basic install, and please post back what you find.

Thanx in advance .. PSM

Last edited by paulsm4; 05-09-2009 at 01:40 PM.
 
Old 05-10-2009, 10:20 AM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
It looks to me like you are generating a proper PNG image file, but transmitting it without the proper header. If the image is being transmitted as an inline image embedded in an HTML page, it might look correct. My guess is that you are calling the image directly by having your CGI transmit the PNG image as a full page. In this case, you will need to have the CGI prefix the proper header, at minimum:
Code:
    print "Content-Type: image/png\n\n";
--- rod.
 
Old 05-11-2009, 02:24 PM   #5
exceed1
Member
 
Registered: Mar 2008
Location: oslo
Distribution: debian,redhat
Posts: 199

Original Poster
Rep: Reputation: 31
Thanks for the answers

As theNbomr suggested, "content-type: image/png\n\n" worked nicely, it produced an image instead of just text.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound and Graphics not working in Intel D101GGC with ATI graphics and Realtek audio sanu1 Linux - Hardware 2 12-28-2008 07:29 PM
what graphics lib do you use? websinger Programming 2 09-07-2006 09:15 AM
Trying to get Mesa3D graphics lib to work fatherg Programming 5 07-12-2004 01:29 AM
My Fedora 1.0 QT lib is not working linuxlah Fedora 3 01-14-2004 07:36 PM
installing lib or libraries or *.so is not working laxguy1515 Linux - General 2 06-06-2003 09:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration