[gdal-dev] Cannot build for iOS due to GUInt64 error

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

[gdal-dev] Cannot build for iOS due to GUInt64 error

Nik Sands-3
Hi,

I’m attempting to build GDAL for the first time in a while, and this is the first time for GDAL 2.2.2.  I’ve getting the following error when building for iOS arm64 on Mac OS X:

------------------------
geotiff.cpp:7653:13: error: unknown type name 'GUInt64'
    typedef GUInt64 WordType;
            ^
1 error generated.
make[2]: *** [../o/geotiff.lo] Error 1
make[1]: *** [gtiff-install-obj] Error 2
make: *** [frmts-target] Error 2
------------------------

The relevant part of geotiff.cpp is:

------------------------
#if SIZEOF_VOIDP == 8 || defined(__x86_64__)
    // We test __x86_64__ for x32 arch where SIZEOF_VOIDP == 4
    typedef GUInt64 WordType;
#else
    typedef unsigned int WordType;
#endif
------------------------

Should I be adding some exception condition into the ‘if’ part in order to get it to use unsigned int instead of GUInt64?  Or is there some other way that this should be handled for iOS arm64 when building on Mac OS X?

Cheers,
Nik.

========================================================
NIK SANDS
Line Tamer | Time Traveller | Space Cadet

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

Re: Cannot build for iOS due to GUInt64 error

Even Rouault-2

On samedi 11 novembre 2017 11:09:48 CET Nik Sands wrote:

> Hi,

>

> I’m attempting to build GDAL for the first time in a while, and this is the

> first time for GDAL 2.2.2. I’ve getting the following error when building

> for iOS arm64 on Mac OS X:

>

> ------------------------

> geotiff.cpp:7653:13: error: unknown type name 'GUInt64'

> typedef GUInt64 WordType;

> ^

> 1 error generated.

> make[2]: *** [../o/geotiff.lo] Error 1

> make[1]: *** [gtiff-install-obj] Error 2

> make: *** [frmts-target] Error 2

> ------------------------

>

> The relevant part of geotiff.cpp is:

>

> ------------------------

> #if SIZEOF_VOIDP == 8 || defined(__x86_64__)

> // We test __x86_64__ for x32 arch where SIZEOF_VOIDP == 4

> typedef GUInt64 WordType;

> #else

> typedef unsigned int WordType;

> #endif

> ------------------------

>

> Should I be adding some exception condition into the ‘if’ part in order to

> get it to use unsigned int instead of GUInt64? Or is there some other way

> that this should be handled for iOS arm64 when building on Mac OS X?

 

Nik,

 

This is the sign of a serious configuration error. Patching it there will just hide many other problems elsewhere where 64bit integer is needed.

 

This likely occurs because HAVE_LONG_LONG is not set for some reason when configure runs.

If you run configure, I guess the "Checking for 64bit integer type" returns no.

 

Can you try the following (replace cc by the appropriate (cross)compiler binary) ?

echo 'int main() { long long off=0; }' > conftest.c

cc -o conftest conftest.c

 

Even

 

--

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: Cannot build for iOS due to GUInt64 error

Nik Sands-3
Hi Even,

Thanks for your reply.  You are correct as usual.  Your ‘cc’ test produced no errors, and your mention of ‘HAVE_LONG_LONG’ reminded me that I had have issues with that when compiling older versions of GDAL as well.  So I went back to my old build script and checked and found that I always used to do the following:

—————————————————————————
    tar -xzf gdal-$gdal_ver.tar.gz
    sed 's/#undef HAVE_LONG_LONG/\/\* #undef HAVE_LONG_LONG \*\/\'$'\n#define HAVE_LONG_LONG 1/' gdal-$gdal_ver/port/cpl_config.h.in > gdal-$gdal_ver/port/cpl_config.h.in.NEW
    mv gdal-$gdal_ver/port/cpl_config.h.in gdal-$gdal_ver/port/cpl_config.h.in.ORIG
    mv gdal-$gdal_ver/port/cpl_config.h.in.NEW gdal-$gdal_ver/port/cpl_config.h.in
—————————————————————————

I’ve now done this again with GDAL 2.2.2 and this old work around gets it to compile OK (the same way the work around always did for older versions - I had just forgotten it).

