hack0z / luject

🍹A static injector of dynamic library for application (android, iphoneos, macOS, windows, linux)
https://tboox.org
Apache License 2.0
324 stars 49 forks source link

编译失败 #4

Closed moqi2011 closed 3 years ago

moqi2011 commented 3 years ago

~/Downloads/luject-1.0.5 xmake [ 50%]: linking.release luject error: Undefined symbols for architecture x86_64: "lua_objlen(lua_State, int)", referenced from: lni_pe_add_libraries(lua_State) in main.cpp.o lni_elf_add_libraries(lua_State) in main.cpp.o lni_macho_add_libraries(lua_State) in main.cpp.o "lua_rawget(lua_State, int)", referenced from: lni_pe_add_libraries(lua_State) in main.cpp.o lni_elf_add_libraries(lua_State) in main.cpp.o lni_macho_add_libraries(lua_State) in main.cpp.o "lua_settop(lua_State, int)", referenced from: lni_pe_add_libraries(lua_State) in main.cpp.o lni_elf_add_libraries(lua_State) in main.cpp.o lni_macho_add_libraries(lua_State) in main.cpp.o "lua_pushnil(lua_State)", referenced from: lni_elf_detect_arch(lua_State) in main.cpp.o "lua_pushnumber(lua_State, double)", referenced from: lni_pe_add_libraries(lua_State) in main.cpp.o lni_elf_add_libraries(lua_State) in main.cpp.o lni_macho_add_libraries(lua_State) in main.cpp.o "lua_pushstring(lua_State, char const)", referenced from: lni_pe_add_libraries(lua_State) in main.cpp.o lni_elf_add_libraries(lua_State) in main.cpp.o lni_elf_detect_arch(lua_State) in main.cpp.o lni_macho_add_libraries(lua_State) in main.cpp.o "lua_pushboolean(lua_State, int)", referenced from: lni_pe_add_libraries(lua_State) in main.cpp.o lni_elf_add_libraries(lua_State) in main.cpp.o lni_macho_add_libraries(lua_State) in main.cpp.o "lua_pushlstring(lua_State, char const, unsigned long)", referenced from: lni_elf_detect_arch(lua_State) in main.cpp.o "luaL_checklstring(lua_State, int, unsigned long)", referenced from: lni_pe_add_libraries(lua_State) in main.cpp.o lni_elf_add_libraries(lua_State) in main.cpp.o lni_elf_detect_arch(lua_State) in main.cpp.o lni_macho_add_libraries(lua_State) in main.cpp.o "lua_type(lua_State, int)", referenced from: lni_pe_add_libraries(lua_State) in main.cpp.o lni_elf_add_libraries(lua_State) in main.cpp.o lni_macho_add_libraries(lua_State*) in main.cpp.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

wwwtete commented 3 years ago

Me too..

waruqi commented 3 years ago

我修复了 更新下 再试试

wwwtete commented 3 years ago

我修复了 更新下 再试试

非常感谢,可以编译通过了,但是 xmake install 又失败了,这是失败日志: localhost:luject wwwtete$ xmake install installing luject .. installing luject to /usr/local .. error: install failed, attempt to call method 'lastof' (a nil value)

编译安装环境是:Mac OS 10.14.6

waruqi commented 3 years ago

我修复了,更新下 xmake 再试试,xmake update -s dev

iftodo commented 3 years ago

PS E:\项目\luject> xmake install installing luject .. error: install failed, attempt to concatenate local 'p' (a nil value)

Win10 ....

waruqi commented 3 years ago

xmake install -vD 给我看下栈

iftodo commented 3 years ago

PS E:\项目\luject> xmake install -vD installing luject .. error: @programdir\core\main.lua:279: @programdir\actions\install\main.lua:130: install failed, @programdir\core\base\path.lua:87: attempt to concatenate local 'p' (a nil value) stack traceback: [@programdir\core\base\path.lua:87]: in function 'join' [@programdir\rules\xmake_cli\xmake.lua:39]: in function 'after_install' [@programdir\actions\install\install.lua:79]: in function 'script' [@programdir\actions\install\install.lua:90]: in function '_install_target' [@programdir\actions\install\install.lua:120]: in function 'install' [@programdir\actions\install\main.lua:81]: [C]: in function 'trycall' [@programdir\core\sandbox\modules\try.lua:121]: in function 'try' [@programdir\actions\install\main.lua:77]: [C]: in function 'load' [@programdir\core\base\task.lua:519]: in function 'run' [@programdir\core\main.lua:277]: in function 'cotask' [@programdir\core\base\scheduler.lua:365]:

stack traceback: [C]: in function 'error' @programdir\core\base\os.lua:800: in function 'raise' @programdir\core\main.lua:279: in function 'cotask' @programdir\core\base\scheduler.lua:365: in function <@programdir\core\base\scheduler.lua:362>

waruqi commented 3 years ago

windows 上是没有默认安装目录的,你要安装,指定下输出目录,xmake install -o xxx

iftodo commented 3 years ago

