Issue
I have generated Uclib using buildroot and used it to compile mpich for ARM devices.Then I created Android project and copied libmpich.a and the Include folder to the project here is the Android.mk:
LOCAL_PATH := $(call my-dir)
# static library info
LOCAL_MODULE_FILENAME:= libmpich
LOCAL_MODULE := libmpich
LOCAL_SRC_FILES := ../prebuilt/libmpich.a
LOCAL_EXPORT_C_INCLUDES := ../prebuilt/include
LOCAL_STATIC_LIBRARIES := libmpich
include $(PREBUILT_STATIC_LIBRARY)
# wrapper info
include $(CLEAR_VARS)
LOCAL_C_INCLUDES += ../prebuilt/include
LOCAL_MODULE := ndk1
LOCAL_SRC_FILES := native.c
LOCAL_STATIC_LIBRARIES := libmpich
include $(BUILD_SHARED_LIBRARY)
after ndk-build i got the following error
jni/../prebuilt/libmpich.a(initthread.o):initthread.c:function PMPI_Init_thread: error: undefined reference to 'MPL_env2bool'
jni/../prebuilt/libmpich.a(msgprint.o):msgprint.c:function MPIU_Usage_printf: error: undefined reference to 'stdout'
jni/../prebuilt/libmpich.a(msgprint.o):msgprint.c:function MPIU_Error_printf: error: undefined reference to 'stderr'
jni/../prebuilt/libmpich.a(msgprint.o):msgprint.c:function MPIU_Internal_error_printf: error: undefined reference to 'stderr'
jni/../prebuilt/libmpich.a(msgprint.o):msgprint.c:function MPIU_Internal_sys_error_printf: error: undefined reference to 'stderr'
jni/../prebuilt/libmpich.a(msgprint.o):msgprint.c:function MPIU_Msg_printf: error: undefined reference to 'stdout'
jni/../prebuilt/libmpich.a(dbg_printf.o):dbg_printf.c:function MPIU_dbg_printf: error: undefined reference to 'stdout'
jni/../prebuilt/libmpich.a(dbg_printf.o):dbg_printf.c:function MPIU_dump_dbg_memlog_to_stdout: error: undefined reference to 'stdout'
jni/../prebuilt/libmpich.a(param_vals.o):param_vals.c:function MPIR_Param_init_params: error: undefined reference to 'MPL_env2int'
jni/../prebuilt/libmpich.a(param_vals.o):param_vals.c:function MPIR_Param_init_params: error: undefined reference to 'MPL_env2int'
jni/../prebuilt/libmpich.a(param_vals.o):param_vals.c:function MPIR_Param_init_params: error: undefined reference to 'MPL_env2int'
jni/../prebuilt/libmpich.a(param_vals.o):param_vals.c:function MPIR_Param_init_params: error: undefined reference to 'MPL_env2int'
jni/../prebuilt/libmpich.a(param_vals.o):param_vals.c:function MPIR_Param_init_params: error: undefined reference to 'MPL_env2bool'
jni/../prebuilt/libmpich.a(param_vals.o):param_vals.c:function MPIR_Param_init_params: error: undefined reference to 'MPL_env2bool'
jni/../prebuilt/libmpich.a(param_vals.o):param_vals.c:function MPIR_Param_init_params: error: undefined reference to 'MPL_env2bool'
jni/../prebuilt/libmpich.a(param_vals.o):param_vals.c:function MPIR_Param_init_params: error: undefined reference to 'MPL_env2str'
jni/../prebuilt/libmpich.a(param_vals.o):param_vals.c:function MPIR_Param_init_params: error: undefined reference to 'MPL_env2str'
jni/../prebuilt/libmpich.a(mpid_abort.o):mpid_abort.c:function MPID_Abort: error: undefined reference to 'stderr'
jni/../prebuilt/libmpich.a(mpid_vc.o):mpid_vc.c:function MPIDI_Populate_vc_node_ids: error: undefined reference to '__errno_location'
jni/../prebuilt/libmpich.a(mpid_vc.o):mpid_vc.c:function MPIDI_Populate_vc_node_ids: error: undefined reference to '__ctype_b'
jni/../prebuilt/libmpich.a(init.o):init.c:function PMPI_Init: error: undefined reference to 'MPL_env2str'
jni/../prebuilt/libmpich.a(strerror.o):strerror.c:function MPIU_Strerror: error: undefined reference to '__xpg_strerror_r'
jni/../prebuilt/libmpich.a(simple_pmi.o):simple_pmi.c:function accept_one_connection: error: undefined reference to '__errno_location'
jni/../prebuilt/libmpich.a(simple_pmi.o):simple_pmi.c:function PMI_Init: error: undefined reference to '__errno_location'
jni/../prebuilt/libmpich.a(sock.o):sock.c:function MPIDU_Socki_event_enqueue.isra.1: error: undefined reference to '__errno_location'
jni/../prebuilt/libmpich.a(sock.o):sock.c:function MPIDU_Sock_listen: error: undefined reference to 'MPL_env2range'
collect2: error: ld returned 1 exit status
make: *** [obj/local/armeabi/libndk1.so] Error 1
I don't understand why it is not linking correctly and what is missing
Update : when I add libmpl.a to the project all MPL errors disappeared
Solution
I think your problem occured because your static lib libmpich.a has dependance on another lib.
You have two diffenrent way to solve this issue :
Import any library needed by your
libmpich.aas static library in yourAndroid.mkas static library. The problem of this approach is that can be very long and painful if you have a lot dependance.Build
libmpichas a dynamic library, as dynamic library are package with their dependance. I do know how you build youlibmpichlibrary so i don't know if this will be hard to achieve. Once you havelibmpich.soimport it in yourAndroid.mkas a dynamic library instead of a static one.
Answered By - sonic
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.