# LLVM is (typically) built with no C++ RTTI. We need to match that; # otherwise, we'll get linker errors about missing RTTI data. set_target_properties(Hikari PROPERTIES COMPILE_FLAGS "-fno-rtti" )
# Get proper shared-library behavior (where symbols are not necessarily # resolved when the shared library is linked) on OS X. if (APPLE) set_target_properties(Hikari PROPERTIES LINK_FLAGS "-undefined dynamic_lookup" ) endif (APPLE)
# Loop over all imported files and verify that they actually exist foreach(target${_IMPORT_CHECK_TARGETS} ) foreach(file${_IMPORT_CHECK_FILES_FOR_${target}} ) if(NOTEXISTS"${file}" ) message(FATAL_ERROR "The imported target \"${target}\" references the file \"${file}\" but this file does not exist. Possible reasons include: * The file was deleted, renamed, or moved to another location. * An install or uninstall procedure did not complete successfully. * The installation package was faulty and contained \"${CMAKE_CURRENT_LIST_FILE}\" but not all the files it references. ") endif() endforeach() unset(_IMPORT_CHECK_FILES_FOR_${target}) endforeach() unset(_IMPORT_CHECK_TARGETS)
(macOS) clang 和 libHikari.so 签名不一致导致被 Hardened Runtime 拒绝加载: error: unable to load plugin 'libHikari.so': 'dlopen(libHikari.so, 0x0009): tried: 'libHikari.so' (code signature in <xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx> 'libHikari.so' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OSlibHikari.so' (no such file), 'libHikari.so' (code signature in <xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx> 'libHikari.so' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)' 需要将 llvm/bin 中的可执行文件与 libHikari.so 用同一苹果开发者 TeamID 签名:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
sign_macho() { # Directory to search for Mach-O executables local directory="$1" # Signing identity local signing_identity="$TeamID" # Find and sign all Mach-O executables find "$directory" -type f -perm +111 | while read -r file; do # Check if the file is a Mach-O executable if file "$file" | grep -q "Mach-O"; then echo "Signing $file" codesign -s "$signing_identity" -f "$file" fi done
echo "Signing process completed." }
找不到符号: error: unable to load plugin '$(PROJECT_DIR)/app/obf_lib/darwin_arm64/libHikari.so': 'dlopen($(PROJECT_DIR)/app/obf_lib/darwin_arm64/libHikari.so, 0x0009): symbol not found in flat namespace '__ZTVN4llvm2cl6OptionE''. 这是由于官方 NDK 中自带的 clang 二进制符号不完整导致的. 需要自行构建 Android LLVM 来获取完整的 clang-18, clang, clang++ 替换掉 NDK 内自带的对应的三个文件.