[ 56%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/ELF/DynamicEntry.cpp.o [ 56%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/ELF/DynamicEntryRpath.cpp.o [ 56%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/ELF/DynamicEntryFlags.cpp.o [ 57%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/ELF/hash.cpp.o [ 57%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/ELF/Note.cpp.o [ 57%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/ELF/NoteDetails.cpp.o /home/dev/.xmake/cache/packages/2105/l/lief/0.10.1/source/LIEF-0.10.1/src/ELF/Note.cpp: 在复制构造函数‘LIEF::ELF::Note::Note(const LIEF::ELF::Note&)’: /home/dev/.xmake/cache/packages/2105/l/lief/0.10.1/source/LIEF-0.10.1/src/ELF/Note.cpp:45:1: 警告:基类‘class LIEF::Object’应该在复制构造函数中显式地初始化 [-Wextra] 45 | Note::Note(const Note& other): | ^~~~ [ 58%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/ELF/json.cpp.o [ 58%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/utils.cpp.o [ 58%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/ExportEntry.cpp.o [ 59%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Binary.cpp.o [ 59%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Symbol.cpp.o [ 59%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/EnumToString.cpp.o [ 60%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Header.cpp.o [ 60%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/DosHeader.cpp.o [ 60%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/RichHeader.cpp.o [ 61%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/RichEntry.cpp.o [ 61%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/ResourceDirectory.cpp.o [ 61%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Import.cpp.o [ 62%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/ResourceNode.cpp.o [ 62%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Export.cpp.o [ 62%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Section.cpp.o [ 63%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/OptionalHeader.cpp.o [ 63%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Builder.cpp.o [ 64%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Parser.cpp.o [ 64%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/ResourcesManager.cpp.o [ 64%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Relocation.cpp.o [ 65%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/TLS.cpp.o [ 65%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Debug.cpp.o [ 65%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/CodeView.cpp.o [ 66%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/CodeViewPDB.cpp.o [ 66%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/Pogo.cpp.o [ 66%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/PogoEntry.cpp.o [ 67%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/ImportEntry.cpp.o [ 67%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/ResourceData.cpp.o [ 67%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/RelocationEntry.cpp.o [ 68%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/DataDirectory.cpp.o [ 68%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/CodeIntegrity.cpp.o [ 68%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/signature/AuthenticatedAttributes.cpp.o [ 69%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/signature/ContentInfo.cpp.o [ 69%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/signature/Signature.cpp.o [ 69%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/signature/SignerInfo.cpp.o [ 70%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/signature/x509.cpp.o [ 70%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/signature/OIDToString.cpp.o [ 70%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/signature/SignatureParser.cpp.o [ 71%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/resources/ResourceVersion.cpp.o [ 71%] Building CXX object CMakeFiles/LIB_LIEF.dir/src/PE/resources/ResourceDialog.cpp.o c++: 致命错误:已杀死 signal terminated program cc1plus 编译中断。 make[2]: [CMakeFiles/LIB_LIEF.dir/build.make:2240:CMakeFiles/LIB_LIEF.dir/src/PE/signature/OIDToString.cpp.o] 错误 1 make[2]: 正在等待未完成的任务.... make[1]: [CMakeFiles/Makefile2:237:CMakeFiles/LIB_LIEF.dir/all] 错误 2 make: [Makefile:171:all] 错误 2

iftodo commented 3 years ago

[dev@fedora luject]$ xmake checking for platform ... linux checking for architecture ... x86_64 note: try installing these packages (pass -y to skip confirm)? in xmake-repo: -> lief 0.10.1 please input: y (y/n) y => install lief 0.10.1 .. failed if you want to get verbose errors, please see: -> /home/dev/.xmake/cache/packages/2105/l/lief/0.10.1/installdir.failed/logs/install.txt error: install failed!

waruqi commented 3 years ago

我这里ok,看着像是 mem 不足,导致编译进程被系统强杀了。。

可以单独执行 xrepo install -j1 -vD lief ,开单任务编译下 lief 试试,然后再到工程里面执行 xmake f -c;xmake 编译工程

wwwtete commented 3 years ago

我修复了,更新下 xmake 再试试,xmake update -s dev

非常感谢,完美打包成功 请问是否支持多个 so 注入? 比如要注入这两个 libgadget.config.so libgadget.so 库怎么注入?

waruqi commented 3 years ago

我修复了,更新下 xmake 再试试,xmake update -s dev

非常感谢,完美打包成功 请问是否支持多个 so 注入? 比如要注入这两个 libgadget.config.so libgadget.so 库怎么注入?

支持的,命令行后面 追加 so 路径试试

moqi2011 commented 3 years ago

安装失败 ~/luject(master ✔) xmake install installing luject .. installing luject to /usr/local .. error: install failed, attempt to call method 'lastof' (a nil value)

waruqi commented 3 years ago

安装失败 ~/luject(master ✔) xmake install installing luject .. installing luject to /usr/local .. error: install failed, attempt to call method 'lastof' (a nil value)

见上文 更新xmake

moqi2011 commented 3 years ago

xmake 版本是2.5.4目前最新版本.

~/luject(master ✔) xmake --version xmake v2.5.4+202105151608, A cross-platform build utility based on Lua Copyright (C) 2015-present Ruki Wang, tboox.org, xmake.io _| | __ \ \/ / | \/ |/ _ | |/ / \

< | _/ | /| | < / //__|| ||_ ||___| by ruki, xmake.io

👉  Manual: https://xmake.io/#/getting_started
🙏  Donate: https://xmake.io/#/sponsor

~/luject(master ✔) xmake update xmake v2.5.4 has been installed! ~/luject(master ✔) xmake install installing luject .. installing luject to /usr/local .. error: install failed, attempt to call method 'lastof' (a nil value) ~/luject(master ✔)

moqi2011 commented 3 years ago

更新到dev可以了.谢谢