Skip to content
This repository has been archived by the owner on Sep 25, 2023. It is now read-only.

Troubleshooting

Zhang edited this page Apr 20, 2019 · 7 revisions

ld: file not found: /Library/Developer/Toolchains/Hikari.xctoolchain/***

This is due to Xcode's Default Toolchain, located at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ contains stuff not packed into Hikari.Just copy corresponding directories over.I intentionally didn't copy those over for releases due to copyright reasons. You could also run rsync -ua /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ ~/Library/Developer/Toolchains/Hikari.xctoolchain/ to achieve this

mismatched subprogram between llvm.dbg.declare variable and !dbg attachment

On Release Builds of LLVM this should be a warning and won't crash compiling. Do note, however, that all debugging information are messed up so you probably won't be able to debug your program using Hikari. To silence this warning/error, turn off generating debug information. If you are invoking clang from command-line, this should be the default behavior. Currently there is no plan to fix this issue Fixed in a88945@develop

Android/ELF Linking Issues

Due to probably some issues with Android Toolchain's Link Time Optimizations, you will probably get a error message like the following:

Warning: relocation refers to discarded section

In which case just add the following to the project's Linker Flags:

-Wno-error=all -Wl,--no-fatal-warnings

If someone knows more about ELF/Android than I do please let me know.

Darwin(iOS/macOS/tvOS/watchOS)/MachO Issues

fatal error: error in backend: Section too large, can't encode r_address (0x100006a) into 24 bits of scattered relocation entry. The obfuscated LLVM IR is way too complicated for proper relocation encoding in MachO, try adjust the obfuscation arguments a bit. Reference: lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp

Other Apple Compatibility Issues

Apple's Xcode uses a modified LLVM 6.0(~) to speed up build time and stuff. While Apple has stated they do plan to backport their changes back to the open-source LLVM, so far directly using LLVM upstream in Xcode still has some compatibility issues.

  • -index-store-path cannot specify -o when generating multiple output files These two issues can be solved by turning off Enable Index While Building ACROSS THE WHOLE PROJECT, INCLUDING SUB-PROJECTS Note that for whatever reason that I have no interest in figuring out, newer Xcode versions seems to be ignoring this setting and still pass that option back nevertheless. This is a known bug and I honestly don't have the mood or the interest to even attempt to fix it.

It's probably less troublesome to port Hikari back to Apple's SwiftLLVM, which you can find a simple tutorial on my blog, that being said setting the source up for the port is not for the faint hearted and each compilation takes more than three hours.

Or alternatively, you could try using HikariObfuscator/NatsukoiHanabi which injects the obfuscation code into Apple Clang, this is the least stable implementation but it at least works straight out of the box