当前位置: 首页 > 知识库问答 >
问题:

使用Android NDK构建共享库-未定义的引用

戚京
2023-03-14

我正在尝试建立一个共享库,可以用来访问本机蓝牙API函数。我目前正试图编译一个c文件:https://android.googlesource.com/platform/external/bluetooth/bluedroid/

每当我尝试将这些代码中的任何一个编译为共享库时,我都会收到许多未定义的引用错误...它看起来像是头文件引用的每个函数。在我最近的尝试中,我将整个Bluedroid/bta文件复制到我的eclipse project/jni文件夹中。使用包含的Android.mk,只需最少的修改,我就可以编译为静态库。但是,如果我将行更改为:
include$(BUILD_STATIC_LIBRARY)
to
include$(BUILD_SHARED_LIBRARY)

我犯了很多错误。我该如何构建共享图书馆?

这是我的Android。mk:

LOCAL_PATH:= $(call my-dir)
BLUEDROID_DIR := /cygdrive/bluedroid/
include $(CLEAR_VARS)
LOCAL_CFLAGS += \
    -DBOARD_HAVE_BLUETOOTH_BCM
LOCAL_CFLAGS += -DBUILDCFG $(bdroid_CFLAGS)

LOCAL_PRELINK_MODULE:=false 
LOCAL_SRC_FILES:= \
    ./dm/bta_dm_ci.c \
    ./dm/bta_dm_act.c \
    ./dm/bta_dm_pm.c \
    ./dm/bta_dm_main.c \
    ./dm/bta_dm_cfg.c \
    ./dm/bta_dm_api.c \
    ./dm/bta_dm_sco.c \
    ./gatt/bta_gattc_api.c \
    ./gatt/bta_gatts_act.c \
    ./gatt/bta_gatts_main.c \
    ./gatt/bta_gattc_utils.c \
    ./gatt/bta_gattc_ci.c \
    ./gatt/bta_gatts_api.c \
    ./gatt/bta_gattc_main.c \
    ./gatt/bta_gattc_act.c \
    ./gatt/bta_gattc_cache.c \
    ./gatt/bta_gatts_utils.c \
    ./ag/bta_ag_sdp.c \
    ./ag/bta_ag_sco.c \
    ./ag/bta_ag_cfg.c \
    ./ag/bta_ag_main.c \
    ./ag/bta_ag_api.c \
    ./ag/bta_ag_rfc.c \
    ./ag/bta_ag_act.c \
    ./ag/bta_ag_cmd.c \
    ./ag/bta_ag_ci.c \
    ./ag/bta_ag_at.c \
    ./hh/bta_hh_cfg.c \
    ./hh/bta_hh_act.c \
    ./hh/bta_hh_api.c \
    ./hh/bta_hh_le.c \
    ./hh/bta_hh_utils.c \
    ./hh/bta_hh_main.c \
    ./pb/bta_pbs_cfg.c \
    ./fs/bta_fs_ci.c \
    ./fs/bta_fs_cfg.c \
    ./pan/bta_pan_main.c \
    ./pan/bta_pan_ci.c \
    ./pan/bta_pan_act.c \
    ./pan/bta_pan_api.c \
    ./av/bta_av_act.c \
    ./av/bta_av_ci.c \
   ./av/bta_av_api.c \
    ./av/bta_av_aact.c \
    ./av/bta_av_main.c \
    ./av/bta_av_cfg.c \
    ./av/bta_av_ssm.c \
    ./av/bta_av_sbc.c \
    ./ar/bta_ar.c \
./hl/bta_hl_act.c \
./hl/bta_hl_api.c \
./hl/bta_hl_main.c \
./hl/bta_hl_utils.c \
./hl/bta_hl_sdp.c \
./hl/bta_hl_ci.c \
./sys/bta_sys_main.c \
./sys/bta_sys_ci.c \
./sys/bta_sys_conn.c \
./sys/bta_sys_cfg.c \
./sys/ptim.c \
./sys/bd.c \
./sys/utl.c \
./jv/bta_jv_act.c \
./jv/bta_jv_cfg.c \
./jv/bta_jv_main.c \
./jv/bta_jv_api.c

