Harshawardhan
Harshawardhan

Reputation: 1521

Build Error with ndk jni for curl

I am stuck at compilation of curl with the error:

$ndk-build
Android NDK: Building for application 'curl' 
Android NDK: Trying to define local module 'curl' in sources/curl//jni/Android.mk. 
Android NDK: But this module was already defined by sources/curl//jni/Android.mk. 
build/core/build-module.mk:34: *** Android NDK: Aborting. . Stop.

Can anyone provide the procedure you used to compile the dependencies?

Upvotes: 7

Views: 4808

Answers (3)

CrisJiang
CrisJiang

Reputation: 1

I faced the same problem because I used wrong command.

in Android.mk dir, I used "ndk-build -f Android.mk",this was causing the problem
Android NDK: Trying to define local module 'SRC' in Android.mk.
Android NDK: But this module was already defined by ...

but when I input "ndk-build",build succeeded!

Upvotes: 0

sashoalm
sashoalm

Reputation: 79635

In my case, I was adding a shared library that needed gnustl_shared, so I added it to my Android.mk file:

include $(CLEAR_VARS)
LOCAL_MODULE := libgnustl_shared
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_STATIC_LIBRARY)
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../native_libs/$(TARGET_ARCH)/libgnustl_shared.so
include $(PREBUILT_SHARED_LIBRARY)

The conflict I got was this:

Android NDK: Trying to define local module 'gnustl_shared' in jni/Android.mk.
Android NDK: But this module was already defined by c:/android-ndk-r10d/sources/cxx-stl/gnu-libstdc++/Android.mk.

The reason was because I was already using it as a static library. This was in Application.mk:

APP_STL := gnustl_static

The solution was to change it to APP_STL := gnustl_shared, and then to remove the LOCAL_MODULE := libgnustl_shared section from Android.mk.

Upvotes: 0

Pooks
Pooks

Reputation: 2585

I had a similar error when trying to include a precompiled static library into a NDK project. I fixed it by editing my project's Android.mk file to move the line $(call import-module,<MY_MODULE_NAME>) to the very end of the file (after include $(BUILD_SHARED_LIBRARY)).

Upvotes: 1

Related Questions