zhm / gdal-ruby

GDAL/OGR bindings for ruby
BSD 3-Clause "New" or "Revised" License
34 stars 10 forks source link

Can't compile on Alpine Linux #12

Open Kjir opened 7 years ago

Kjir commented 7 years ago

I'm trying to install ruby-gdal on a Docker container based on Alpine Linux, but the build fails with a compiler error:

osr.cpp: In function 'OGRErr
OSRSpatialReferenceShadow_ImportFromOzi(OSRSpatialReferenceShadow*, const char*,
const char*, const char*)':
osr.cpp:2476:59: error: cannot convert 'const char*' to 'const char* const*' for
argument '2' to 'OGRErr OSRImportFromOzi(OGRSpatialReferenceH, const char*
const*)'
     return OSRImportFromOzi( self, datum, proj, projParms );
                                                           ^

Here are the compiler versions:

/app # gcc --version
gcc (Alpine 5.3.0) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

/app # g++ --version
g++ (Alpine 5.3.0) 5.3.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Here is the full error log:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/app/vendor/bundle/ruby/2.3.0/gems/gdal-1.0.0/ext/gdal-ruby/osr
/usr/local/bin/ruby -r ./siteconf20170210-7-munw81.rb extconf.rb
checking for main() in -lgdal... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/app/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0-static/gdal-1.0.0/mkmf.log

current directory:
/app/vendor/bundle/ruby/2.3.0/gems/gdal-1.0.0/ext/gdal-ruby/osr
make "DESTDIR=" clean

current directory:
/app/vendor/bundle/ruby/2.3.0/gems/gdal-1.0.0/ext/gdal-ruby/osr
make "DESTDIR="
compiling osr.cpp
cc1plus: warning: command line option '-Wdeclaration-after-statement' is valid
for C/ObjC but not for C++
cc1plus: warning: command line option '-Wimplicit-function-declaration' is valid
for C/ObjC but not for C++
osr.cpp: In function 'OGRErr
OSRSpatialReferenceShadow_ImportFromOzi(OSRSpatialReferenceShadow*, const char*,
const char*, const char*)':
osr.cpp:2476:59: error: cannot convert 'const char*' to 'const char* const*' for
argument '2' to 'OGRErr OSRImportFromOzi(OGRSpatialReferenceH, const char*
const*)'
     return OSRImportFromOzi( self, datum, proj, projParms );
                                                           ^