LOCAL_MODULE := libbt-brcm_bta
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_TAGS := optional
LOCAL_SHARED_LIBRARIES := libcutils libc

LOCAL_C_INCLUDES+= . \
               $(LOCAL_PATH)/include \
               $(LOCAL_PATH)/sys \
               $(LOCAL_PATH)/dm \
               $(LOCAL_PATH)/hh \
              $(BLUEDROID_DIR)/gki/common \
              $(BLUEDROID_DIR)/gki/ulinux \
              $(BLUEDROID_DIR)/include \
              $(BLUEDROID_DIR)/stack/include \
              $(BLUEDROID_DIR)/stack/btm \
              $(BLUEDROID_DIR)/hcis \
              $(BLUEDROID_DIR)/hcis/patchram \
              $(BLUEDROID_DIR)/udrv/include \
              $(BLUEDROID_DIR)/brcm/include \
               $(bdroid_C_INCLUDES) \

include $(BUILD_SHARED_LIBRARY)

以下是一些输出(不能全部满足):

[armeabi] SharedLibrary  : libbt-brcm_bta.so
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_ci.o: in function bta_dm_ci_io_req:jni/./dm/bta_dm_ci.c:52: error: undefined reference to 'GKI_getbuf'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_ci.o: in function bta_dm_ci_rmt_oob:jni/./dm/bta_dm_ci.c:78: error: undefined reference to 'GKI_getbuf'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_observe_cmpl_cb:jni/./dm/bta_dm_act.c:4619: error: undefined reference to 'LogMsg_0'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_encrypt_cback:jni/./dm/bta_dm_act.c:4489: error: undefined reference to 'LogMsg_2'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_new_link_key_cback:jni/./dm/bta_dm_act.c:2916: error: undefined reference to 'LogMsg_0'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_remove_sec_dev_entry:jni/./dm/bta_dm_act.c:3750: error: undefined reference to 'BTM_IsAclConnectionUp'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_remove_sec_dev_entry:jni/./dm/bta_dm_act.c:3752: error: undefined reference to 'LogMsg_1'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_remove_sec_dev_entry:jni/./dm/bta_dm_act.c:3765: error: undefined reference to 'LogMsg_1'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_remove_sec_dev_entry:jni/./dm/bta_dm_act.c:3770: error: undefined reference to 'BTM_SecDeleteDevice'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_pin_cback:jni/./dm/bta_dm_act.c:2832: error: undefined reference to 'BTM_ReadRemoteDeviceName'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_pin_cback:jni/./dm/bta_dm_act.c:2835: error: undefined reference to 'LogMsg_0'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:2977: error: undefined reference to 'LogMsg_1'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:2987: error: undefined reference to 'bta_dm_co_io_req'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:2994: error: undefined reference to 'LogMsg_2'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:2998: error: undefined reference to 'bta_dm_co_io_rsp'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:3024: error: undefined reference to 'BTM_ReadRemoteDeviceName'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:3027: error: undefined reference to 'LogMsg_0'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:3040: error: undefined reference to 'bta_dm_co_loc_oob'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:3051: error: undefined reference to 'BTM_ReadRemoteDeviceName'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:3063: error: undefined reference to 'bta_dm_co_rmt_oob'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:3076: error: undefined reference to 'bta_dm_co_lk_upgrade'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sp_cback:jni/./dm/bta_dm_act.c:3083: error: undefined reference to 'LogMsg_1'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_sdp_callback:jni/./dm/bta_dm_act.c:2503: error: undefined reference to 'GKI_getbuf'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_bl_change_cback:jni/./dm/bta_dm_act.c:3189: error: undefined reference to 'GKI_getbuf'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_observe_results_cb:jni/./dm/bta_dm_act.c:4587: error: undefined reference to 'BTM_InqDbRead'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_inq_results_cb:jni/./dm/bta_dm_act.c:2544: error: undefined reference to 'BTM_InqDbRead'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_set_eir:jni/./dm/bta_dm_act.c:4044: error: undefined reference to 'BTM_ReadLocalDeviceName'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_set_eir:jni/./dm/bta_dm_act.c:4052: error: undefined reference to 'GKI_getpoolbuf'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_set_eir:jni/./dm/bta_dm_act.c:4078: error: undefined reference to 'BTM_GetEirSupportedServices'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_set_eir:jni/./dm/bta_dm_act.c:4140: error: undefined reference to 'BTM_GetEirSupportedServices'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_set_eir:jni/./dm/bta_dm_act.c:4289: error: undefined reference to 'BTM_WriteEIR'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_policy_cback:jni/./dm/bta_dm_act.c:983: error: undefined reference to 'LogMsg_2'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_policy_cback:jni/./dm/bta_dm_act.c:992: error: undefined reference to 'BTM_SetLinkPolicy'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_policy_cback:jni/./dm/bta_dm_act.c:1000: error: undefined reference to 'BTM_SetLinkPolicy'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_policy_cback:jni/./dm/bta_dm_act.c:1024: error: undefined reference to 'BTM_SetDefaultLinkPolicy'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_check_av:jni/./dm/bta_dm_act.c:3313: error: undefined reference to 'LogMsg_4'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_check_av:jni/./dm/bta_dm_act.c:3319: error: undefined reference to 'BTM_SwitchRole'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_remname_cback:jni/./dm/bta_dm_act.c:2660: error: undefined reference to 'LogMsg_2'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./dm/bta_dm_act.o: in function bta_dm_remname_cback:jni/./dm/bta_dm_act.c:2668: error: undefined reference to 'BTM_SecDeleteRmtNameNotifyCallback'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x8
....
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_connect:jni/./jv/bta_jv_act.c:2114: error: undefined reference to 'PORT_SetEventMask'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_connect:jni/./jv/bta_jv_act.c:2115: error: undefined reference to 'PORT_SetDataCOCallback'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_connect:jni/./jv/bta_jv_act.c:2117: error: undefined reference to 'PORT_GetState'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_connect:jni/./jv/bta_jv_act.c:2123: error: undefined reference to 'PORT_SetState'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_connect:jni/./jv/bta_jv_act.c:2139: error: undefined reference to 'RFCOMM_RemoveConnection'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_start_server:jni/./jv/bta_jv_act.c:2463: error: undefined reference to 'BTM_SetSecurityLevel'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_start_server:jni/./jv/bta_jv_act.c:2496: error: undefined reference to 'PORT_ClearKeepHandleFlag'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_start_server:jni/./jv/bta_jv_act.c:2497: error: undefined reference to 'PORT_SetEventCallback'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_start_server:jni/./jv/bta_jv_act.c:2498: error: undefined reference to 'PORT_SetEventMask'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_start_server:jni/./jv/bta_jv_act.c:2499: error: undefined reference to 'PORT_GetState'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_start_server:jni/./jv/bta_jv_act.c:2505: error: undefined reference to 'PORT_SetState'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_start_server:jni/./jv/bta_jv_act.c:2510: error: undefined reference to 'PORT_SetDataCOCallback'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_start_server:jni/./jv/bta_jv_act.c:2517: error: undefined reference to 'RFCOMM_RemoveConnection'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_read:jni/./jv/bta_jv_act.c:2572: error: undefined reference to 'PORT_ReadData'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_rfcomm_write:jni/./jv/bta_jv_act.c:2604: error: undefined reference to 'PORT_WriteDataCO'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_set_pm_profile:jni/./jv/bta_jv_act.c:534: error: undefined reference to 'PORT_CheckConnection'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_act.o: in function bta_jv_set_pm_profile:jni/./jv/bta_jv_act.c:549: error: undefined reference to 'GAP_ConnGetRemoteAddr'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_api.o: in function BTA_JvGetDiscoverability:jni/./jv/bta_jv_api.c:176: error: undefined reference to 'BTM_ReadDiscoverability'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_api.o: in function BTA_JvGetPreknownDevice:jni/./jv/bta_jv_api.c:284: error: undefined reference to 'BTM_InqFirstResult'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_api.o: in function BTA_JvGetPreknownDevice:jni/./jv/bta_jv_api.c:306: error: undefined reference to 'BTM_InqNextResult'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_api.o: in function BTA_JvGetDeviceClass:jni/./jv/bta_jv_api.c:351: error: undefined reference to 'BTM_ReadDeviceClass'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_api.o: in function BTA_JvIsAuthenticated:jni/./jv/bta_jv_api.c:426: error: undefined reference to 'BTM_GetSecurityFlags'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_api.o: in function BTA_JvGetSecurityMode:jni/./jv/bta_jv_api.c:519: error: undefined reference to 'BTM_GetSecurityMode'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_api.o: in function BTA_JvReadRecord:jni/./jv/bta_jv_api.c:991: error: undefined reference to 'SDP_ReadRecord'
C:/android-ndk-r9c/toolchains/arm-linux-androideabi-4.6/prebuilt/windows-x86_64/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld.exe: ./obj/local/armeabi/objs/bt-brcm_bta/./jv/bta_jv_api.o: in function BTA_JvRfcommReady:jni/./jv/bta_jv_api.c:1551: error: undefined reference to 'PORT_GetRxQueueCnt'
collect2: ld returned 1 exit status
/cygdrive/c/android-ndk-r9c/build/core/build-binary.mk:579: recipe for target 'obj/local/armeabi/libbt-brcm_bta.so' failed
make: *** [obj/local/armeabi/libbt-brcm_bta.so] Error 1

