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

Matt Foster Matthew.Foster at noaa.gov
Fri Oct 7 10:49:38 EDT 2005


Kevin,

OK, I started fresh with a 'make clean', and then did these steps...

./configure --with-netcdf=<path to netcdf>
make
make install

This went fine, and everything is installed under /usr/local.  Then 
things go bad...

cd swig/perl
make

make fails trying to compile gdal_wrap.cpp with SWIG_NewPointerObj being 
undeclared.  I tried adding the -L/usr/local/lib to the Makefile.PL, as 
you suggested (even though /usr/local is default), and even added 
/usr/local/lib to LD_LIBRARY_PATH, and it fails in the same place with 
the same error.

Matt

Kevin Ruland wrote:

>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
>>
>>    
>>
>_______________________________________________
>Gdal-dev mailing list
>Gdal-dev at lists.maptools.org
>http://lists.maptools.org/mailman/listinfo/gdal-dev
>
>  
>

-- 
"Those who would sacrifice essential liberties for a little
temporary safety deserve neither liberty nor safety."
-- Benjamin Franklin





More information about the Gdal-dev mailing list