小白写了一个插件,想进行代码混淆,在论坛学习下,知道了光
但是由于某些人的不道德行为,po主(张总)停止维护
然后在github上寻找了一个可编译的obfuscator,编译成功
但是在编译tweak的时候报错
环境
- Xcode15.0 iPhoneOS17.0.sdk
- LLVM 13.x https://github.com/heroims/obfuscator.git
- theos (https://github.com/theos/theos )
报错信息
While building module 'Foundation' imported from xxx/tes_tweak/Prefix.pch:8:
In file included from <module-includes>:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:13:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:378:81: error: function does not return string type
- (nullable instancetype)initWithUTF8String:(const char *)nullTerminatedCString NS_FORMAT_ARGUMENT(1);
...
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:402:114: error: function does not return string type
- (nullable instancetype)initWithCString:(const char *)nullTerminatedCString encoding:(NSStringEncoding)encoding NS_FORMAT_ARGUMENT(1);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:103:48: note: expanded from macro 'NS_FORMAT_ARGUMENT'
#define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A)))
尝试解决
1.在makefile里增加编译参数消宏定义
报错其中一个出现在文件NSObjCRuntime.h里:
#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
#import <Foundation/NSObjCRuntime.h>
#endif
然后在Makefile里增加参数:
test_tweak_CFLAGS := -DTARGET_OS_OSX\=0 -DTARGET_OS_MACCATALYST\=0 -DTARGET_OS_IPHONE -DTARGET_OS_IOS
结果:报错
2.将 iPhoneOS.sdk/usr/include/TargetConditionals.h 里arm64架构下的 #define TARGET_OS_MACCATALYST 1 改为 0(tbag大佬的指导)
结果:报错
3.手动指定isysroot,makefile文件新增编译指令(张总的之前的指导)
test_tweak_CFLAGS := -isysroot "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk"
结果:报错
承蒙各位大佬指导,如有打扰,敬请忽略