[PATCH] D22370: Respect LLVM_HOST_TRIPLE when manually specified

Luke Drummond via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 15 05:18:08 PDT 2016


ldrumm added a comment.

In https://reviews.llvm.org/D22370#484620, @beanz wrote:

> Can you explain why this is necessary when cross-targeting? I kinda feel that the problem is more likely that the LLVM_HOST_TRIPLE is being used in places where a *target* triple should be used.


The issue here is that on a win32 machine with Visual Studio installed, `MSVC` is set to true because CMake picks up the MSVC installation and immediately enter the `if (MSVC)` block on line 5. However, the LLVM_HOST_TRIPLE triple should be the native triple of the cross-compiler. For example I might be building an `lldb-server` to run on an arm android device, and use the gcc4.9 cross compiler for as part of the android native development kit which requires the following invocation for cmake

  cmake.exe %LLVM_SRC_PATH% -GNinja -DCMAKE_TOOLCHAIN_FILE=%LLVM_SRC_PATH\tools\lldb\cmake\platforms\Android.cmake -DANDROID_TOOLCHAIN_DIR=%CROSS_COMPILER_PATH% -DANDROID_ABI=armeabi -DCMAKE_CXX_COMPILER_VERSION=4.9 -DLLVM_TARGETS_TO_BUILD=ARM -DLLVM_HOST_TRIPLE=arm-unknown-linux-android -DLLVM_TABLEGEN=host-tblgen\\bin\\llvm-tblgen -DCLANG_TABLEGEN=host-tblgen\\bin\\clang-tblgen

However, the configure fails without this patch:

> CMake Error at cmake/modules/GetHostTriple.cmake:24 (message):

> 

>   Failed to execute C:/Users/luke/jenkins-workspace/llvm/cmake/config.guess

> 

> Call Stack (most recent call first):

> 

>   cmake/config-ix.cmake:352 (get_host_triple)

>   CMakeLists.txt:460 (include)


In any case, I think being able to manually specify the `LLVM_HOST_TRIPLE` on the CMake invocation step to be useful to those that are dealing with more complex cross-compilation setups, and for those that don't care, the behaviour won't change because this configure step will simply fall through to the original host triple step.


Repository:
  rL LLVM

https://reviews.llvm.org/D22370





More information about the llvm-commits mailing list