ndk-build compilation error in box2d code

Create issue
Issue #95 resolved
Carlo Cabanilla created an issue

Using ndk r10d on OSX 10.10.1.

$ ndk-build
Android NDK: WARNING: APP_PLATFORM android-19 is larger than android:minSdkVersion 10 in ./AndroidManifest.xml
[armeabi] Compile++ thumb: love <= b2ContactManager.cpp
/*
In file included from jni/love/src/libraries/Box2D/Collision/b2DynamicTree.h:23:0,
                 from jni/love/src/libraries/Box2D/Collision/b2BroadPhase.h:24,
                 from jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.h:22,
                 from jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.cpp:19:
jni/love/src/libraries/Box2D/Common/b2GrowableStack.h: In instantiation of 'void b2GrowableStack<T, N>::Push(const T&) [with T = int; int N = 256]':
jni/love/src/libraries/Box2D/Collision/b2DynamicTree.h:172:19:   required from 'void b2DynamicTree::Query(T*, const b2AABB&) const [with T = b2BroadPhase]'
jni/love/src/libraries/Box2D/Collision/b2BroadPhase.h:204:29:   required from 'void b2BroadPhase::UpdatePairs(T*) [with T = b2ContactManager]'
jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.cpp:174:31:   required from here
jni/love/src/libraries/Box2D/Common/b2GrowableStack.h:54:44: error: 'memcpy' was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
    memcpy(m_stack, old, m_count * sizeof(T));
                                            ^
In file included from /usr/local/android/android-ndk-r10d/platforms/android-19/arch-arm/usr/include/stdlib.h:40:0,
                 from /usr/local/android/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.8/include/cstdlib:72,
                 from /usr/local/android/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.8/include/bits/stl_algo.h:59,
                 from /usr/local/android/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/4.8/include/algorithm:62,
                 from jni/love/src/libraries/Box2D/Collision/b2BroadPhase.h:25,
                 from jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.h:22,
                 from jni/love/src/libraries/Box2D/Dynamics/b2ContactManager.cpp:19:
/usr/local/android/android-ndk-r10d/platforms/android-19/arch-arm/usr/include/string.h:41:15: note: 'void* memcpy(void*, const void*, size_t)' declared here, later in the translation unit
 extern void*  memcpy(void *, const void *, size_t);
               ^
make: *** [obj/local/armeabi/objs/love/src/libraries/Box2D/Dynamics/b2ContactManager.o] Error 1

Workaround is to apply this patch: https://code.google.com/p/box2d/issues/detail?id=334

Comments (3)

  1. Log in to comment