[gdal-dev] Cannot compile 1.10 for iOS due to missing crt_extern

Nik Sands nixanz at nixanz.com
Mon Aug 12 17:49:47 PDT 2013


PS.  I've got a work around for now...

I edited the file "ogr/ogrsf_frmts/vfk/vfkdatablock.cpp" and commented out the lines that referenced "clock()", and the debug line which appears to be all that was using it.

It then built OK.   :-)

I'm sure you guys can come up with a proper solution, but this did the job for me for now.   :-)

Cheers,
Nik.



On 13/08/2013, at 10:16 AM, Nik Sands <nixanz at nixanz.com> wrote:

> Hi Even,
> 
> Your suggestion has helped a little, but I still can't compile for iOS (device).  I'm getting the following at the end of the build output...
> 
> 
> libtool: compile:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++ -arch armv7 -pipe -Os -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk -mno-thumb -mthumb-interwork -Wall -I/Users/nsands/Documents/Nik/Development/gdal-1.10.0/port -I/Users/nsands/Documents/Nik/Development/gdal-1.10.0/gcore -I/Users/nsands/Documents/Nik/Development/gdal-1.10.0/alg -I/Users/nsands/Documents/Nik/Development/gdal-1.10.0/ogr -I/Users/nsands/Documents/Nik/Development/gdal-1.10.0/ogr/ogrsf_frmts -I/Users/nsands/Documents/Nik/Development/gdal-1.10.0/frmts -DOGR_ENABLED -I/Users/nsands/Documents/Nik/Development/gdal-1.10.0/port -c commonutils.cpp -o commonutils.o
> /bin/sh /Users/nsands/Documents/Nik/Development/gdal-1.10.0/libtool --mode=link	/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk gdalinfo.lo commonutils.lo  /Users/nsands/Documents/Nik/Development/gdal-1.10.0/libgdal.la -o gdalinfo
> libtool: link: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk gdalinfo.o commonutils.o -o gdalinfo  /Users/nsands/Documents/Nik/Development/gdal-1.10.0/.libs/libgdal.a -lsqlite3 -lz -lpthread -ldl -liconv -lxml2
> Undefined symbols for architecture armv7:
>  "_clock$UNIX2003", referenced from:
>      IVFKDataBlock::LoadGeometry()       in libgdal.a(vfkdatablock.o)
> ld: symbol(s) not found for architecture armv7
> collect2: ld returned 1 exit status
> make[1]: *** [gdalinfo] Error 1
> make: *** [apps-target] Error 2
> 
> 
> How can I get this resolved?
> 
> Cheers,
> Nik.
> 
> 
> On 12/08/2013, at 4:12 PM, Even Rouault <even.rouault at mines-paris.org> wrote:
> 
>> Le lundi 12 août 2013 02:17:33, Nik Sands a écrit :
>>> Hi list members,
>>> 
>>> I was able to build GDAL 1.9 for iOS, and I can build 1.10 for the iOS
>>> simulator, however I cannot compile GDAL 1.10 for the actual iOS
>>> (devices).  It appears that this is because crt_extern is not included in
>>> iOS.
>>> 
>>> The code that trips up the build is in 'cpl_spawn.cpp' and appears to be:
>>> 
>>> 	#ifdef __APPLE__
>>> 	#include <crt_externs.h>
>>> 
>>> The last few lines of the build output are below.
>>> 
>>> Is there some way that I can get GDAL 1.10 built for iOS?  I really need
>>> one of the changes that was included in this version.
>>> 
>>> Thanks in advance for any advice that you may be able to provide.
>> 
>> Nick,
>> 
>> Maybe you can try the patch at 
>> https://github.com/joyent/libuv/pull/321#issuecomment-4155600 that has very 
>> similar code that the one in GDAL and report if it works for you so it can get 
>> integrated ?
>> 
>> Even
>> 
>>> 
>>> Cheers,
>>> Nik.
>>> 
>>> 
>>> libtool: compile: 
>>> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Dev
>>> eloper/usr/bin/g++ -arch armv7 -pipe -Os -gdwarf-2 -isysroot
>>> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Dev
>>> eloper/SDKs/iPhoneOS6.1.sdk -mno-thumb -mthumb-interwork -Wall
>>> -DOGR_ENABLED -I/Users/nsands/Documents/Nik/Development/gdal-1.10.0/port
>>> -DHAVE_LIBZ -I/usr/include/libxml2 -DHAVE_LIBXML2 -c cpl_spawn.cpp -o
>>> cpl_spawn.o cpl_spawn.cpp:465:25: error: crt_externs.h: No such file or
>>> directory cpl_spawn.cpp: In function 'CPLSpawnedProcess* CPLSpawnAsync(int
>>> (*)(CPL_FILE_HANDLE, CPL_FILE_HANDLE), const char* const*, int, int, int,
>>> char**)': cpl_spawn.cpp:727: error: '_NSGetEnviron' was not declared in
>>> this scope make[1]: *** [cpl_spawn.lo] Error 1
>>> make: *** [port-target] Error 2
>>> _______________________________________________
>>> gdal-dev mailing list
>>> gdal-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>> 
>> -- 
>> Geospatial professional services
>> http://even.rouault.free.fr/services.html
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev



More information about the gdal-dev mailing list