简体   繁体   English

适用于Android NDK Build的Spatialite

[英]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 我正在使用Win7和Cygwin

I get the source code by cloning using "GIT for Windows". 我通过使用“GIT for Windows”进行克隆来获取源代码。 Placing it into: C:\\temp\\ECLIPSE\\workspace\\SA1 将其放入:C:\\ temp \\ ECLIPSE \\ workspace \\ SA1

I download the following: 我下载以下内容:

I place these in: C:\\temp\\ECLIPSE\\workspace\\SA1\\spatialite-android-library\\jni 我将它们放在:C:\\ temp \\ ECLIPSE \\ workspace \\ SA1 \\ spatialite-android-library \\ jni中

I then start Cygwin and do the following: 然后我启动Cygwin并执行以下操作:

$ 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 在Cygwin之外,我在编辑器中打开:C:\\ temp \\ ECLIPSE \\ workspace \\ SA1 \\ spatialite-android-library \\ jni \\ geos-3.2.2 \\ source \\ headers \\ geos \\ platform.h并进行一些更改以便它类似于下面

/* 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: 然后我回到Cygwin并做以下事情:

$ 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 与Compile ++行一起编译以下内容

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! 任何帮助非常感谢!

The issue can be solved by making the path to the ndk and the spatialite-android folder shorter. 可以通过使ndk和spatialite-android文件夹的路径更短来解决该问题。

I moved the ndk to the c:\\cygwin folder and renamed it from android-ndk-r8b to ndk. 我将ndk移动到c:\\ cygwin文件夹,并将其从android-ndk-r8b重命名为ndk。 Likewise I moved the android-spatialite folder to c:\\cygwin and renamed it to sla 同样,我将android-spatialite文件夹移动到c:\\ cygwin并将其重命名为sla

Then cd into /sla/spatialite-android-library/jni folder and run /ndk/ndk-build -j8 然后cd进入/ sla / spatialite-android-library / jni文件夹并运行/ ndk / ndk-build -j8

And it compiles :) 它编译:)

尝试将以下内容添加到makefile中。

LOCAL_SHORT_COMMANDS := true

This appears to be an issue with the NDK. 这似乎是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. 请参阅arm-linux-androideabi-ar的@参数。

Searching the internet it appears this issue has bee reported to Google. 在互联网上搜索此问题似乎已向Google报告。 The only workaround I can offer is to use a Ubuntu VM to compile the native code. 我能提供的唯一解决方法是使用Ubuntu VM来编译本机代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM