Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mrenouf opened this issue Mar 14, 2011 · 8 comments
Open

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

mrenouf opened this issue Mar 14, 2011 · 8 comments

Comments

@mrenouf
Copy link
Owner

mrenouf commented Mar 14, 2011

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).

@iandees
Copy link
Contributor

iandees commented Mar 15, 2011

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 Android.mk file. Here's what my makefile looked like:

LOCAL_PATH:= $(call my-dir)

include $(CLEAR_VARS)

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

LOCAL_SRC_FILES := \
        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 \
        source/util/math.cpp

include $(BUILD_SHARED_LIBRARY)

@mbernasocchi
Copy link

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

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

Thanks a lot
Marco

@iandees
Copy link
Contributor

iandees commented Jun 9, 2011

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

@mbernasocchi
Copy link

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

@iandees
Copy link
Contributor

iandees commented Jun 9, 2011

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.

@mrenouf
Copy link
Owner Author

mrenouf commented Jun 9, 2011

Did we ever get this all to work reliably?

The project I initially wanted this for has come and gone, and I ended
up building a simple K-d tree which can do what I needed quickly,
finding nearest n-neighbors.

On Thu, Jun 9, 2011 at 7:29 AM, iandees
reply@reply.github.com
wrote:

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.

Reply to this email directly or view it on GitHub:
#1 (comment)

@iandees
Copy link
Contributor

iandees commented Jun 9, 2011

Yea, we're actually using it in a yet-to-be-released product. There are some
big performance problems, but we haven't spent any time looking into what
the problem is.

Depending on the timing we might end up switching to a K-D tree as well...

On Thu, Jun 9, 2011 at 7:57 AM, mrenouf <
reply@reply.github.com>wrote:

Did we ever get this all to work reliably?

The project I initially wanted this for has come and gone, and I ended
up building a simple K-d tree which can do what I needed quickly,
finding nearest n-neighbors.

On Thu, Jun 9, 2011 at 7:29 AM, iandees
reply@reply.github.com
wrote:

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.

Reply to this email directly or view it on GitHub:
#1 (comment)

Reply to this email directly or view it on GitHub:
#1 (comment)

@mbernasocchi
Copy link

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants