【问题标题】:android-ndk build cannot link boost systemandroid-ndk build 无法链接boost系统
【发布时间】:2013-09-09 12:00:09
【问题描述】:

我正在尝试构建 sphinxbase 库,但它不断给出以下错误:

C:/android-ndk-r8e/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/base/__/__/__/__/__/src/libsphinxbase/util/SingletonLogMath.o: in function boost::thread_exception::thread_exception(int, char const*):C:\sdk/include/boost/thread/exceptions.hpp:51: error: undefined reference to 'boost::system::system_category()'
C:/android-ndk-r8e/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/base/__/__/__/__/__/src/libsphinxbase/util/SingletonLogMath.o: in function _GLOBAL__sub_I_SingletonLogMath.cpp:C:\sdk/include/boost/system/error_code.hpp:222: error: undefined reference to 'boost::system::generic_category()'
C:/android-ndk-r8e/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/base/__/__/__/__/__/src/libsphinxbase/util/SingletonLogMath.o: in function _GLOBAL__sub_I_SingletonLogMath.cpp:C:\sdk/include/boost/system/error_code.hpp:223: error: undefined reference to 'boost::system::generic_category()'
C:/android-ndk-r8e/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/base/__/__/__/__/__/src/libsphinxbase/util/SingletonLogMath.o: in function _GLOBAL__sub_I_SingletonLogMath.cpp:C:\sdk/include/boost/system/error_code.hpp:224: error: undefined reference to 'boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [obj/local/armeabi/libbase.so] Error 1

我在互联网上搜索,我只能找到我应该添加 boost-system 库,他们还说以正确的顺序使用包含依赖项很重要。 但我不知道正确的顺序是什么。

这是 android.mk 文件中可能很重要的部分。

include $(CLEAR_VARS)
LOCAL_MODULE := boost_thread
LOCAL_SRC_FILES := lib/libboost_thread_pthread-gcc-mt-1_54.a
include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)
LOCAL_MODULE := boost_system
LOCAL_SRC_FILES := lib/libboost_system-gcc-mt-1_54.a
include $(PREBUILT_STATIC_LIBRARY)

LOCAL_PATH := $(MY_LOCAL_PATH)

include $(CLEAR_VARS)

LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../../../src/libsphinxbase/fe $(LOCAL_PATH)/../../../../../src/libsphinxbase/fe $(LOCAL_PATH)/../../../../../include/android $(LOCAL_PATH)/../../../../../include $(SDK)/include
LOCAL_CFLAGS += -DHAVE_CONFIG_H
LOCAL_CPPFLAGS += -fexceptions -frtti
LOCAL_ARM_MODE := arm

...sources...

LOCAL_STATIC_LIBRARIES := boost_system, boost_thread

正确的顺序应该是什么?

【问题讨论】:

    标签: android c++ boost android-ndk


    【解决方案1】:
    LOCAL_STATIC_LIBRARIES := boost_system, boost_thread
    

    你应该删除','

    LOCAL_STATIC_LIBRARIES := boost_system boost_thread
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-22
      • 2018-05-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多