<div dir="auto">You only need to build the tools you need from native - so run<div dir="auto"><br></div><div dir="auto">"ninja llvm-tblgen clang-tblgen llvm-config" </div><div dir="auto"><br></div><div dir="auto">No idea about how to get a native llvm-config return targets config - never used that tool, hopefully someone else knows. </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 17, 2020, 16:37 Денис Онищенко <<a href="mailto:denis.onischenko@gmail.com">denis.onischenko@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">But besides the fact that building llvm is very time-consuming, there<br>
is another serious problem with this method: llvm-config built in this<br>
way will return incorrect results that are related to the host, not<br>
the target.<br>
<br>
<br>
<br>
2020-09-17 16:47 GMT+03:00, Tobias Hieta <<a href="mailto:tobias@plexapp.com" target="_blank" rel="noreferrer">tobias@plexapp.com</a>>:<br>
> Hello,<br>
><br>
> There might be a smarter way - but I just build the tree twice:<br>
><br>
> mkdir native ; cd native ; cmake -GNinja .. ; ninja<br>
> mkdir target ; cd target ; cmake -GNinja<br>
> -DCMAKE_TOOLCHAIN_FILE=cross.cmake<br>
> -DLLVM_TABLEGEN_PATH=../native/bin/llvm-tblgen ..<br>
><br>
> I know there are runtime builds as well - but I am not familiar with it.<br>
><br>
> -- Tobias<br>
><br>
> On Thu, Sep 17, 2020 at 3:28 PM Денис Онищенко via llvm-dev<br>
> <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> I am trying to compile llvm using a toolchain file where I have<br>
>> specified the target system and compilers as suggested at<br>
>> <a href="https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compilation-tool" rel="noreferrer noreferrer" target="_blank">https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compilation-tool</a><br>
>> chain:<br>
>><br>
>> set(CMAKE_SYSTEM_NAME Linux)<br>
>> set(CMAKE_SYSTEM_PROCESSOR arm)<br>
>><br>
>> set(CMAKE_C_COMPILER arm-unknown-linux-gnueabi-gcc)<br>
>> set(CMAKE_CXX_COMPILER arm-unknown-linux-gnueabi-g++)<br>
>><br>
>> But the problem is that native tools like llvm-config, llvm-tblgen and<br>
>> clang-tblgen, which must be built by the native compiler, are also<br>
>> created by the target compiler.<br>
>><br>
>> What cmake / "toolchain file" options should I use to use the native<br>
>> (host) compiler for these native tools (which are placed in the NATIVE<br>
>> subdirectory), and target compilers for other binaries and libraries?<br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank" rel="noreferrer">llvm-dev@lists.llvm.org</a><br>
>> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
</blockquote></div>