jmpews / Dobby

a lightweight, multi-platform, multi-architecture hook framework.
Apache License 2.0
3.98k stars 822 forks source link

hookzz编译成静态库,但是和源码链接时错误 #58

Closed WalkingAlone-David closed 4 years ago

WalkingAlone-David commented 5 years ago

平台 Android NDK Version: ndkr16b

描述

使用cmkae正常编译出32bit静态库libhookzz.a。但链接静态库时,编译器显示错误。

错误日志:

\HookZz-dev\srcxx\InterceptRoutingPlugin\FunctionInlineReplace/FunctionInlineReplaceExport.cc:0: error: undefined reference to 'LOGFUNC'
\HookZz-dev\.\OneLib\stdcxx\stdcxx/LiteMutableArray.h:20: error: undefined reference to 'LiteMutableArray::initWithCapacity(unsigned int)'
\HookZz-dev\srcxx/Interceptor.cpp:0: error: undefined reference to 'vtable for LiteMutableArray'

arm-linux-androideabi/bin\ld: the vtable symbol may be undefined because the class is missing its key function

\HookZz-dev\srcxx/Interceptor.cpp:20: error: undefined reference to 'LiteCollectionIterator::withCollection(LiteCollection const*)'
\HookZz-dev\srcxx\InterceptRouting/InterceptRouting.cpp:31: error: undefined reference to '_memcpy(void*, void const*, int)'
\HookZz-dev\.\OneLib\stdcxx\stdcxx/LiteMutableBuffer.h:26: error: undefined reference to 'LiteMutableBuffer::initWithCapacity(int)'
\HookZz-dev\.\srcxx\core/modules/assembler/assembler-arm.h:0: error: undefined reference to 'vtable for LiteMutableBuffer'

ld: the vtable symbol may be undefined because the class is missing its key function

trampoline-arm.cc:vtable for CodeBuffer: error: undefined reference to 'LiteObject::init()'
trampoline-arm.cc:vtable for CodeBuffer: error: undefined reference to 'LiteObject::free()'
trampoline-arm.cc:vtable for CodeBuffer: error: undefined reference to 'LiteObject::release()'
trampoline-arm.cc:vtable for CodeBuffer: error: undefined reference to 'LiteMutableBuffer::ensureCapacity(int)'
trampoline-arm.cc:vtable for CodeBuffer: error: undefined reference to 'LiteMutableBuffer::initWithCapacity(int)'
trampoline-arm.cc:typeinfo for CodeBufferBase: error: undefined reference to 'typeinfo for LiteMutableBuffer'

\srcxx\core/modules/assembler/assembler-arm.h:0: error: undefined reference to 'LOGFUNC'
libhookzz.a(AssemblyCode.cc.o):AssemblyCode.cc:vtable for zz::AssemblyCode: error: undefined reference to 'LiteObject::init()'
libhookzz.a(AssemblyCode.cc.o):AssemblyCode.cc:vtable for zz::AssemblyCode: error: undefined reference to 'LiteObject::free()'
libhookzz.a(AssemblyCode.cc.o):AssemblyCode.cc:vtable for zz::AssemblyCode: error: undefined reference to 'LiteObject::release()'
libhookzz.a(AssemblyCode.cc.o):AssemblyCode.cc:typeinfo for zz::AssemblyCode: error: undefined reference to 'typeinfo for LiteObject'

.\OneLib\stdcxx\stdcxx/LiteMutableArray.h:16: error: undefined reference to 'LiteMutableArray::initWithCapacity(unsigned int)'

srcxx\ExecMemory/ExecutableMemoryArena.cc:26: error: undefined reference to 'LiteCollectionIterator::withCollection(LiteCollection const*)'
.\OneLib\stdcxx\stdcxx/LiteMutableArray.h:20: error: undefined reference to 'LiteMutableArray::initWithCapacity(unsigned int)'
srcxx\ExecMemory/ExecutableMemoryArena.cc:0: error: undefined reference to 'vtable for LiteMutableArray'

arm-linux-androideabi/bin\ld: the vtable symbol may be undefined because the class is missing its key function

srcxx\ExecMemory/ExecutableMemoryArena.cc:0: error: undefined reference to 'LOGFUNC'
srcxx\ExecMemory/ExecutableMemoryArena.cc:0: error: undefined reference to 'vtable for LiteMutableArray'
arm-linux-androideabi/bin\ld: the vtable symbol may be undefined because the class is missing its key function

\HookZz-dev\srcxx\ExecMemory\CodeBuffer/CodeBufferBase.cc:40: error: undefined reference to '_memcpy(void*, void const*, int)'
\HookZz-dev\srcxx\InstructionRelocation\arm/ARMInstructionRelocation.cc:0: error: undefined reference to 'LOGFUNC'
\HookZz-dev\srcxx\InstructionRelocation\arm/ARMInstructionRelocation.cc:529: error: undefined reference to 'LiteCollectionIterator::withCollection(LiteCollection const*)'
\HookZz-dev\srcxx\InstructionRelocation\arm/ARMInstructionRelocation.cc:597: error: undefined reference to 'LiteCollectionIterator::withCollection(LiteCollection const*)'

clang++.exe: error: linker command failed with exit code 1 (use -v to see invocation)
Pancts commented 4 years ago

需要把logging和stdcxx也加上

jmpews commented 4 years ago

是的. 请把 logging + stdcxx 也加上.

zhangxy123666 commented 4 years ago

我也遇到这个问题了 但是提示是 error: undefined reference to 'ZzReplace' logging stdcxx都加了