GDAL 2.2.0 Compilation error with OSX 10.12

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

GDAL 2.2.0 Compilation error with OSX 10.12

Ruedi Boesch
with http://download.osgeo.org/gdal/2.2.0/gdal-2.2.0.tar.gz
==>
==> no member named 'back' in 'CPLString'
==>
configure ... --enable-pdf-plugin ...

Compiling with macos 10.12 (toolchain XCode 8.3 (Apple LLVM version 8.1.0 (clang-802.0.42))) fails in
gdal-2.2.0/frmts/pdf/pdfcreatecopy.cpp:2342

PROBLEM: configure defines HAVE_CXX11, but emits
libtool: compile:  g++ -std=gnu++11 ...

(c++11 supports std:string::back(), but gnu++11 not ??)

==> WORKAROUND:
In
gdal-2.2.0/port/cpl_string.h:383

change

#ifndef HAVE_CXX11

to

// Note: This is standard in C++11.
#if defined (__APPLE__) || !defined (HAVE_CXX11)
    /** Return last character (undefined behaviour if string is empty) */
    const char& back() const { return operator[](size()-1); }
    /** Return last character (undefined behaviour if string is empty) */
    char& back() { return operator[](size()-1); }
#endif

Ruedi




Reply | Threaded
Open this post in threaded view
|

Re: GDAL 2.2.0 Compilation error with OSX 10.12

Even Rouault-2

On vendredi 12 mai 2017 14:01:16 CEST Ruedi Boesch wrote:

> with http://download.osgeo.org/gdal/2.2.0/gdal-2.2.0.tar.gz

> ==>

> ==> no member named 'back' in 'CPLString'

> ==>

> configure ... --enable-pdf-plugin ...

>

> Compiling with macos 10.12 (toolchain XCode 8.3 (Apple LLVM version 8.1.0

> (clang-802.0.42))) fails in

> gdal-2.2.0/frmts/pdf/pdfcreatecopy.cpp:2342

>

> PROBLEM: configure defines HAVE_CXX11, but emits

> libtool: compile: g++ -std=gnu++11 ...

 

And what if you modify GDALmake.opt (after configure stage) to replace

-std=gnu++11 with -std=c++11 ?

 

>

> (c++11 supports std:string::back(), but gnu++11 not ??)

>

> ==> WORKAROUND:

> In

> gdal-2.2.0/port/cpl_string.h:383

>

> change

>

> #ifndef HAVE_CXX11

>

> to

>

> // Note: This is standard in C++11.

> #if defined (__APPLE__) || !defined (HAVE_CXX11)

> /** Return last character (undefined behaviour if string is empty) */

> const char& back() const { return operator[](size()-1); }

> /** Return last character (undefined behaviour if string is empty) */

> char& back() { return operator[](size()-1); }

> #endif

>

> Ruedi

>

>

>

>

>

>

>

>

> --

> View this message in context:

> http://osgeo-org.1560.x6.nabble.com/GDAL-2-2-0-Compilation-error-with-OSX-1

> 0-12-tp5320401.html Sent from the GDAL - Dev mailing list archive at

> Nabble.com.

> _______________________________________________

> gdal-dev mailing list

> [hidden email]

> https://lists.osgeo.org/mailman/listinfo/gdal-dev

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: GDAL 2.2.0 Compilation error with OSX 10.12

Even Rouault-2

On samedi 13 mai 2017 10:58:01 CEST Ruedi Boesch wrote:

> with GDALmake.opt:

> ...

> CC = $(LIBTOOL_COMPILE_CC) gcc

> CXX = $(LIBTOOL_COMPILE_CXX) g++ -std=c++11

> LD = $(LIBTOOL_LINK) g++ -std=gnu++11

> ...

>

> I get:

>

> libtool: compile: g++ -std=c++11 -DHAVE_AVX_AT_COMPILE_TIME

> -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2 -Wall ....

>

> pdfcreatecopy.cpp:2342:37: error: no member named 'back' in 'CPLString'

> osLabelText.back() == '}' )

> ~~~~~~~~~~~ ^

> 1 error generated.

 

OK. No better. I guess then that you should try the solution exposed in

https://lists.osgeo.org/pipermail/gdal-dev/2017-April/046531.html

 

 

 

>

> Ruedi

>

> > Am 12.05.2017 um 23:15 schrieb Even Rouault <[hidden email]>:

> >

> > On vendredi 12 mai 2017 14:01:16 CEST Ruedi Boesch wrote:

> > > with http://download.osgeo.org/gdal/2.2.0/gdal-2.2.0.tar.gz

> > > <http://download.osgeo.org/gdal/2.2.0/gdal-2.2.0.tar.gz> ==>

> > > ==> no member named 'back' in 'CPLString'

> > > ==>

> > > configure ... --enable-pdf-plugin ...

> > >

> > > Compiling with macos 10.12 (toolchain XCode 8.3 (Apple LLVM version

> > > 8.1.0

> > > (clang-802.0.42))) fails in

> > > gdal-2.2.0/frmts/pdf/pdfcreatecopy.cpp:2342

> > >

> > > PROBLEM: configure defines HAVE_CXX11, but emits

> > > libtool: compile: g++ -std=gnu++11 ...

> >

> > And what if you modify GDALmake.opt (after configure stage) to replace

> > -std=gnu++11 with -std=c++11 ?

> >

> > > (c++11 supports std:string::back(), but gnu++11 not ??)

> > >

> > > ==> WORKAROUND:

> > > In

> > > gdal-2.2.0/port/cpl_string.h:383

> > >

> > > change

> > >

> > > #ifndef HAVE_CXX11

> > >

> > > to

> > >

> > > // Note: This is standard in C++11.

> > > #if defined (__APPLE__) || !defined (HAVE_CXX11)

> > >

> > > /** Return last character (undefined behaviour if string is empty)

> > > */

> > > const char& back() const { return operator[](size()-1); }

> > > /** Return last character (undefined behaviour if string is empty)

> > > */

> > > char& back() { return operator[](size()-1); }

> > >

> > > #endif

> > >

> > > Ruedi

> > >

> > >

> > >

> > >

> > >

> > >

> > >

> > >

> > > --

> > > View this message in context:

> > > http://osgeo-org.1560.x6.nabble.com/GDAL-2-2-0-Compilation-error-with-OS

> > > X-1

> > > <http://osgeo-org.1560.x6.nabble.com/GDAL-2-2-0-Compilation-error-with-

> > > OSX-1> 0-12-tp5320401.html Sent from the GDAL - Dev mailing list archive

> > > at Nabble.com <http://nabble.com/>.

> > > _______________________________________________

> > > gdal-dev mailing list

> > > [hidden email] <mailto:[hidden email]>

> > > https://lists.osgeo.org/mailman/listinfo/gdal-dev

> > > <https://lists.osgeo.org/mailman/listinfo/gdal-dev>

 

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


_______________________________________________
gdal-dev mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/gdal-dev