Is there some way this could be changed in the config/source so that it has the correct HAVE_LONG_LONG value for iOS/arm64 without requiring this work around?

Cheers,
Nik.


On 11 Nov 2017, at 11:44 pm, Even Rouault <[hidden email]> wrote:

On samedi 11 novembre 2017 11:09:48 CET Nik Sands wrote:
> Hi,
>
> I’m attempting to build GDAL for the first time in a while, and this is the
> first time for GDAL 2.2.2. I’ve getting the following error when building
> for iOS arm64 on Mac OS X:
>
> ------------------------
> geotiff.cpp:7653:13: error: unknown type name 'GUInt64'
> typedef GUInt64 WordType;
> ^
> 1 error generated.
> make[2]: *** [../o/geotiff.lo] Error 1
> make[1]: *** [gtiff-install-obj] Error 2
> make: *** [frmts-target] Error 2
> ------------------------
>
> The relevant part of geotiff.cpp is:
>
> ------------------------
> #if SIZEOF_VOIDP == 8 || defined(__x86_64__)
> // We test __x86_64__ for x32 arch where SIZEOF_VOIDP == 4
> typedef GUInt64 WordType;
> #else
> typedef unsigned int WordType;
> #endif
> ------------------------
>
> Should I be adding some exception condition into the ‘if’ part in order to
> get it to use unsigned int instead of GUInt64? Or is there some other way
> that this should be handled for iOS arm64 when building on Mac OS X?

 

Nik,

 

This is the sign of a serious configuration error. Patching it there will just hide many other problems elsewhere where 64bit integer is needed.

 

This likely occurs because HAVE_LONG_LONG is not set for some reason when configure runs.
If you run configure, I guess the "Checking for 64bit integer type" returns no.

 

Can you try the following (replace cc by the appropriate (cross)compiler binary) ?
echo 'int main() { long long off=0; }' > conftest.c
cc -o conftest conftest.c

 

Even

 

--
Spatialys - Geospatial professional services


========================================================
NIK SANDS
Line Tamer | Time Traveller | Space Cadet


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

Re: Cannot build for iOS due to GUInt64 error

Even Rouault-2

On dimanche 12 novembre 2017 19:50:47 CET Nik Sands wrote:

> Hi Even,

>

> Thanks for your reply. You are correct as usual. Your ‘cc’ test produced

> no errors,

 

And no warnings as well ?

Weird, since this is the test that is used to dected long long presence

See m4/acinclude.m4

 

Do you run configure with CCFLAGS defined ? For example, if CCFLAGS="-Wall", then the test will throw a warning that will make it fail.

I'm not sure why we use CCFLAGS in that file, whereas CFLAGS is used everywhere else.

 

What if you change in m4/acinclude.m4

echo 'int main() { long long off=0; }' >> conftest.c

to

echo 'int main() { long long off=0; (void)off; return 0; }' > conftest.c

 

and run autoconf to regenerate configure ?

 

Even

 

--

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: Cannot build for iOS due to GUInt64 error

Nik Sands-3
Hi Even,

If I include the -Wall option, then I do get just the one warning.  Here’s the command line I’m using, which is based on similar command lines from the make output…

------------------------------------
$ /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -o conftest -arch arm64 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk -Wno-implicit-function-declaration -fembed-bitcode -mno-thumb -Wall  -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk conftest.c -ldl
conftest.c:1:24: warning: unused variable 'off' [-Wunused-variable]
int main() { long long off=0; }
                       ^
1 warning generated.
$
——————————————————

I made the change you suggested to acinclude.m4 and then ran autoconf.  Then I attempted to build GDAL again, but got the same error:

--------------------------------------------------
geotiff.cpp:7653:13: error: unknown type name 'GUInt64'
    typedef GUInt64 WordType;
            ^
1 error generated.
make[2]: *** [../o/geotiff.lo] Error 1
make[1]: *** [gtiff-install-obj] Error 2
make: *** [frmts-target] Error 2
--------------------------------------------------

I have to admit that I’m a very small-time developer and I’m somewhat out of my depth here, so forgive me if I sound like I don’t understand some of this stuff.

