1

我正在尝试链接到我根据 Android 指令为 ARM 交叉编译的一些静态库。我能够加载一些变量,但正在努力解决其中一个变量:

ld: error: undefined symbol: ACE_Time_Value::ACE_Time_Value(long, long)
  >>> referenced by VrCubeWorld_Framework.cpp:241 (jni/../../../Src/VrCubeWorld_Framework.cpp:241)
  >>>               /home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/objs/vrcubeworldfw/__/__/__/Src/VrCubeWorld_Framework.o:(OVRFW::VrCubeWorld::AppInit(OVRFW::ovrAppContext const*))
  >>> did you mean: ACE_Time_Value::ACE_Time_Value(long, long)
  >>> defined in: /home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/jni/../../../../../3rdParty/ACE_wrappers/build/target/lib/libTAO.a(ORB_Core.o)
  clang++: error: linker command failed with exit code 1 (use -v to see invocation)
  make: *** [/home/smiller/Android/Sdk/ndk/22.0.7026061/build/core/build-binary.mk:728: /home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/libvrcubeworldfw.so] Error 1

LD标志:

['"/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/ld"',
 '-z',
 'noexecstack',
 '-EL',
 '--fix-cortex-a53-843419',
 '--warn-shared-textrel',
 '-z',
 'now',
 '-z',
 'relro',
 '-z',
 'max-page-size=4096',
 '--hash-style=gnu',
 '--enable-new-dtags',
 '--eh-frame-hdr',
 '-m',
 'aarch64linux',
 '-shared',
 '-o',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/libvrcubeworldfw.so',
 '/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/24/crtbegin_so.o',
 '-u',
 'ANativeActivity_onCreate',
 '-L/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/11.0.5/lib/linux/aarch64',
 '-L/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x',
 '-L/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib/../lib64',
 '-L/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/24',
 '-L/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android',
 '-L/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/../lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/lib',
 '-L/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib',
 '-soname',
 'libvrcubeworldfw.so',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/objs/vrcubeworldfw/__/__/__/Src/VrCubeWorld_Framework.o',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/libsampleframework.a',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/jni/../../../../../3rdParty/ACE_wrappers/build/target/lib/libTAO_AnyTypeCode.a',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/jni/../../../../../3rdParty/ACE_wrappers/build/target/lib/libTAO.a',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/jni/../../../../../3rdParty/ACE_wrappers/build/target/lib/libACE.a',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/libsamplecommon.a',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/libminizip.a',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/libstb.a',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/libandroid_native_app_glue.a',
 '/home/smiller/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_static.a',
 '/home/smiller/Android/Sdk/ndk/22.0.7026061/sources/cxx-stl/llvm-libc++abi/../llvm-libc++/libs/arm64-v8a/libc++abi.a',
 '-lgcc',
 '--exclude-libs',
 'libgcc.a',
 '--exclude-libs',
 'libgcc_real.a',
 '-latomic',
 '--exclude-libs',
 'libatomic.a',
 '/home/smiller/Development/Vandy/Term3/VR/ovr_strip1/VrSamples/VrCubeWorld_Framework/Projects/Android/build/intermediates/ndkBuild/release/obj/local/arm64-v8a/libvrapi.so',
 '--build-id=sha1',
 '--no-rosegment',
 '--no-undefined',
 '--fatal-warnings',
 '-lEGL',
 '-lGLESv3',
 '-landroid',
 '-llog',
 '-lz',
 '-lz',
 '-llog',
 '-landroid',
 '-lc',
 '-lm',
 '-lm',
 '-lgcc',
 '-ldl',
 '-lc',
 '-lgcc',
 '-ldl',
 '/home/smiller/Android/Sdk/ndk/22.0.7026061/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/aarch64-linux-android/24/crtend_so.o']

安卓.mk:

LOCAL_PATH := $(call my-dir)

######################################
#
# Static Libraries
#
#######################################

# ACE
include $(CLEAR_VARS)
LOCAL_MODULE := libACE
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/lib/libACE.a
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target \
                    $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/TAO
include $(PREBUILT_STATIC_LIBRARY)

# TAO
include $(CLEAR_VARS)
LOCAL_MODULE := libTAO
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/lib/libTAO.a
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target \
                    $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/TAO
include $(PREBUILT_STATIC_LIBRARY)

# TAO Any Type Code
include $(CLEAR_VARS)
LOCAL_MODULE := libTAOAnyTypeCode
LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/lib/libTAO_AnyTypeCode.a
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target \
                    $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/TAO
include $(PREBUILT_STATIC_LIBRARY)

##########################################
#
# Compiler Options
#
##########################################

include $(CLEAR_VARS)

include ../../../../cflags.mk

LOCAL_MODULE            := vrcubeworldfw

LOCAL_ARM_MODE := arm
LOCAL_ARM_NEON := true

LOCAL_CFLAGS         := -Werror


LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../../../SampleCommon/Src \
                    $(LOCAL_PATH)/../../../../SampleFramework/Src \
                    $(LOCAL_PATH)/../../../../../VrApi/Include \
                    $(LOCAL_PATH)/../../../../../1stParty/OVR/Include \
                    $(LOCAL_PATH)/../../../../../1stParty/utilities/include \
                    $(LOCAL_PATH)/../../../../../3rdParty/stb/src \
                    $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target \
                    $(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/TAO \

LOCAL_CPPFLAGS += -frtti
LOCAL_CPPFLAGS += -fexceptions

LOCAL_SRC_FILES := ../../../Src/VrCubeWorld_Framework.cpp \
$(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/lib/libTAO_AnyTypeCode.a \
$(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/lib/libTAO.a \
$(LOCAL_PATH)/../../../../../3rdParty/ACE_wrappers/build/target/lib/libACE.a \

###################################################
#
# Linker Options
#
###################################################

LOCAL_LDLIBS := -lEGL -lGLESv3 -landroid -llog -lz
LOCAL_LDFLAGS += --verbose
LOCAL_LDFLAGS += 

LOCAL_STATIC_LIBRARIES := sampleframework
LOCAL_STATIC_LIBRARIES += libTAOAnyTypeCode libTAO libACE

LOCAL_SHARED_LIBRARIES := vrapi

include $(BUILD_SHARED_LIBRARY)

$(call import-module,VrApi/Projects/AndroidPrebuilt/jni)
$(call import-module,VrSamples/SampleFramework/Projects/Android/jni)

nm -Ca .../libTAO.a | grep ACE_Time_Value::ACE_Time_Value输出:

0000000000000000 W ACE_Time_Value::ACE_Time_Value(long, long)

我已经尝试了很多东西,但似乎没有任何效果。对于我做错了什么,我将不胜感激任何建议或帮助。

4

1 回答 1

0

这与不匹配的 ABI 问题有关。我重新编译了静态库,强制它们使用特定的 ABI 并正确链接。感谢 Reddit 上的 u/Xeverous。

于 2021-06-21T16:35:42.630 回答