常见问题说明

此处主要汇总安全编译器的常见问题

0. 常见错误码

错误码 错误描述
101 please stop debugging[请停止调试]
102 please do not run inside the virtual machine[请不要在虚拟机内运行]
103 the file of KiwiCompiler was tampered[几维安全编译器的文件被篡改]
201 license.key file does not match this computer[license.key授权文件与本电脑不匹配]
202 license.key file is missing[license.key授权文件丢失]
203 authorization time expired[授权时间过期]
204 [KiwiCompiler] no permission to write files[安全编译器无权限写文件]xx
205 [KiwiCompiler] unknown error[安全编译器未知错误]
211 [clang] no permission to write files[clang无权限写文件]xx
212 [clang] unknown error[clang未知错误]

1. bitcode问题

问题描述:does not contain bitcode. You must rebuild it with bitcode enabled

修复建议:在Build Options中关闭Bitcode即可

2. Xcode默认路径问题

问题描述:error: can't exec '/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/KiwiSecSet.xcplugin/Contents/clang' (No such file or directory

修复建议:请不要修改/Applications/Xcode.app默认路径,否则找不到安全编译器

3. clang权限问题

问题描述:KiwiSecSet.xcplugin/Contents/kiwisec/clang: Permission deniedKiwiSecSet.xcplugin/Contents/clang: Permission denied,或类似的XcodeDefault.xctoolchain/usr/bin/clang: Permission denied

修复建议:在命令行中执行chmod 744 /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/KiwiSecSet.xcplugin/Contents/kiwisec/clang添加执行权限[其他文件操作方式相似],如下图 1-3

4. -kce-xx未知参数

问题描述:clang: error: unknown argument: '-kce-fla=2' clang: error: unknown argument: '-kce-bcf=50' Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1

修复建议:该参数仅几维安全编译器识别,当切换为默认编译器时,请删除该参数;有些pods导入项目时会在config里定义使用默认clang,修改为几维安全编译器clang即可

7. 证书问题

问题描述:Code Signing Error: Code signing is required for product type 'Application' in SDK 'iOS 11.2'

修复建议:请在General > Signing 下选择正确的Team

8. 无法调试程序

问题描述:无法对程序打断点调试分析

修复建议:几维安全编译器针对发布版本编译,拒绝调试。如需调试,请切换到默认编译器

9. c++链接问题

问题描述:编译时出现c++链接问题

修复建议:请在Build Settings > Linking > Other Linker Flags下添加:-lstdc++,如下图 1-91

10. clang++ errors

问题描述:clang++ emitted errors but did not return a nonzero exit code to indicate failure,如下图 1-10

修复建议:请在Build Phases > Linking Binary With Libraries 下添加:libncurses.tbd、libz.tbd、libc++.tbd、libstdc++.tbd、,如下图 1-101

11. 静态库链接问题

问题描述:静态库链接异常,如下图 1-4

修复建议:/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/KiwiSecSet.xcplugin/Contents/kiwisec/clang-lib/libclangrt.all.a文件链接到项目中,如下图 1-5

12. Unity项目duplicate symbol

问题描述:出现类似错误日志duplicate symbol __Z18RegisterAllClassesv in: /Users/supergiu/Library/Developer/Xcode/DerivedData/Unity-iPhone-gdqoayxcyxlmfpbkxurptjywyslb/Build/Intermediates/ArchiveIntermediates/Unity-iPhone/IntermediateBuildFilesPath/Unity-iPhone.build/Release-iphoneos/Unity-iPhone.build/Objects-normal/armv7/RegisterMonoModules.o

修复建议:在日志中搜索duplicate symbol,比如搜索RegisterAllClasses符号,搜索结果发现在RegisterMonModules.cpp中重定义了RegisterAllClasses相关的函数,这表示重定义了函数,此时注释掉该函数,编译即可通过 1-11

13. Unity项目编译后包体过大

问题描述:Unity项目编译后包体过大,不符合上线要求

修复建议:过滤Unity项目自身库的代码,来减少包体大小。通过命令行进入xxx/Classes/Native目录,执行find .|grep "\.cpp"|xargs -I {} basename {} |awk '{printf "%s,",$0}' > /tmp/filter.txt可以将该目录下的cpp文件导出到/tmp/filter.txt中,然后在OTHER_CFLAGS中通过-kce-filter参数,来过滤不需要加固的文件[如遇崩溃,也可以过滤],比如-kce-filter=xxx.cpp,xxx2.cpp 参考1:

