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

I'm trying to install the perl GD 2.16 library and make is failing.

I have tried all of the suggestions in Linclon's README (except I haven't reinstalled perl). This does not appear to be a problem with libgd version (I get the same error trying to install GD-1.19 which doens't depend on external libraries) or dynamic linking. The error I get is about a syntax error in syntax error in /usr/include/stdlib.h.

I've googled various parts of the error message and searched and read perlmonks, comp.lang.perl.modules, the debian list etc. No similar errors out there that I can find.

I'm installing on an Intel box running Debian GNU/Linux 2.4 and Perl 5.6.1. I have installed the latest versions of the following C library dependencies:

zlib-1.2.1, libpng version 1.2.7, libgd version 2.0.33, jpeg-6b, freetype version 1.3.1

I installed all the above dependencies in the order listed manually and and they all installed fine with no errors and those that had tests past them. I su to root, move to the GD-2.16 directory and run perl Makefile.PL. I then run make and get the error:

In file included from /usr/lib/perl/5.6.1/CORE/perl.h:493,
from GD.xs:5:
/usr/include/stdlib.h:158: syntax error before `long'
make: *** GD.o Error 1
I tried installing GD-1.19 just to get something going, but I get the same error.

The comlete output from the perl Makefile.PL and make commands are listed below. Any suggestions? Thanks.

Barry
-------------------------------------------------------------------------------------------------------------- bmoore@westwater:~/GD-2.16$ su root
Password:
westwater:/home/bmoore/GD-2.16# perl Makefile.PL
NOTICE: This module requires libgd 2.0.12 or higher.
it will NOT work with earlier versions.
See www.cpan.org for versions of GD that are
compatible
with earlier versions of libgd.

If you are using Math::Trig 1.01 or lower, it has a
bug that
causes a "prerequisite not found" warning to be
issued. You may
safely ignore this warning.

Type perl Makefile.PL -h for command-line option
summary

Configuring for libgd version 2.0.33.
Included Features: GD_XPM GD_PNG GD_GIF
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.

Checking if your kit is complete...
Looks good
Writing Makefile for GD
westwater:/home/bmoore/GD-2.16# make
cp qd.pl blib/lib/qd.pl
cp GD.pm blib/lib/GD.pm
AutoSplitting blib/lib/GD.pm (blib/lib/auto/GD)
cp GD/Polyline.pm blib/lib/GD/Polyline.pm
/usr/bin/perl /usr/share/perl/5.6.1/ExtUtils/xsubpp
-typemap /usr/share/perl/5.6.1/ExtUtils/typemap -typemap
typemap GD.xs > GD.xsc && mv GD.xsc GD.c
cc -c -I/usr/local/include -DDEBIAN -fno-strict-aliasing
-I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -O2 -DVERSION=\"2.16\"
-DXS_VERSION=\"2.16\" -fPIC "-I/usr/lib/perl/5.6.1/CORE"
-DHAVE_XPM -DHAVE_GIF GD.c
In file included from
/usr/lib/perl/5.6.1/CORE/perl.h:493,
from GD.xs:5:
/usr/include/stdlib.h:158: syntax error before `long'
make: *** GD.o Error 1
westwater:/home/bmoore/GD-2.16#

Replies are listed 'Best First'.
Re: Trouble Installing GD
by tachyon (Chancellor) on Nov 05, 2004 at 21:59 UTC

    Although errors reported in standard libraries almost always have to do with other config issues have you had a look at what is in your stdlib.h from lines say 150-160. I see a short #ifdef __USE_ISOC99 block (although you may have something else) It is not impossible (although it is very very very unlikely) that there is a syntax error in that block. You could add and #undef __USE_ISOC99 to skip it and see if it makes.

    If that fails as I expect it will the quickest option is probably to install Perl 5.6.2 or a 5.8 and try the compile with your new perl. You can have parallel installs. (thisperl) Makefile.PL determines which perl is used when you make, so you can install a new perl anywhere you like and just put a link to /usr/bin/perl562 for example.

    cheers

    tachyon