Search code examples
androidandroid-ndkcygwinspatialitegeos

Spatialite for Android NDK Build


I am having a little trouble with build an existing project at:

http://code.google.com/p/spatialite-android/

I am using Win7 and Cygwin

I get the source code by cloning using "GIT for Windows". Placing it into: C:\temp\ECLIPSE\workspace\SA1

I download the following:

I place these in: C:\temp\ECLIPSE\workspace\SA1\spatialite-android-library\jni

I then start Cygwin and do the following:

$ cd c:/temp/eclipse/workspace/sa1/spatialite-android-library/jni
$ tar xvjf geos-3.2.2.tar.bz2
$ cd geos-3.2.2
$ ./configure --build=x86_64-pc-linux-gnu --host=arm-linux-eabi

Outside of Cygwin, I open in an editor: C:\temp\ECLIPSE\workspace\SA1\spatialite-android-library\jni\geos-3.2.2\source\headers\geos\platform.h and make couple of changes so it resembles below

/* Set to 1 if you have `int64_t' type */
/* #undef HAVE_INT64_T_64 */

/* Set to 1 if `long int' is 64 bits */
/* #undef HAVE_LONG_INT_64 */

/* Set to 1 if `long long int' is 64 bits */
/* #undef HAVE_LONG_LONG_INT_64 */

/* Set to 1 if you have ieeefp.h */
/* #undef HAVE_IEEEFP_H */

/* Has finite */
#define HAVE_FINITE 1

/* Has isfinite */
/* #undef HAVE_ISFINITE */

/* Has isnan */
#define HAVE_ISNAN 1

Save and close

I then go back to Cygwin and do the following:

$ cd ..
$ tar xvzf proj-4.7.0.tar.gz
$ cd proj-4.7.0
$ ./configure --build=x86_64-pc-linux-gnu --host=arm-linux-eabi
$ cd ..
$ /cygdrive/c/android-ndk-r8/ndk-build

Along with the Compile++ lines the following compiles

StaticLibrary  : libiconv.a
StaticLibrary  : libproj.a

However while it's going through geos it comes up with the following error:

Compile++ thumb  : geos <= TaggedLineSegment.cpp
Compile++ thumb  : geos <= TaggedLinesSimplifier.cpp
Compile++ thumb  : geos <= TaggedLineString.cpp
Compile++ thumb  : geos <= TaggedLineStringSimplifier.cpp
Compile++ thumb  : geos <= TopologyPreservingSimplifier.cpp
Compile++ thumb  : geos <= Assert.cpp
Compile++ thumb  : geos <= GeometricShapeFactory.cpp
Compile++ thumb  : geos <= math.cpp
Compile++ thumb  : geos <= Profiler.cpp
Prebuilt       : libgnustl_static.a <= <NDK>/sources/cxx-stl/gnu-libstdc++/libs/armeabi/
StaticLibrary  : libgeos.a
make: execvp: /cygdrive/c/android-ndk-r8/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-ar: Argument list too long
make: *** [/cygdrive/c/temp/eclipse/workspace/sa1/spatialite-android-library/obj/local/armeabi/libgeos.a] Error 127
HFisher@Toshiba500 /cygdrive/c/temp/eclipse/workspace/sa1/spatialite-android-library/jni
$

Can someone help with how I can fix this? Any help greatly appreciated!


Solution

  • This appears to be an issue with the NDK. This error occurs when the argument list provided is too long. Usually this can be fixed using a options file. See @ parameter for arm-linux-androideabi-ar.

    Searching the internet it appears this issue has bee reported to Google. The only workaround I can offer is to use a Ubuntu VM to compile the native code.