Fix for building perl bindings was Re: [Gdal-dev] Newbie with OGR Perl bindings

Kevin Ruland kruland at ku.edu
Fri Oct 7 10:11:53 EDT 2005



Matt,

There appears to be some problems with 'make install' in the perl
bindings - there are some work-arounds for it and if you use --prefix
things get a little harder.

If you decide to install gdal in either /usr/local or /usr/ (this is the
case when you don't use --prefix in ./configure),
the best option is to not use the --with-perl option, but instead do this:

./configure --normal-configure-options  (omit the --with-perl option)
make
make install
cd swig/perl
make
make install

This should install the perl module correctly.

If you desire to install gdal in a non-default location you will need to
hack the swig/perl/Makefile.PL script to get the build to function
correctly.

./configure --prefix=myprefix --normal-configure-options (omit the
--with-perl option)
make
make install
cd swig/perl
-- edit the Makefile.PL and change all the lines with LIB => "-lgdal" to
LIB => '-Lmyprefix/lib -lgdal'
make
make install

We are currently working on a platform independent way to make this more
automatic.  It should make it into cvs shorly, and in the 1.3.2
release.  Until then we'll have to struggle a little more.

Best of luck.

Kevin




Matt Foster wrote:

>
>
> Ari Jolma wrote:
>
>> Matt Foster kirjoitti:
>>
>>> Would anyone have a sample code snippet they'd be willing to share,
>>> showing how to create a simple point shapefile with the OGR Perl
>>> binding?
>>
>>
>>
>>
>> look at  the test.pl in swig/perl, it creates and opens raster and
>> vector data files
>>
>> Ari
>>
>
> Ari,
>
> Something is wrong with my installation here.  When I tried to run
> test.pl it said that it could find a loadable module for gdalconst,
> despite the fact that gdalconst.pm is in my @INC list.  I think in my
> effort yesterday to get around the compilation failure of
> gdal_wrap.cpp, I fouled up the installation.  I think I need to step
> back, and start fresh.
>
> I worked on the assumption yesterday that to get the Perl bindings
> built and installed that I would do these steps from the gdal base
> directory (I also use netCDF)...
>
> ./configure --with-netcdf=<path to netcdf> --with-perl
> make
> make install
>
> Is that incorrect?  If those are indeed the right steps, then I need
> to figure out why gdal_wrap.cpp fails to build.
>
> Matt
>



More information about the Gdal-dev mailing list