Cheers,
Nik.

On 12 Nov 2017, at 11:22 pm, Even Rouault <[hidden email]> wrote:

On dimanche 12 novembre 2017 19:50:47 CET Nik Sands wrote:
> Hi Even,
>
> Thanks for your reply. You are correct as usual. Your ‘cc’ test produced
> no errors,

 

And no warnings as well ?
Weird, since this is the test that is used to dected long long presence
See m4/acinclude.m4

 

Do you run configure with CCFLAGS defined ? For example, if CCFLAGS="-Wall", then the test will throw a warning that will make it fail.
I'm not sure why we use CCFLAGS in that file, whereas CFLAGS is used everywhere else.

 

What if you change in m4/acinclude.m4
echo 'int main() { long long off=0; }' >> conftest.c
to
echo 'int main() { long long off=0; (void)off; return 0; }' > conftest.c

 

and run autoconf to regenerate configure ?

 

Even

 

--
Spatialys - Geospatial professional services


========================================================
NIK SANDS
Line Tamer | Time Traveller | Space Cadet


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

Re: Cannot build for iOS due to GUInt64 error

Even Rouault-2
In reply to this post by Even Rouault-2

On mardi 14 novembre 2017 07:30:14 CET Nik Sands wrote:

> Hi Even,

>

> If I include the -Wall option, then I do get just the one warning. Here’s

> the command line I’m using, which is based on similar command lines from

> the make output…

>

> ------------------------------------

> $ /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -o conftest -arch

> arm64 -pipe -Os -gdwarf-2 -isysroot

> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Deve

> loper/SDKs/iPhoneOS11.1.sdk -Wno-implicit-function-declaration

> -fembed-bitcode -mno-thumb -Wall -arch arm64 -isysroot

> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Deve

> loper/SDKs/iPhoneOS11.1.sdk conftest.c -ldl conftest.c:1:24: warning: unused

> variable 'off' [-Wunused-variable] int main() { long long off=0; }

> ^

> 1 warning generated.

> $

 

And what does the above return if you do it on the following conftest.c:

 

int main() { long long off=0; (void)off; return 0; }

 

--

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: Cannot build for iOS due to GUInt64 error

Dmitry Baryshnikov-2
In reply to this post by Nik Sands-3

Hi Nik,

You may try alternative build scenario using CMake.

