ndk-build casue error: LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)
<p>I am doing cross compiling. I am trying to ndk-build my code, and it cause error <strong>LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)</strong> when I include <strong>Python.h</strong></p>

<p>I found some similar cases on the Internet, but the problem still cannot be fixed. is it the problem from virtualenv? It has installed something about gcc. So, would anyone suggest a way to fix this problem?</p>

<p>I am using 64-bit python 2.7. The Python.h comes from Kivy's python-for-android project.</p>

<p><strong>Error:</strong></p>

<pre><code>kivy@kivy-VirtualBox:~/AndroidStudioProjects/Pytest/python-for-android/dist/default/libs/armeabi$ /home/kivy/Android/Sdk/ndk-bundle/ndk-build NDK_PROJECT_PATH=/home/kivy/AndroidStudioProjects/Pytest APP_BUILD_SCRIPT=/home/kivy/AndroidStudioProjects/Pytest/app/src/main/jni/android.mk

[arm64-v8a] Compile        : pyjni &lt;= pyjni.c
In file included from /home/kivy/AndroidStudioProjects/Pytest/app/src/main/jni/../..
/../../python-for-android/dist/default/python-install/include/python2.7/Python.h:58:0,

from /home/kivy/AndroidStudioProjects/Pytest/app/src/main/jni/pyjni.c:1:
/home/kivy/AndroidStudioProjects/Pytest/app/src/main/jni/../../.
./../python-for-android/dist/default/python-install/include/python2.7/pyport.h:849:2: 

error: 
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?).

"
#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
^
make: *** [/home/kivy/AndroidStudioProjects/Pytest/obj/local/arm64-v8a/objs/pyjni/pyjni.o] Error 1
</code></pre>

<p><strong>android.mk</strong></p>

<pre><code>LOCAL_PATH := $(call my-dir)

#square
include $(CLEAR_VARS)

LOCAL_MODULE    := square
LOCAL_SRC_FILES := square.c

include $(BUILD_SHARED_LIBRARY)

# Build libpyjni.so
include $(CLEAR_VARS)
LOCAL_MODULE    := pyjni
LOCAL_SRC_FILES := pyjni.c
LOCAL_CFLAGS := -I $(LOCAL_PATH)/../../../../python-for-android/dist/default/python-install/include/python2.7/
LOCAL_LDFLAGS += -L $(LOCAL_PATH)/../../../../python-for-android/dist/default/libs/armeabi/
LOCAL_SHARED_LIBRARIES += python2.7  # This line links to libpython2.7
LOCAL_LDLIBS += -llog                # This line links to the Android log
include $(BUILD_SHARED_LIBRARY)

# Include libpython2.7.so
include $(CLEAR_VARS)
LOCAL_MODULE := python2.7
LOCAL_SRC_FILES := ../../../../python-for-android/dist/default/libs/armeabi/libpython2.7.so
include $(PREBUILT_SHARED_LIBRARY)
</code></pre>