DeClang
DeClang copied to clipboard
DeClang not applied to Unity macOS IL2CPP
Environment:
- Unity 2022.3.21f1
- Target Platform macOS
- Scripting Backend IL2CPP
- Xcode 15.2
Not DeClang but default clang is still used after setup.
Cmdline: "/Applications/Xcode15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++" ...
It seems there is no --tool-chain-path on il2cpp option and may have no effect.
$ ./Il2CppOutputProject/IL2CPP/build/deploy/il2cpp --help
Options:
...
Is there any way to apply DeClang on Unity IL2CPP?
The “--tool-chain-path” option is a hidden option, so it is not shown with the “--help” option. When building on the target MacOS with Unity, make sure to export xcode project. Once the xcode project is generated, are you running DeClang's xcode_setup command for all .xcodeproj directories? Then open the main .xcodeproj file using Xcode.app and build it, and DeClang should be running.
Yes, I did for the all .xcodeproj directories. It seems DeClang is used on the main .xcodeproj, however default clang is still used on the GameAssembly .xcodeproj. I wonder what makes the difference.
Upon investigation, I found that --tool-chain-path
is not available when the target is MacOS. It is available when the target is iPhone.
As a workaround, I think it works if you temporarily make “/Applications/Xcode15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++” a symbolic link to “/yourhome/.DeClang/compiler/usr/bin/clang++”.
With the current specification of the il2cpp command, it seems difficult to fix.
I see. Would it be enough just replacing default clang/clang++ binary and no other setting modifications? (xcode_setup and binary replace?)
Simply make /Applications/Xcode15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
a symbolic link to /YourHome/.DeClang/compiler/bin/clang
.
/Applications/Xcode15.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++
is already a symbolic link to the "clang" in same directory, so there is no need to change it.
/YourHome/.DeClang/log.txt
is the execution log of DeClang. It may be helpful.
Use xcode_setup as usual. No other binary replacements are required.
Thanks. By the way, how compatible is DeClang with Xcode Apple clang? Could there be any compatibility issues?
DeClang is developed based on the official apple clang project, so there are no differences.
My understanding is that Apple clang is closed source, so it should be different from that.
Another question. Considering the balance between strength and performance, what would be an appropriate value for the overall_obfuscation (default 0) and split_level (default 1)?
Control the strength of obfuscation with the split_level parameter. As the value of the split_level parameter is increased, the size of the function is also increased, and the function size is approximately [split_level+1] times larger. The setting value is case by case depending on the size of function and the importance of function, so you should find a good value yourself. The overall_obfuscation parameter is just a little something extra obfuscation, so do not expect good result.