[llvm-dev] llvm cross compilation issue

Tobias Hieta via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 17 07:41:03 PDT 2020


You only need to build the tools you need from native - so run

"ninja llvm-tblgen clang-tblgen llvm-config"

No idea about how to get a native llvm-config return targets config - never
used that tool, hopefully someone else knows.

On Thu, Sep 17, 2020, 16:37 Денис Онищенко <denis.onischenko at gmail.com>
wrote:

> But besides the fact that building llvm is very time-consuming, there
> is another serious problem with this method: llvm-config built in this
> way will return incorrect results that are related to the host, not
> the target.
>
>
>
> 2020-09-17 16:47 GMT+03:00, Tobias Hieta <tobias at plexapp.com>:
> > Hello,
> >
> > There might be a smarter way - but I just build the tree twice:
> >
> > mkdir native ; cd native ; cmake -GNinja .. ; ninja
> > mkdir target ; cd target ; cmake -GNinja
> > -DCMAKE_TOOLCHAIN_FILE=cross.cmake
> > -DLLVM_TABLEGEN_PATH=../native/bin/llvm-tblgen ..
> >
> > I know there are runtime builds as well - but I am not familiar with it.
> >
> > -- Tobias
> >
> > On Thu, Sep 17, 2020 at 3:28 PM Денис Онищенко via llvm-dev
> > <llvm-dev at lists.llvm.org> wrote:
> >>
> >> I am trying to compile llvm using a toolchain file where I have
> >> specified the target system and compilers as suggested at
> >>
> https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compilation-tool
> >> chain:
> >>
> >> set(CMAKE_SYSTEM_NAME Linux)
> >> set(CMAKE_SYSTEM_PROCESSOR arm)
> >>
> >> set(CMAKE_C_COMPILER arm-unknown-linux-gnueabi-gcc)
> >> set(CMAKE_CXX_COMPILER arm-unknown-linux-gnueabi-g++)
> >>
> >> But the problem is that native tools like llvm-config, llvm-tblgen and
> >> clang-tblgen, which must be built by the native compiler, are also
> >> created by the target compiler.
> >>
> >> What cmake / "toolchain file" options should I use to use the native
> >> (host) compiler for these native tools (which are placed in the NATIVE
> >> subdirectory), and target compilers for other binaries and libraries?
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> llvm-dev at lists.llvm.org
> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200917/dea09c43/attachment.html>


More information about the llvm-dev mailing list