1.  Install XCode command line tools if already not done this (https://www.embarcadero.com/starthere/xe5/mobdevsetup/ios/en/installing_the_commandline_tools.html) and CMake (https://cmake.org/download/)


2. In terminal execute commands:

> git clone --depth 1 https://github.com/nextgis-borsch/lib_gdal.git
> cd lib_gdal
> mkdir build
> cd build
> cmake -G"Unix Makefiles" -DBUILD_TARGET_PLATFORM=IOS -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Release -DENABLE_BITCODE=OFF -DIOS_ARCH=arm64 -DIOS_PLATFORM=OS -DENABLE_NEON=ON -DCMAKE_TOOLCHAIN_FILE=../cmake/ios.toolchain.cmake -DWITH_JSONC=ON -DWITH_JSONC_EXTERNAL=ON -DWITH_TIFF=ON -DWITH_TIFF_EXTERNAL=ON -DWITH_GeoTIFF=ON -DWITH_GeoTIFF_EXTERNAL=ON -DOSX_FRAMEWORK=ON -DENABLE_GIF=OFF -DENABLE_CAD=OFF -DENABLE_PNG=OFF -DGDAL_BUILD_APPS=OFF -DGDAL_BUILD_DOCS=OFF -DWITH_PYTHON=OFF ..

Some flags description:
-DIOS_ARCH maybe armv7, armv7s, arm64, i386 or x86_64
-DIOS_PLATFORM maybe IOS or SIMULATOR

After configuring you will see summary about GDAL build or error message. I expect everything will be fine.

Run this command to build GDAL:

> cmake --build . -- -j 4

May be this need to rerun twice as dependency may not build on first run.

You may build GDAL for several architectures and create fat library using lipo -create command (I rewrite OpenCV py script to automate creating my own fat iOS library which use GDAL - https://github.com/nextgis/nextgis_datastore/blob/master/opt/ios/build_framework.py)


This is minimal build of GDAL. If you need some drivers which not build by listed command let me know - I'll help to modify command line options.

Best regards,
    Dmitry
13.11.2017 23:30, Nik Sands пишет:
Hi Even,

If I include the -Wall option, then I do get just the one warning.  Here’s the command line I’m using, which is based on similar command lines from the make output…

------------------------------------
$ /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -o conftest -arch arm64 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk -Wno-implicit-function-declaration -fembed-bitcode -mno-thumb -Wall  -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk conftest.c -ldl
conftest.c:1:24: warning: unused variable 'off' [-Wunused-variable]
int main() { long long off=0; }
                       ^
1 warning generated.
$
——————————————————

I made the change you suggested to acinclude.m4 and then ran autoconf.  Then I attempted to build GDAL again, but got the same error:

--------------------------------------------------
geotiff.cpp:7653:13: error: unknown type name 'GUInt64'
    typedef GUInt64 WordType;
            ^
1 error generated.
make[2]: *** [../o/geotiff.lo] Error 1
make[1]: *** [gtiff-install-obj] Error 2
make: *** [frmts-target] Error 2
--------------------------------------------------

I have to admit that I’m a very small-time developer and I’m somewhat out of my depth here, so forgive me if I sound like I don’t understand some of this stuff.

Cheers,
Nik.

On 12 Nov 2017, at 11:22 pm, Even Rouault [hidden email] wrote:

On dimanche 12 novembre 2017 19:50:47 CET Nik Sands wrote:
Hi Even,

Thanks for your reply.  You are correct as usual.  Your ‘cc’ test produced
no errors, 
 
And no warnings as well ?
Weird, since this is the test that is used to dected long long presence
See m4/acinclude.m4
 
Do you run configure with CCFLAGS defined ? For example, if CCFLAGS="-Wall", then the test will throw a warning that will make it fail.
I'm not sure why we use CCFLAGS in that file, whereas CFLAGS is used everywhere else.
 
What if you change in m4/acinclude.m4
  echo 'int main() { long long off=0; }' >> conftest.c
to
  echo 'int main() { long long off=0; (void)off; return 0; }' > conftest.c
 
and run autoconf to regenerate configure ?
 
Even
 
-- 
Spatialys - Geospatial professional services
http://www.spatialys.com <http://www.spatialys.com/>
========================================================
NIK SANDS
Line Tamer | Time Traveller | Space Cadet




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


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

Re: Cannot build for iOS due to GUInt64 error

Nik Sands-3
In reply to this post by Even Rouault-2
No output at all (no errors, no warnings) for that test.

Cheers,
Nik.

(PS.  Re-sent to include the list address)

-----------------------------------------
NIK SANDS
Line Tamer | Time Traveller | Space Cadet


----- Original Message -----
From:
"Even Rouault" <[hidden email]>

To:
"Nik Sands" <[hidden email]>
Cc:
<[hidden email]>
Sent:
Mon, 13 Nov 2017 21:40:32 +0100
Subject:
Re: [gdal-dev] Cannot build for iOS due to GUInt64 error


On mardi 14 novembre 2017 07:30:14 CET Nik Sands wrote:

> Hi Even,

>

> If I include the -Wall option, then I do get just the one warning. Here’s

> the command line I’m using, which is based on similar command lines from

> the make output…

>

> ------------------------------------

> $ /Applications/Xcode.app/Contents/Developer/usr/bin/gcc -o conftest -arch

> arm64 -pipe -Os -gdwarf-2 -isysroot

> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Deve

> loper/SDKs/iPhoneOS11.1.sdk -Wno-implicit-function-declaration

> -fembed-bitcode -mno-thumb -Wall -arch arm64 -isysroot

> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Deve

> loper/SDKs/iPhoneOS11.1.sdk conftest.c -ldl conftest.c:1:24: warning: unused

> variable 'off' [-Wunused-variable] int main() { long long off=0; }

> ^

> 1 warning generated.

> $

 

And what does the above return if you do it on the following conftest.c:

 

int main() { long long off=0; (void)off; return 0; }

 

--

Spatialys - Geospatial professional services

http://www.spatialys.com


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