-kce-filter=Bulk_Assembly-CSharp_0.cpp,Bulk_Assembly-CSharp_1.cpp,Bulk_Assembly-CSharp_2.cpp,Bulk_Assembly-CSharp_3.cpp,Bulk_Assembly-CSharp_4.cpp,Bulk_Assembly-CSharp_5.cpp,Bulk_Assembly-CSharp_6.cpp,Bulk_Assembly-CSharp_7.cpp,Bulk_Assembly-CSharp_8.cpp,Bulk_Assembly-CSharp_9.cpp,Bulk_Debugger_0.cpp,Bulk_Generics_0.cpp,Bulk_Generics_1.cpp,Bulk_Generics_10.cpp,Bulk_Generics_11.cpp,Bulk_Generics_12.cpp,Bulk_Generics_2.cpp,Bulk_Generics_3.cpp,Bulk_Generics_4.cpp,Bulk_Generics_5.cpp,Bulk_Generics_6.cpp,Bulk_Generics_7.cpp,Bulk_Generics_8.cpp,Bulk_Generics_9.cpp,Bulk_Mono.Security_0.cpp,Bulk_Mono.Security_1.cpp,Bulk_mscorlib_0.cpp,Bulk_mscorlib_1.cpp,Bulk_mscorlib_2.cpp,Bulk_mscorlib_3.cpp,Bulk_mscorlib_4.cpp,Bulk_mscorlib_5.cpp,Bulk_mscorlib_6.cpp,Bulk_mscorlib_7.cpp,Bulk_System.Core_0.cpp,Bulk_System_0.cpp,Bulk_System_1.cpp,Bulk_System_2.cpp,Bulk_UnityEngine.UI_0.cpp,Bulk_UnityEngine.UI_1.cpp,Bulk_UnityEngine_0.cpp,Bulk_UnityEngine_1.cpp,Bulk_UnityEngine_2.cpp,Bulk_UnityEngine_3.cpp,Bulk_UnityEngine_4.cpp

参考2:

-kce-filter=Bulk_AES_0.cpp,Bulk_Assembly-CSharp-firstpass_0.cpp,Bulk_Assembly-CSharp-firstpass_1.cpp,Bulk_Assembly-CSharp-firstpass_2.cpp,Bulk_Assembly-CSharp-firstpass_3.cpp,Bulk_Assembly-CSharp_0.cpp,Bulk_Assembly-CSharp_1.cpp,Bulk_Assembly-CSharp_10.cpp,Bulk_Assembly-CSharp_11.cpp,Bulk_Assembly-CSharp_12.cpp,Bulk_Assembly-CSharp_13.cpp,Bulk_Assembly-CSharp_14.cpp,Bulk_Assembly-CSharp_15.cpp,Bulk_Assembly-CSharp_16.cpp,Bulk_Assembly-CSharp_17.cpp,Bulk_Assembly-CSharp_2.cpp,Bulk_Assembly-CSharp_3.cpp,Bulk_Assembly-CSharp_4.cpp,Bulk_Assembly-CSharp_5.cpp,Bulk_Assembly-CSharp_6.cpp,Bulk_Assembly-CSharp_7.cpp,Bulk_Assembly-CSharp_8.cpp,Bulk_Assembly-CSharp_9.cpp,Bulk_Assembly-UnityScript_0.cpp,Bulk_Boo.Lang_0.cpp,Bulk_GameConfig_0.cpp,Bulk_GameConfig_1.cpp,Bulk_Generics_0.cpp,Bulk_Generics_1.cpp,Bulk_Generics_10.cpp,Bulk_Generics_11.cpp,Bulk_Generics_12.cpp,Bulk_Generics_13.cpp,Bulk_Generics_14.cpp,Bulk_Generics_15.cpp,Bulk_Generics_16.cpp,Bulk_Generics_17.cpp,Bulk_Generics_18.cpp,Bulk_Generics_19.cpp,Bulk_Generics_2.cpp,Bulk_Generics_20.cpp,Bulk_Generics_21.cpp,Bulk_Generics_22.cpp,Bulk_Generics_23.cpp,Bulk_Generics_24.cpp,Bulk_Generics_25.cpp,Bulk_Generics_26.cpp,Bulk_Generics_27.cpp,Bulk_Generics_28.cpp,Bulk_Generics_29.cpp,Bulk_Generics_3.cpp,Bulk_Generics_30.cpp,Bulk_Generics_31.cpp,Bulk_Generics_32.cpp,Bulk_Generics_33.cpp,Bulk_Generics_34.cpp,Bulk_Generics_35.cpp,Bulk_Generics_36.cpp,Bulk_Generics_37.cpp,Bulk_Generics_38.cpp,Bulk_Generics_39.cpp,Bulk_Generics_4.cpp,Bulk_Generics_40.cpp,Bulk_Generics_5.cpp,Bulk_Generics_6.cpp,Bulk_Generics_7.cpp,Bulk_Generics_8.cpp,Bulk_Generics_9.cpp,Bulk_Mono.Security_0.cpp,Bulk_Mono.Security_1.cpp,Bulk_mscorlib_0.cpp,Bulk_mscorlib_1.cpp,Bulk_mscorlib_2.cpp,Bulk_mscorlib_3.cpp,Bulk_mscorlib_4.cpp,Bulk_mscorlib_5.cpp,Bulk_mscorlib_6.cpp,Bulk_mscorlib_7.cpp,Bulk_protobuf-net_0.cpp,Bulk_System.Core_0.cpp,Bulk_System.Xml_0.cpp,Bulk_System.Xml_1.cpp,Bulk_System.Xml_2.cpp,Bulk_System.Xml_3.cpp,Bulk_System.Xml_4.cpp,Bulk_System_0.cpp,Bulk_System_1.cpp,Bulk_System_2.cpp,Bulk_System_3.cpp,Bulk_UnityEngine.UI_0.cpp,Bulk_UnityEngine.UI_1.cpp,Bulk_UnityEngine_0.cpp,Bulk_UnityEngine_1.cpp,Bulk_UnityEngine_2.cpp