共有2个答案

刘令
2023-03-14

在Android中。mksetlocal\u allow\u undefined\u符号:=true。

汪坚
2023-03-14

NDK不使用cygwin,无法识别cygdrive路径;将其更改为c:/adev/bluedroid或类似。

 类似资料:
  • 问题内容: 两个共享库liba.so和libb.so。liba.so使用libb.so。所有c文件都使用-fPIC编译。链接使用- shared。当我们在liba.so上调用dlopen时,它无法在libb.so中找到符号…我们得到“未定义符号”错误。我们可以dlopen libb.so没有错误。我们知道liba正在找到libb,因为我们没有得到文件未找到错误。删除libb.so时,出现文件未找到

  • 问题内容: 我正在制作一个C ++共享库,当我编译使用该库的主exe时,编译器会给出以下信息: 库代码: fooclass.h fooclass.cpp 编译: 主要:main.cpp 编译: 该机器是Ubuntu Linux 12 谢谢! 问题答案: 是问题。最新版本的GCC要求您按照相互依赖的顺序放置目标文件和库-因此,根据经验法则,必须将库标志作为链接器的最后一个开关;即写 代替。

  • 15.3.5.构建共享库 假定你已经安装好了NDK,解下来就可以构建共享库了:切换到项目目录,执行ndk/ndk-build即可。其中ndk表示你的NDK安装目录。 构建完成之后,你可以见到一个新的子目录lib,里面放有刚刚生成的共享库文件。 Note: 共享库默认是面向ARM平台构建,这样可以方便在仿真器上运行。 在下一节,我们将共享库打包进APK文件,供应用程序调用。

  • 问题内容: 我可以使用带有静态链接的gcc构建可执行文件: gcc-静态xxx.c -o xxx 所以我可以在没有任何外部依赖库的情况下运行xxx。 但是,如果我要构建没有外部依赖库的共享库怎么办?我的意思是我希望共享库静态链接其外部引用。 问题答案: 这将起作用: 需要说明的是:-static标志(如果提供给gcc)会传递给链接器(ld),并告诉它与库的静态版本(.a)(由-l标志指定)一起使用

  • 我正在尝试开发共享库,目录结构如下 src/com/mycomapny 我的测试。棒极了 测试。棒极了 我的Jenkinsfile调用test.groovy中唯一可用的方法,需要输入。它导入MyTest并创建对象,调用构造函数,然后是执行MyTest.groovy文件中可用功能的实际方法 在这里,构造函数类从未从全局vars/test调用过。棒极了 我尝试从groovy调用类和方法,它工作正常,但

  • 问题内容: 这有什么问题吗?我有以下简单的课程: 在运行一个简单的compile()之后,出现以下错误: 在共享库上运行nm表示实际上已找到它: 这是在Ubuntu 12.04上发生的。该 libmnl-dev的 和 libmnl0 包安装。的输出表明正使用该* .so文件: 问题答案: 库必须在使用它们的对象之后列出(更确切地说,仅当库包含满足遇到未定义引用的符号时,才使用库)。将移至命令末尾。