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

Calogero Mauceri mauceri at actgate.com
Thu Aug 25 06:10:59 PDT 2016


Thanks Even for your reply.

I had a look to port/cpl_config.h and in both cases (32 and 64 bit) the 
following line is commented

[...]

/* Define to 1, if your compiler supports long long data type */
/* #undef HAVE_LONG_LONG */

[...]

I tried --with-macosx-framework and "-arch i386 -arch x86_64" but 
unfortunately did not work:
--with-macosx-framework is not recognized as a valid option and if I add 
-arch x86_64 flag I get the following configuration errors

[...]
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... Running ld for i386 ...
Running ld for x86_64 ...
yes
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... Running ld for i386 ...
Running ld for x86_64 ...
yes
checking how to run the C preprocessor... /lib/cpp
configure: error: in `/Users/mauceri/work/dev/libs/gdal-2.1.1':
configure: error: C preprocessor "/lib/cpp" fails sanity check


To add more information, GDAL 1.11.5 and 2.0.3 properly build in 32 bits 
on the same machine.

Calogero


Il 8/25/2016 1:48 AM, Even Rouault ha scritto:
> 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
>

-- 
Calogero Mauceri
Software Engineer

Applied Coherent Technology Corporation (ACT)
www.actgate.com



More information about the gdal-dev mailing list