[gdal-dev] GDAL 2.1.0 build error (32 bit, Mac)

Even Rouault even.rouault at spatialys.com
Wed Aug 24 16:48:11 PDT 2016


On Wednesday 24 August 2016 16:00:02 Calogero Mauceri wrote:
> Hi all,
> I'm trying to build GDAL 2.1.0 in 32 bit on Mac OS X.
> I set the following environment variables
> 
> export CFLAGS="-arch i386"
> export CXXFLAGS="-arch i386"
> export CPPFLAGS="-arch i386"
> export LDFLAGS="-arch i386"
> 
> and then execute
> 
> ./configure
> 
> The build stops with the following error
> 
> /bin/sh /Users/mauceri/work/dev/libs/gdal-2.1.1/libtool --mode=compile
> --tag=CXX g++ -I/Users/mauceri/work/dev/libs/gdal-2.1.1/port
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/gcore
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/alg
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/ogr
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/ogr/ogrsf_frmts
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/gnm
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/apps -arch i386  -Wall -Wextra
> -Winit-self -Wunused-parameter -Wformat -Werror=format-security
> -Wno-format-nonliteral -Wshorten-64-to-32 -Wshadow -Werror=vla
> -Wnull-dereference -Wunused-private-field -Wmissing-prototypes
> -Wmissing-declarations -Wnon-virtual-dtor -Woverloaded-virtual
> -fno-operator-names  -I..  -I../jpeg -DHAVE_LIBJPEG -I../jpeg/libjpeg
> -DINTERNAL_LIBGEOTIFF -Ilibgeotiff -DINTERNAL_LIBTIFF -Ilibtiff
> -DBIGTIFF_SUPPORT -DOGR_ENABLED -arch i386
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/port  -DGDAL_COMPILATION -c -o
> ../o/geotiff.lo geotiff.cpp
> libtool: compile:  g++ -I/Users/mauceri/work/dev/libs/gdal-2.1.1/port
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/gcore
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/alg
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/ogr
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/ogr/ogrsf_frmts
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/gnm
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/apps -arch i386 -Wall -Wextra
> -Winit-self -Wunused-parameter -Wformat -Werror=format-security
> -Wno-format-nonliteral -Wshorten-64-to-32 -Wshadow -Werror=vla
> -Wnull-dereference -Wunused-private-field -Wmissing-prototypes
> -Wmissing-declarations -Wnon-virtual-dtor -Woverloaded-virtual
> -fno-operator-names -I.. -I../jpeg -DHAVE_LIBJPEG -I../jpeg/libjpeg
> -DINTERNAL_LIBGEOTIFF -Ilibgeotiff -DINTERNAL_LIBTIFF -Ilibtiff
> -DBIGTIFF_SUPPORT -DOGR_ENABLED -arch i386
> -I/Users/mauceri/work/dev/libs/gdal-2.1.1/port -DGDAL_COMPILATION -c
> geotiff.cpp  -fno-common -DPIC -o ../o/.libs/geotiff.o
> geotiff.cpp:9771:21: error: no member named 'my_function' in
> 'CPLStaticAssert<false>'; did you mean 'CPLStaticAssert<true>::my_function'?
> if( bSwap ) CPL_SWAP64PTR(&nTmp);
>                      ^~~~~~~~~~~~~~~~~~~~
> /Users/mauceri/work/dev/libs/gdal-2.1.1/port/cpl_port.h:655:5: note:
> expanded from macro 'CPL_SWAP64PTR'
>      CPL_STATIC_ASSERT_IF_AVAILABLE(sizeof(*(x)) == 1 || sizeof(*(x)) ==
> 8); \
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /Users/mauceri/work/dev/libs/gdal-2.1.1/port/cpl_port.h:605:43: note:
> expanded from macro 'CPL_STATIC_ASSERT_IF_AVAILABLE'
> #define CPL_STATIC_ASSERT_IF_AVAILABLE(x) CPL_STATIC_ASSERT(x)
> ^~~~~~~~~~~~~~~~~~~~
> /Users/mauceri/work/dev/libs/gdal-2.1.1/port/cpl_port.h:604:30: note:
> expanded from macro 'CPL_STATIC_ASSERT'
> #define CPL_STATIC_ASSERT(x) CPLStaticAssert<x>::my_function()
>                               ^~~~~~~~~~~~~~~~~~~~
> /Users/mauceri/work/dev/libs/gdal-2.1.1/port/cpl_port.h:599:17: note:
> 'CPLStaticAssert<true>::my_function' declared here
>      static void my_function() {}
> 
> [...]
> 
> Do you have any idea on how to fix this?

One of the reason for which it would happen is that GUIntBig type doesn't 
resolve to a 64 bit integer but to a 32 bit one. And that could happen if the 
HAVE_LONG_LONG macro is not defined in the port/cpl_config.h file that is 
generated by ./configure. Now I'm not Mac savvy enough to tell you why that 
would happen...

Quickly looking at https://trac.osgeo.org/gdal/wiki/BuildingOnMac , it seems 
you can/should specify  --with-macosx-framework and possibly use "-arch i386 -
arch x86_64"

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list