[llvm] [CMake] Special-case HarmonyOS hosts in get_host_triple() (PR #219882)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 17 00:15:46 PDT 2026
abhinav-phi wrote:
finagolfin sorry for the slow reply
testing setup
no emulator and no harmonyos hardware on my side so far
the test in this pr llvm/test/CMake/get-host-triple.test runs the module in script mode with cmakes host detection variables simulated and asserts the triple for every supported arch plus the openharmony and ohos spellings
the fallback where cmake reports the processor as the literal string unknown was exercised with local script mode cmake runs on linux
the real hardware facts come from the reproducer in issue #219653 where the reporter ran uname on an actual harmonyos 7 pc and got uname -s harmonyos uname -p unknown and uname -m aarch64 on hongmeng kernel 1.13.0
gkxxucas kindly offered harmonyos pc help in that thread and i will ask them to build with this patch on that machine and report back here so the native host case gets real hardware coverage
on cangjie
yes i checked their oss compiler source
the compiler lives at gitcode.com/Cangjie with a github mirror at cangjielanguage/cangjie_compiler and the backend is a patched llvm 15 fork mirrored at cangjie-bot/llvm-project
the short version is they never detect a harmonyos host at all
their copy of GetHostTriple.cmake is stock and still falls through to config.guess
instead they treat ohos purely as a cross target from their build.py superbuild
a toolchain file sets CMAKE_SYSTEM_NAME to linux with --target=aarch64-linux-ohos and they explicitly pass -DLLVM_HOST_TRIPLE=aarch64-linux-ohos to the llvm configure so the cache override wins over config.guess
their cross builds only produce target libs and cjc itself is always built for a linux macos or windows host so the case this pr fixes where the build host itself is harmonyos is simply not supported there today
one small difference worth noting is their triple spelling aarch64-linux-ohos versus this prs aarch64-unknown-linux-ohos which matches what the ohos clang reports with -dumpmachine
https://github.com/llvm/llvm-project/pull/219882
More information about the llvm-commits
mailing list