Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue gdal_read.cpp:66: erreur: call of overloaded ‘to_string(int&)’ is ambiguous #689

Closed
saberbouabid opened this issue Mar 26, 2018 · 14 comments

Comments

@saberbouabid
Copy link

Hi guys,
I try to install sf on my server Centos 6 64 bits but it seems that my compiler facing issues when compiling with this file . Can someone help to understand what is the pb and how to resole it ?

[root@brain ~]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright © 2010 Free Software Foundation, Inc.
> install.packages("sf")
Installing package into/home/admin/R/x86_64-redhat-linux-gnu-library/3.4’
(aslibis unspecified)
essai de l'URL 'https://cran.rstudio.com/src/contrib/sf_0.6-1.tar.gz'
Content type 'application/x-gzip' length 7903324 bytes (7.5 MB)
==================================================
downloaded 7.5 MB
* installing *source* package ‘sf’ ...
** package ‘sf’ correctement décompressé et sommes MD5 vérifiées
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.2.3
checking GDAL version >= 2.0.0... yes
checking for gcc... gcc -m64 -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 -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -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 GDAL: checking whether PROJ.4 is available for linking:... yes
checking GDAL: checking whether PROJ.4 is available fur running:... 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
proj_conf_test.c:4: error: expected ')' before 'const'
proj_conf_test.c: In function 'main':
proj_conf_test.c:13: error: 'projCtx' undeclared (first use in this function)
proj_conf_test.c:13: error: (Each undeclared identifier is reported only once
proj_conf_test.c:13: error: for each function it appears in.)
proj_conf_test.c:13: error: expected ';' before 'ctx'
proj_conf_test.c:14: error: 'ctx' undeclared (first use in this function)
proj_conf_test.c:14: warning: implicit declaration of function 'pj_get_default_ctx'
proj_conf_test.c:15: warning: implicit declaration of function 'pj_open_lib'
470
checking PROJ.4: epsg found and readable... yes
proj_conf_test.c:4: error: expected ')' before 'const'
proj_conf_test.c: In function 'main':
proj_conf_test.c:13: error: 'projCtx' undeclared (first use in this function)
proj_conf_test.c:13: error: (Each undeclared identifier is reported only once
proj_conf_test.c:13: error: for each function it appears in.)
proj_conf_test.c:13: error: expected ';' before 'ctx'
proj_conf_test.c:14: error: 'ctx' undeclared (first use in this function)
proj_conf_test.c:14: warning: implicit declaration of function 'pj_get_default_ctx'
proj_conf_test.c:15: warning: implicit declaration of function 'pj_open_lib'
./configure: line 3850: ./proj_conf_test: No such file or directory
checking PROJ.4: conus found and readable... yes
checking for geos-config... /usr/bin/geos-config
checking geos-config usability... Usage: geos-config [OPTIONS]
Options:
     [--prefix]
     [--version]
     [--libs]
     [--clibs]
     [--cflags]
     [--ldflags]
     [--includes]
     [--jtsport]
yes
configure: GEOS: 3.3.2
checking GEOS version >= 3.3.0... yes
checking geos_c.h usability... yes
checking geos_c.h presence... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/lib64 -lgeos_c... yes
configure: Package CPP flags:   -I/usr/local/include -I/usr/include
configure: Package LIBS:  -L/usr/local/lib -lgdal -lproj  -L/usr/local/lib -lgdal -L/usr/lib64 -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c RcppExports.cpp -o RcppExports.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c bbox.cpp -o bbox.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal.cpp -o gdal.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal_geom.cpp -o gdal_geom.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal_read.cpp -o gdal_read.o
gdal_read.cpp: In function ‘Rcpp::List allocate_out_list(OGRFeatureDefn*, int, bool)’:
gdal_read.cpp:66: erreur: call of overloaded ‘to_string(int&)’ is ambiguous
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2604: note: candidats sont: std::string std::to_string(long long int)
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2610: note:                 std::string std::to_string(long long unsigned int)
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/basic_string.h:2616: note:                 std::string std::to_string(long double)
make: *** [gdal_read.o] Erreur 1
ERROR: compilation failed for package ‘sf’
* removing ‘/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/sf’
Warning in install.packages :
  installation of package ‘sf’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/Rtmps86NgJ/downloaded_packages’

and this is my session info

> sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.9 (Final)

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C               LC_TIME=fr_FR.UTF-8       
 [4] LC_COLLATE=fr_FR.UTF-8     LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8   
 [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C 
@edzer
Copy link
Member

edzer commented Mar 26, 2018

Did you make you sure you meet all the SystemRequirements: GDAL (>= 2.0.0), GEOS (>= 3.3.0), PROJ.4 (>= 4.8.0)?

@saberbouabid
Copy link
Author

As you can see in Rstudio console all requirements are installed

@edzer
Copy link
Member

edzer commented Mar 26, 2018

In the shell, what do you see if you give the command proj?

@saberbouabid
Copy link
Author

It seems that proj version is 4.7.1 @edzer !

[root@brain ~]# proj
Rel. 4.7.1, 23 September 2009
usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]

@edzer
Copy link
Member

edzer commented Mar 26, 2018

OK, that's it then!

@saberbouabid
Copy link
Author

saberbouabid commented Mar 26, 2018

Sorry @edzer but it seems that isn't the solution ! right now all requirements are installed but i still have the same error !

[root@brain ~]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright © 2010 Free Software Foundation, Inc.
[root@brain ~]# proj
Rel. 4.8.0, 6 March 2012
[root@brain ~]# gdalinfo --version
GDAL 2.2.3, released 2017/11/20

usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]
[root@brain ~]# geos-config --version
3.3.2

@edzer
Copy link
Member

edzer commented Mar 27, 2018

Do you have the proj development files installed properly? What does the sf configure script report now?

@saberbouabid
Copy link
Author

saberbouabid commented Mar 27, 2018

Hi @edzer Actually i think the problem is my compiler . I upgrade it to 4.9.3 but now i have another issue this time with Geos_cpp .

Installing package into ‘/home/admin/R/x86_64-redhat-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
essai de l'URL 'https://cran.rstudio.com/src/contrib/sf_0.6-1.tar.gz'
Content type 'application/x-gzip' length 7903324 bytes (7.5 MB)
==================================================
downloaded 7.5 MB

* installing *source* package ‘sf’ ...
** package ‘sf’ correctement décompressé et sommes MD5 vérifiées
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.2.3
checking GDAL version >= 2.0.0... yes
checking for gcc... gcc -m64 -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 -m64 -std=gnu99 accepts -g... yes
checking for gcc -m64 -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -m64 -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 GDAL: checking whether PROJ.4 is available for linking:... yes
checking GDAL: checking whether PROJ.4 is available fur running:... yes
configure: pkg-config proj exists, will use it
checking proj_api.h usability... yes
checking proj_api.h presence... yes
checking for proj_api.h... yes
configure: PROJ: 4.8.0
checking for pj_init_plus in -lproj... yes
checking PROJ.4: epsg found and readable... yes
checking PROJ.4: conus found and readable... yes
checking for geos-config... /usr/bin/geos-config
checking geos-config usability... Usage: geos-config [OPTIONS]
Options:
     [--prefix]
     [--version]
     [--libs]
     [--clibs]
     [--cflags]
     [--ldflags]
     [--includes]
     [--jtsport]
yes
configure: GEOS: 3.3.8
checking GEOS version >= 3.3.0... yes
checking geos_c.h usability... yes
checking geos_c.h presence... yes
checking for geos_c.h... yes
checking geos: linking with -L/usr/lib64 -lgeos_c... yes
configure: Package CPP flags:    -I/usr/local/include -I/usr/include
configure: Package LIBS: -lproj     -L/usr/local/lib -lgdal -L/usr/lib64 -lgeos_c
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c RcppExports.cpp -o RcppExports.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c bbox.cpp -o bbox.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal.cpp -o gdal.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal_geom.cpp -o gdal_geom.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal_read.cpp -o gdal_read.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal_utils.cpp -o gdal_utils.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal_write.cpp -o gdal_write.o
g++ -m64 -std=gnu++0x -I/usr/include/R -DNDEBUG -I/usr/local/include -I/usr/include -I"/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/Rcpp/include" -I/usr/local/include   -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c geos.cpp -o geos.o
geos.cpp: In function ‘Rcpp::List CPL_geos_op(std::string, Rcpp::List, Rcpp::NumericVector, int, double, bool, int, double)’:
geos.cpp:614:47: erreur: ‘GEOSNode_r’ was not declared in this scope
    out[i] = chkNULL(GEOSNode_r(hGEOSCtxt, g[i]));
                                               ^
geos.cpp: At global scope:
geos.cpp:67:13: attention : ‘void __countErrorHandler(const char*, void*)’ defined but not used [-Wunused-function]
 static void __countErrorHandler(const char *fmt, void *userdata) {
             ^
geos.cpp:72:13: attention : ‘void __emptyNoticeHandler(const char*, void*)’ defined but not used [-Wunused-function]
 static void __emptyNoticeHandler(const char *fmt, void *userdata) { }
             ^
make: *** [geos.o] Erreur 1
ERROR: compilation failed for package ‘sf’
* removing ‘/home/admin/R/x86_64-redhat-linux-gnu-library/3.4/sf’
Warning in install.packages :
  installation of package ‘sf’ had non-zero exit status

The downloaded source packages are in
	‘/tmp/RtmpgBPpgF/downloaded_packages’

My Geos version is now 3.3.8

@edzer
Copy link
Member

edzer commented Mar 27, 2018

The output of the configure script might be helpful. Second code block of your first post here.

@saberbouabid
Copy link
Author

I just update my comment if you mean all the ouptut

@edzer
Copy link
Member

edzer commented Mar 27, 2018

Ah, looking at rgeos code, it turns out you need to have at least GEOS 3.4.0; I'll correct that in the sf system requirements. (3.4.0 has been out more than 4 years).

edzer added a commit that referenced this issue Mar 27, 2018
@saberbouabid
Copy link
Author

Ok ! thank you for your help

@bhogan-mitre
Copy link

@edzer Thanks for the response here! I think I am experiencing a similar issue.

I believe the GEOS requirement needs to be updated in configure (and configure.ac) as well.

It looks like it is still satisfied w/GEOS >= 3.3.0:
https://github.com/r-spatial/sf/blob/master/configure#L3985-L3995

@saberbouabid
Copy link
Author

saberbouabid commented Apr 6, 2018

Hi, I forget to mention that upgrading GEOS version didn't resolve this issue. Actually I updated also my compiler to 4.9.0 and then everything works fine

sudo yum install libmpc-devel mpfr-devel gmp-devel
wget https://ftp.gnu.org/gnu/gcc/gcc-4.9.0/gcc-4.9.0.tar.bz2
tar xvfj gcc-4.9.0.tar.bz2
cd gcc-4.9.0
./configure --disable-multilib --enable-languages=c,c++
make -j 4
make install

edzer added a commit that referenced this issue Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants