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

Ari Jolma ari.jolma at tkk.fi
Fri Oct 7 13:04:05 EDT 2005


Matt Foster kirjoitti:

> Sorry, I guess I didn't include the exact error message...
>
> gcc -c  -I../../gcore -I../../alg -I../../ogr -I../../port 
> -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING 
> -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE 
> -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -march=i386 
> -mcpu=i686   -DVERSION=\"\" -DXS_VERSION=\"\" -fPIC 
> "-I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE"   gdal_wrap.cpp
> gdal_wrap.cpp: In function `void 
> _wrap_Dataset_GetGCPs(PerlInterpreter*, CV*)':
> gdal_wrap.cpp:4877: `SWIG_NewPointerObj' undeclared (first use this 
> function)
> gdal_wrap.cpp:4877: (Each undeclared identifier is reported only once 
> for each
>   function it appears in.)


which version gdal do you have? in gdal-1.3.1 line 4877 is not in 
wrap_Dataset_GetGCPs and SWIG_NewPointerObj is only defined not used

gdal_wrap.cpp in 1.3.1 is 235345 bytes and its header says: 
..automatically generated by swig 1.3.26

Ari

> make[1]: *** [gdal_wrap.o] Error 1
>
> Matt
>
>
> Ethan Alpert wrote:
>
>> What's the error? Was it in a previous post?
>>
>> -e
>>
>> -----Original Message-----
>> From: gdal-dev-bounces at lists.maptools.org
>> [mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Matt Foster
>> Sent: Friday, October 07, 2005 8:50 AM
>> To: Kevin Ruland
>> Cc: gdal-dev at lists.maptools.org
>> Subject: Re: Fix for building perl bindings was Re: [Gdal-dev] Newbie
>> with OGRPerl bindings
>>
>>
>> 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
>>>
>>>
>>>
>>>   
>>
>>
>>  
>>
>


-- 
Prof. Ari Jolma
Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




More information about the Gdal-dev mailing list