[R-sig-Geo] rgdal 1.1-3 compilation: error of ogrsource.cpp

Bede-Fazekas Ákos bfalevlist at gmail.com
Sun Jan 31 19:03:24 CET 2016


Thank you, Roger!
It is now solved. Hereinafter I just provide information about this 
issue and how it was solved for those who are interested in.
Best wishes,
Ákos Bede-Fazekas

Only two ogr_api.h files were situated in my hard drive, and they were 
exactly the same. One was in the directory where gdal were compiled 
from, the other was in
/usr/local/include
Only one line mentioned GIntBig:
GIntBig CPL_DLL OGR_L_GetFeaturesRead( OGRLayerH );
Header of ogr_api.h was:
"$Id: ogr_api.h 28008 2014-11-26 12:41:43Z rouault $"

Deletion (backuping) ogr_api.h, downloading the newest gdal source, 
compiling it, running ldconfig (because of " libgdal.so.20: cannot open 
shared object file: No such file or directory" during installation of 
rgdal package) and install rgdal from R solved the problem:

sudo mv /usr/local/include/ ogr_api.h /usr/local/include/ ogr_api.h.bak
wget -A.gz ​http://download.osgeo.org/gdal/2.0.2/gdal-2.0.2.tar.gz
tar xzf gdal-2.0.2.tar.gz
cd gdal-2.0.2
./configure
sudo make
sudo make install
sudo ldconfig
sudo R
install.packages("rgdal")

2016.01.31. 13:59 keltezéssel, Roger Bivand írta:
> On Sun, 31 Jan 2016, Bede-Fazekas Ákos wrote:
>
>> Dear Roger,
>> it is really probable that some gdal versions were mixed. It was long 
>> time ago when I installed gdal but as far as I remember it was 
>> compiled from source. I would be very happy if I could uninstall it 
>> and start again from the base, but don't know how to do it. "make 
>> uninstall" fails, reinstalling also fails, no other ways I'm aware of.
>
> Looking more closely at your report, I see:
>
>>> >  ogr2ogr --version
>>> >  GDAL 2.0.0dev, released 2014/04/16
>
> 2.0.0 was released in June 2015 (and 2.0.2 has just been released). 
> You very likely have installed headers that date from before the 
> revisions introducing handling of 64-bit integers, but where the 
> version of GDAL declares itself to be 2.0.0. I suggest you use locate 
> from the shell to find any ogr_api.h files on your system. You could use
>
> gdal-config --cflags
>
> but this could be misleading if you have multiple gdal-config 
> installed. Find out whether any ogr_api.h contains references to 
> GIntBig, and delete all prior to that. It may be safest to locate all 
> the *gdal*, *cpl* and *ogr* components and remove them, running make 
> install again from a fresh source build of GDAL 2.0.2.
>
> Hope this helps,
>
> Roger
>
>
>> Thanks for any help,
>> Ákos
>>
>> 2016.01.30. 17:33 keltezéssel, Roger Bivand írta:
>>>  On Sat, 30 Jan 2016, Bede-Fazekas Ákos wrote:
>>>
>>> >  Dear List,
>>> >  please let me know what I'm doing wrong. Installing package rgdal 
>>> 1.1-3 >  with install.packages("rgdal") fails on Ubuntu 14 (gdal 
>>> version: 2.0.0) >  with this error message during the compilation:
>>> >  *ogrsource.cpp:413:10: error: ‘OFTInteger64’ was not declared in 
>>> this >  scope.*
>>> > >  The gdal-version info, verbose output of package installation 
>>> and >  sessionInfo() is provided after my signature.
>>>
>>>  Thanks for a clear report. The GDAL version is declared as 2.0.0. The
>>>  released 2.0.* implement RFC 31:
>>>
>>>  (https://trac.osgeo.org/gdal/wiki/rfc31_ogr_64)
>>>
>>>  using long integers for FIDs and allowing them as field values. 
>>> Since the
>>>  GDAL you are using declares itself as 2.*, the code forks to take
>>>  advantage of the new capability.
>>>
>>>  How did you install GDAL? Is it possible that the version you have is
>>>  pre-release? The development trunk was named 2.0.0 for quite a long 
>>> time,
>>>  but implementations of changes happened at different times along 
>>> the way?
>>>  Is it possible that you have mixed (multiple) GDAL installations, 
>>> with 1.*
>>>  headers and 2.0 gdal-config?
>>>
>>>  Roger
>>>
>>> >  However the R version is the latest (3.2.3), installation of the 
>>> package >  failed with similar error message on my previously used R 
>>> version >  (3.0.2), and therefore I think that the problem is 
>>> nothing to do with R.
>>> >  Removing and reinstalling libgdal1-dev, libproj-dev, gdal-bin 
>>> does not >  solve the problem. Running R as root user produce 
>>> similar error.
>>> > >  Any help is gratefully appreciated,
>>> >  Ákos Bede-Fazekas
>>> >  Hungarian Academy of Sciences
>>> > > >  ----------------
>>> >  gdal-config --version
>>> >  2.0.0
>>> > >  ogr2ogr --version
>>> >  GDAL 2.0.0dev, released 2014/04/16
>>> > >  ----------------
>>> > configure:   CC: gcc -std=gnu99
>>> > configure:   CXX: g++
>>> > configure:   rgdal: 1.1-3
>>> >  checking for /usr/bin/svnversion... yes
>>> >  configure:  svn revision: 594
>>> >  checking for gdal-config... /usr/local/bin/gdal-config
>>> >  checking gdal-config usability... yes
>>> >  configure:  GDAL: 2.0.0
>>> >  checking GDAL version >= 1.6.3... yes
>>> >  configure:  experimental conditional use of GDAL2
>>> >  checking for gcc... gcc -std=gnu99
>>> >  checking whether the C compiler works... yes
>>> >  checking for C compiler default output file name... a.out
>>> >  checking for suffix of executables...
>>> >  checking whether we are cross compiling... no
>>> >  checking for suffix of object files... o
>>> >  checking whether we are using the GNU C compiler... yes
>>> >  checking whether gcc -std=gnu99 accepts -g... yes
>>> >  checking for gcc -std=gnu99 option to accept ISO C89... none needed
>>> >  checking how to run the C preprocessor... gcc -std=gnu99 -E
>>> >  checking for grep that handles long lines and -e... /bin/grep
>>> >  checking for egrep... /bin/grep -E
>>> >  checking for ANSI C header files... yes
>>> >  checking for sys/types.h... yes
>>> >  checking for sys/stat.h... yes
>>> >  checking for stdlib.h... yes
>>> >  checking for string.h... yes
>>> >  checking for memory.h... yes
>>> >  checking for strings.h... yes
>>> >  checking for inttypes.h... yes
>>> >  checking for stdint.h... yes
>>> >  checking for unistd.h... yes
>>> >  checking gdal.h usability... yes
>>> >  checking gdal.h presence... yes
>>> >  checking for gdal.h... yes
>>> >  checking gdal: linking with --libs only... yes
>>> >  checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
>>> >  checking proj_api.h usability... yes
>>> >  checking proj_api.h presence... yes
>>> >  checking for proj_api.h... yes
>>> >  checking for pj_init_plus in -lproj... yes
>>> >  configure:  PROJ.4 version: 4.8.0
>>> >  checking PROJ.4: epsg found and readable... yes
>>> >  checking PROJ.4: conus found and readable... yes
>>> > configure:   Package CPP flags:  -I/usr/local/include
>>> > configure:   Package LIBS:  -L/usr/local/lib -lgdal -lproj
>>> > configure:   creating ./config.status
>>> >  config.status: creating src/Makevars
>>> >  ** libs
>>> >  g++ -std=c++11 -I/usr/share/R/include -DNDEBUG 
>>> -I/usr/local/include > 
>>> -I"/usr/local/lib/R/site-library/sp/include"   -fpic  -g -O2 >  
>>> -fstack-protector --param=ssp-buffer-size=4 -Wformat >  
>>> -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c OGR_write.cpp -o 
>>> >  OGR_write.o
>>> >  g++ -std=c++11 -I/usr/share/R/include -DNDEBUG 
>>> -I/usr/local/include > 
>>> -I"/usr/local/lib/R/site-library/sp/include"   -fpic  -g -O2 >  
>>> -fstack-protector --param=ssp-buffer-size=4 -Wformat >  
>>> -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c gdal-bindings.cpp 
>>> -o >  gdal-bindings.o
>>> >  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG 
>>> -I/usr/local/include > 
>>> -I"/usr/local/lib/R/site-library/sp/include"   -fpic  -g -O2 >  
>>> -fstack-protector --param=ssp-buffer-size=4 -Wformat >  
>>> -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c init.c -o init.o
>>> >  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG 
>>> -I/usr/local/include > 
>>> -I"/usr/local/lib/R/site-library/sp/include"   -fpic  -g -O2 >  
>>> -fstack-protector --param=ssp-buffer-size=4 -Wformat >  
>>> -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c local_stubs.c -o 
>>> >  local_stubs.o
>>> >  g++ -std=c++11 -I/usr/share/R/include -DNDEBUG 
>>> -I/usr/local/include > 
>>> -I"/usr/local/lib/R/site-library/sp/include"   -fpic  -g -O2 >  
>>> -fstack-protector --param=ssp-buffer-size=4 -Wformat >  
>>> -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogr_geom.cpp -o >  
>>> ogr_geom.o
>>> >  gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG 
>>> -I/usr/local/include > 
>>> -I"/usr/local/lib/R/site-library/sp/include"   -fpic  -g -O2 >  
>>> -fstack-protector --param=ssp-buffer-size=4 -Wformat >  
>>> -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c ogr_polygons.c -o 
>>> >  ogr_polygons.o
>>> >  g++ -std=c++11 -I/usr/share/R/include -DNDEBUG 
>>> -I/usr/local/include > 
>>> -I"/usr/local/lib/R/site-library/sp/include"   -fpic  -g -O2 >  
>>> -fstack-protector --param=ssp-buffer-size=4 -Wformat >  
>>> -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogr_proj.cpp -o >  
>>> ogr_proj.o
>>> >  g++ -std=c++11 -I/usr/share/R/include -DNDEBUG 
>>> -I/usr/local/include > 
>>> -I"/usr/local/lib/R/site-library/sp/include"   -fpic  -g -O2 >  
>>> -fstack-protector --param=ssp-buffer-size=4 -Wformat >  
>>> -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogrdrivers.cpp -o 
>>> >  ogrdrivers.o
>>> >  g++ -std=c++11 -I/usr/share/R/include -DNDEBUG 
>>> -I/usr/local/include > 
>>> -I"/usr/local/lib/R/site-library/sp/include"   -fpic  -g -O2 >  
>>> -fstack-protector --param=ssp-buffer-size=4 -Wformat >  
>>> -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ogrsource.cpp -o 
>>> >  ogrsource.o
>>> >  ogrsource.cpp: In function ‘SEXPREC* ogrReadColumn(OGRLayer*, 
>>> SEXP, int, >  int)’:
>>> >  ogrsource.cpp:413:10: error: ‘OFTInteger64’ was not declared in 
>>> this >  scope
>>> >      case OFTInteger64:
>>> >           ^
>>> >  ogrsource.cpp:470:12: error: ‘OFTInteger64’ was not declared in 
>>> this >  scope
>>> >        case OFTInteger64:
>>> >             ^
>>> >  ogrsource.cpp:476:45: error: ‘class OGRFeature’ has no member 
>>> named >  ‘GetFieldAsInteger64’
>>> >                  GIntBig nVal64 = 
>>> poFeature->GetFieldAsInteger64(iField);
>>> >                                              ^
>>> >  ogrsource.cpp: In function ‘SEXPREC* ogrReadListColumn(OGRLayer*, 
>>> SEXP, >  int, int, int)’:
>>> >  ogrsource.cpp:575:10: error: ‘OFTInteger64List’ was not declared 
>>> in this >  scope
>>> >      case OFTInteger64List:
>>> >           ^
>>> >  ogrsource.cpp:618:14: error: ‘OFTInteger64List’ was not declared 
>>> in this >  scope
>>> >          case OFTInteger64List:
>>> >               ^
>>> >  ogrsource.cpp:619:28: error: ‘union OGRField’ has no member named 
>>> >  ‘Integer64List’
>>> >            nlist = psField->Integer64List.nCount;
>>> >                             ^
>>> >  ogrsource.cpp:626:32: error: ‘union OGRField’ has no member named 
>>> >  ‘Integer64List’
>>> > psField->Integer64List.paList[k]);
>>> >                                 ^
>>> >  ogrsource.cpp:629:43: error: ‘union OGRField’ has no member named 
>>> >  ‘Integer64List’
>>> >                  GIntBig nVal64 = psField->Integer64List.paList[k];
>>> >                                            ^
>>> >  make: *** [ogrsource.o] Error 1
>>> >  ERROR: compilation failed for package ‘rgdal’
>>> >  * removing ‘/usr/local/lib/R/site-library/rgdal’
>>> > >  The downloaded source packages are in
>>> >     ‘/tmp/RtmpcN1Gpn/downloaded_packages’
>>> >  Warning message:
>>> >  In install.packages("rgdal") :
>>> >    installation of package ‘rgdal’ had non-zero exit status
>>> > > >  ----------------
>>> > >   sessionInfo()
>>> >  R version 3.2.3 (2015-12-10)
>>> >  Platform: x86_64-pc-linux-gnu (64-bit)
>>> >  Running under: Ubuntu 14.04.3 LTS
>>> > >  locale:
>>> >   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>> >   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>> >   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>>> >   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>> >   [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>> >  [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>> > >  attached base packages:
>>> >  [1] stats     graphics  grDevices utils     datasets methods base
>>> > >  loaded via a namespace (and not attached):
>>> >  [1] tools_3.2.3
>>> > >  _______________________________________________
>>> >  R-sig-Geo mailing list
>>> >  R-sig-Geo at r-project.org
>>> >  https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>> > >
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>



More information about the R-sig-Geo mailing list