osr.cpp: In function 'VALUE _wrap_new_SpatialReference(int, VALUE*, VALUE)':
osr.cpp:2830:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_acea(int, VALUE*,
VALUE)':
osr.cpp:4270:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_ae(int, VALUE*, VALUE)':
osr.cpp:4349:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_bonne(int, VALUE*,
VALUE)':
osr.cpp:4418:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^                                                                                                                                                                                                                    [120/1968]
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_cea(int, VALUE*, VALUE)':
osr.cpp:4487:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_cs(int, VALUE*, VALUE)':
osr.cpp:4556:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_ec(int, VALUE*, VALUE)':
osr.cpp:4631:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_eckert_iv(int, VALUE*,
VALUE)':
osr.cpp:4707:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_eckert_vi(int, VALUE*,
VALUE)':
osr.cpp:4768:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_equirectangular(int,
VALUE*, VALUE)':
osr.cpp:4832:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_equirectangular2(int,
VALUE*, VALUE)':
osr.cpp:4904:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE
_wrap_SpatialReference_set_gauss_schreiber_tmercator(int, VALUE*, VALUE)':
osr.cpp:4981:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_gs(int, VALUE*, VALUE)':
osr.cpp:5052:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_gh(int, VALUE*, VALUE)':
osr.cpp:5113:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_geos(int, VALUE*,
VALUE)':
osr.cpp:5211:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_gnomonic(int, VALUE*,
VALUE)':
osr.cpp:5280:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_hom(int, VALUE*, VALUE)':
osr.cpp:5358:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_hom_2pno(int, VALUE*,
VALUE)':
osr.cpp:5454:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_krovak(int, VALUE*,
VALUE)':
osr.cpp:5552:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_laea(int, VALUE*,
VALUE)':
osr.cpp:5636:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_lcc(int, VALUE*, VALUE)':
osr.cpp:5711:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_lcc_1sp(int, VALUE*,
VALUE)':
osr.cpp:5793:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_lccb(int, VALUE*,
VALUE)':
osr.cpp:5873:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_mc(int, VALUE*, VALUE)':
osr.cpp:5952:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_mercator(int, VALUE*,
VALUE)':
osr.cpp:6024:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_mollweide(int, VALUE*,
VALUE)':
osr.cpp:6095:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_nzmg(int, VALUE*,
VALUE)':
osr.cpp:6159:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_os(int, VALUE*, VALUE)':
osr.cpp:6231:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_orthographic(int, VALUE*,
VALUE)':
osr.cpp:6305:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_polyconic(int, VALUE*,
VALUE)':
osr.cpp:6374:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_ps(int, VALUE*, VALUE)':
osr.cpp:6446:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_robinson(int, VALUE*,
VALUE)':
osr.cpp:6517:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_sinusoidal(int, VALUE*,
VALUE)':
osr.cpp:6578:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_stereographic(int,
VALUE*, VALUE)':
osr.cpp:6645:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_soc(int, VALUE*, VALUE)':
osr.cpp:6719:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_tm(int, VALUE*, VALUE)':
osr.cpp:6791:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_tmvariant(int, VALUE*,
VALUE)':
osr.cpp:6872:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_tmg(int, VALUE*, VALUE)':
osr.cpp:6953:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_tmso(int, VALUE*,
VALUE)':
osr.cpp:7025:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
osr.cpp: In function 'VALUE _wrap_SpatialReference_set_vdg(int, VALUE*, VALUE)':
osr.cpp:7096:15: warning: unused variable 'kwnames' [-Wunused-variable]
   const char *kwnames[] = {
               ^
Makefile:230: recipe for target 'osr.o' failed
make: *** [osr.o] Error 1

make failed, exit code 2
cebartling commented 6 years ago

This issue also occurs on Ubuntu 17.04.

osr.cpp:2476:59: error: cannot convert ‘const char*’ to ‘const char* const*’ for argument ‘2’ to ‘OGRErr OSRImportFromOzi(OGRSpatialReferenceH, const char* const*)’
     return OSRImportFromOzi( self, datum, proj, projParms );
svilenkov commented 6 years ago

We had a similar issue, and we did first tried to solve it by updating the g++ and make binaries. But i think the issue was gone after we've ensured to match the GDAL version which were used to generate the ruby bindings in this gem to the GDAL version of the includes and libs installed on the system. Any GDAL source version can be downloaded from https://trac.osgeo.org/gdal/wiki/DownloadSource.

Judging from the CHANGELOG.md of this repository, gdal 1.10.1 was last used to generate swig ruby gdal bindings. I've created a 1.11.5 (last before 2.x) branch with regenerated bindings at: github.com/svilenkov/gdal-ruby/tree/gdal-1.11.5 in case you are interested in that version, but keep in mind that it's not tested fully yet.

mauroc commented 6 years ago

confirming I am having the same issue with any version of GDAL > 2.x, so ended up installing 1.11.5 . Any hope that the gem could be regenerated with the swig ruby bindings using GDAL > 2.x?

svilenkov commented 6 years ago

@mauroc I think they have removed ruby bindings due to lack of a maintainer from GDAL version 2.X. Not sure which exact version, but there are bindings up to some 2.x version. see https://trac.osgeo.org/gdal/wiki/GdalOgrInRuby

You might wanna try this: https://github.com/aleksejleonov/gdal-ruby/wiki/GDAL-Ruby-SWIG-bindings