14. swift项目报错

问题描述:

XXX-Swift.h  丢失
/Users/xxx/Desktop/\uc0\u26426 \u29483 \u39033 \u30446 /DianDang/DianDang/Lib/Cafe/Controller/DDCoffeeMeCotacee.m:15:9: fatal error: 'DianDang-Swift.h' file not found
#import "DianDang-Swift.h"
        ^~~~~~~~~~~~~~~~~~
1 error generated.

修复建议:该文件为中间文件,原始编译器编译后它会在目录中存在,比如我本地测试位于~/Library/Developer/Xcode/DerivedData/DianDang-aupilsckaiyeusfmepnuhlbdidkq/Build/Intermediates.noindex/DianDang.build/Debug-iphoneos/DianDang.build/DerivedSources/DianDang-Swift.h,将它拷贝出来,放到项目中,即可找到。

如果继续出现链接错误,如下图,将KiwiSecSet/Contents/kiwisec/clang-lib/libclangrt.all.a静态库添加到项目中即可。

1-13

15. 编译异常

问题描述:Unsupported compiler 'com.apple.compilers.llvm.clang.1_1' selected for architecture 'x86_64',如下图 1-12

修复建议:请在Build Settings > Build Options > Compiler for C/C++/Objective-C 中选择正确的编译器

16. 编译卡死

问题描述:编译项目时出现卡死现象

修复建议:第一步通过查看日志信息,排查是否因为项目过大,需要编译的时间长,如果日志在不断输出,说明未卡死,如下图;如果出现编译某个文件卡死,请中断后重新编译。 1-13

17. 文件编译失败

问题描述:出现类似问题 ../Unity-iPhone.build/Objects-normal/armv7/Il2CppAttributes.bc.ll.o" LLVM ERROR: Relocation out of range

修复建议:不对该文件加密,在OTHER_CFLAGS中通过设置 -kce-filter=Il2CppAttributes.cpp过滤掉。

18. App安装失败

问题描述:编译成功、安装失败

修复建议:可以将崩溃log日志发送给对接的技术人员,此处log为系统日志,获取方式请参考:https://blog.csdn.net/jiajiayouba/article/details/44936107

19. 查看日志信息&导出日志

问题描述:编译出错时,无法自行排查解决

修复建议:请通过下图方式查看编译日志信息,并将截图[或导出完整的错误日志]发送给对接的技术人员
查看日志信息
1-7
导出日志信息
1-10

results matching ""

    No results matching ""