Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Figure out how to build Geos on NDK. (C++/STL support) #1

mrenouf opened this Issue · 8 comments

3 participants


Geos is not supported because the Android NDK apparently lacks the most basic of C++ library support (no STL!). Right now it fails with missing headers for most of the stuff in /usr/include/c++. So right now, I've removed it from the build (-DOMIT_GEOS=1).


When I was poking around with it this past weekend I was able to get GEOS to compile by specifying some C++-specific stuff in the file. Here's what my makefile looked like:

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE    := libgeos
        $(LOCAL_PATH)/include \
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -ldl
LOCAL_STL                 := gnustl_static
LOCAL_CPPFLAGS            += -fexceptions
LOCAL_CPPFLAGS            += -frtti

        source/inlines.cpp \
        source/operation/buffer/SubgraphDepthLocater.cpp \
        source/operation/buffer/RightmostEdgeFinder.cpp \
        source/operation/buffer/BufferSubgraph.cpp \
        source/operation/buffer/OffsetCurveSetBuilder.cpp \
        source/util/GeometricShapeFactory.cpp \


Hi iandees, I'm new at all this, I'm trying to crosscompile geos to Android, I've two questions, is the make file read automatically when building or how do I use it? as well what are the ... for?
I use this to compile:

#SET compile flags
CXX=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-g++ \
CXXFLAGS="-nostdlib -I$NDK_PLATFORM/usr/include -I$NDK/sources/cxx-stl/gnu-libstdc++/include -I$NDK/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include -DHAVE_ISNAN" \
CC=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc \
CFLAGS="  -nostdlib -I$NDK_PLATFORM/usr/include -I$NDK/sources/cxx-stl/gnu-libstdc++/include -I$NDK/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include" \
LDFLAGS="-L$NDK/sources/cxx-stl/gnu-libstdc++/libs/armeabi -L$NDK_PLATFORM/usr/lib --sysroot=$NDK_PLATFORM -Wl,-rpath-link=$NDK_PLATFORM/usr/lib -lc" \
./configure --prefix=$INSTALL_DIR --host=arm-linux-androideabi

make -j$CORES 2>&1 | tee make.out

Thanks a lot


The .... is me cutting out the listing of all the cpp files in the GEOS distribution.


I immagined that. the other issue was the more important one ;)


You don't run Make when building NDK projects. Read the readme for the project or the NDK docs.

Basically, you run ndk_build in the parent directory.


Hi, i compiled geos using the standalone toolchain of r5c with less issues than using mk files. Thanks for the hints anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.