【问题标题】:Spatialite for Android NDK BuildSpatialite for Android NDK 构建
【发布时间】:2012-06-26 11:10:35
【问题描述】:

我在构建现有项目时遇到了一点麻烦:

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

我正在使用 Win7 和 Cygwin

我通过使用“GIT for Windows”进行克隆来获取源代码。将其放入:C:\temp\ECLIPSE\workspace\SA1

我下载以下内容:

我将它们放在:C:\temp\ECLIPSE\workspace\SA1\spatialite-android-library\jni

然后我启动 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

在 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

保存并关闭

然后我回到 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

与 Compile++ 行一起编译以下代码

StaticLibrary  : libiconv.a
StaticLibrary  : libproj.a

但是,当它通过 geos 时,会出现以下错误:

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
$

有人可以帮助我解决这个问题吗?非常感谢任何帮助!

【问题讨论】:

    标签: android android-ndk cygwin spatialite geos


    【解决方案1】:

    可以通过缩短 ndk 和 spatialite-android 文件夹的路径来解决此问题。

    我将 ndk 移至 c:\cygwin 文件夹并将其从 android-ndk-r8b 重命名为 ndk。 同样,我将 android-spatialite 文件夹移至 c:\cygwin 并将其重命名为 sla

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

    它编译:)

    【讨论】:

      【解决方案2】:

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

      LOCAL_SHORT_COMMANDS := true
      

      【讨论】:

        【解决方案3】:

        这似乎是 NDK 的问题。当提供的参数列表太长时会发生此错误。通常这可以使用选项文件来解决。 arm-linux-androideabi-ar 见@参数。

        在互联网上搜索该问题似乎已报告给 Google。我能提供的唯一解决方法是使用 Ubuntu VM 编译本机代码。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2011-05-18
          • 2018-01-16
          相关资源
          最近更新 更多