Hi,
I am trying to execute a TA from the android media framework ( frameworks/av/drm/mediadrm/plugins/clearkey ) using TEEC_InitializeContext, TEEC_OpenSession, TEEC_CloseSession, TEEC_FinalizeContext, TEEC_InvokeCommand APIs. In order to do so I am trying to link libdrmclearkeyplugin.so with the libteec.so.
But I am not able to link that libteec.so with libdrmclearkeyplugin.so and getting the undefined reference errors.
Provided the libteec in the LOCAL_SHARED_LIBRARIES section of the Android.mk file under frameworks/av/drm/mediadrm/plugins/clearkey and also provided the tee_client_api.h file path in the LOCAL_C_INCLUDES section.
Please help me in resolving this issue.
I am using https://github.com/linaro-swg/optee_android_manifest/tree/hikey-n-4.9-240
---------------------------error log-------------------------------------------
FAILED: /bin/bash -c “prebuilts/misc/linux-x86/ccache/ccache prebuilts/clang/host/linux-x86/clang-2690385/bin/clang++ -nostdlib -Wl,-soname,libdrmclearkeyplugin.so -Wl,–gc-sections -shared -Lout/target/product/hikey/obj_arm/lib out/target/product/hikey/obj_arm/lib/crtbegin_so.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/AesCtrDecryptor.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/ClearKeyUUID.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/CreatePluginFactories.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/CryptoFactory.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/CryptoPlugin.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/DrmFactory.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/DrmPlugin.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/InitDataParser.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/JsonWebKey.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/Session.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/SessionLibrary.o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/Utils.o -Wl,–whole-archive -Wl,–no-whole-archive out/target/product/hikey/obj_arm/STATIC_LIBRARIES/libjsmn_intermediates/libjsmn.a out/target/product/hikey/obj_arm/STATIC_LIBRARIES/libunwind_llvm_intermediates/libunwind_llvm.a out/target/product/hikey/obj_arm/STATIC_LIBRARIES/libcompiler_rt-extras_intermediates/libcompiler_rt-extras.a prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/…/lib/gcc/arm-linux-androideabi/4.9/…/…/…/…/arm-linux-androideabi/lib/libatomic.a prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/bin/…/lib/gcc/arm-linux-androideabi/4.9/libgcc.a -lcrypto -llog -lstagefright_foundation -lutils -lteec -lc++ -ldl -lc -lm -o out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libdrmclearkeyplugin_intermediates/LINKED/libdrmclearkeyplugin.so -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,–build-id=md5 -Wl,–warn-shared-textrel -Wl,–fatal-warnings -Wl,–icf=safe -Wl,–hash-style=gnu -Wl,–no-undefined-version -Wl,–no-fix-cortex-a8 -target arm-linux-androideabi -Bprebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9/arm-linux-androideabi/bin -Wl,–exclude-libs,libunwind_llvm.a -Wl,–no-undefined out/target/product/hikey/obj_arm/lib/crtend_so.o”
frameworks/av/drm/mediadrm/plugins/clearkey/Session.cpp:37: error: undefined reference to ‘TEEC_InitializeContext(char const*, TEEC_Context*)’
frameworks/av/drm/mediadrm/plugins/clearkey/Session.cpp:42: error: undefined reference to ‘TEEC_OpenSession(TEEC_Context*, TEEC_Session*, TEEC_UUID const*, unsigned int, void const*, TEEC_Operation*, unsigned int*)’
frameworks/av/drm/mediadrm/plugins/clearkey/Session.cpp:54: error: undefined reference to ‘TEEC_CloseSession(TEEC_Session*)’
frameworks/av/drm/mediadrm/plugins/clearkey/Session.cpp:55: error: undefined reference to ‘TEEC_FinalizeContext(TEEC_Context*)’
frameworks/av/drm/mediadrm/plugins/clearkey/Session.cpp:216: error: undefined reference to ‘TEEC_InvokeCommand(TEEC_Session*, unsigned int, TEEC_Operation*, unsigned int*)’
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
-----------------------------error log-----------------------------------
find . -name libteec.so
./out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libteec_intermediates/PACKED/libteec.so
./out/target/product/hikey/obj_arm/SHARED_LIBRARIES/libteec_intermediates/LINKED/libteec.so
./out/target/product/hikey/obj_arm/lib/libteec.so
./out/target/product/hikey/obj/SHARED_LIBRARIES/libteec_intermediates/PACKED/libteec.so
./out/target/product/hikey/obj/SHARED_LIBRARIES/libteec_intermediates/LINKED/libteec.so
./out/target/product/hikey/obj/lib/libteec.so
./out/target/product/hikey/system/lib64/libteec.so
./out/target/product/hikey/system/lib/libteec.so
./out/target/product/hikey/symbols/system/lib64/libteec.so
./out/target/product/hikey/symbols/system/lib/libteec.so
objdump -T ./out/target/product/hikey/system/lib64/libteec.so | grep TEEC_
000000000000161c g DF .text 0000000000000098 Base TEEC_CloseSession
0000000000000f88 g DF .text 0000000000000010 Base TEEC_FinalizeContext
0000000000000e28 g DF .text 0000000000000160 Base TEEC_InitializeContext
00000000000016b4 g DF .text 000000000000017c Base TEEC_InvokeCommand
00000000000018fc g DF .text 0000000000000110 Base TEEC_RegisterSharedMemory
0000000000001a0c g DF .text 00000000000000c0 Base TEEC_RegisterSharedMemoryFileDescriptor
0000000000001bdc g DF .text 0000000000000068 Base TEEC_ReleaseSharedMemory
0000000000001830 g DF .text 00000000000000cc Base TEEC_RequestCancellation
0000000000001acc g DF .text 0000000000000110 Base TEEC_AllocateSharedMemory
0000000000000f98 g DF .text 00000000000001bc Base TEEC_OpenSession