[cfe-dev] Single instance 'clang', multi-target support for headers and libraries
Martin J. O'Riordan via cfe-dev
cfe-dev at lists.llvm.org
Fri Jun 8 04:08:26 PDT 2018
Thanks,
Yes, this is as I expected it to be currently. This means that I cannot do:
clang -target bar helloworld.c -o helloworld.bar.out
clang -target x86_64 helloworld.c -o helloworld.x86.out
clang helloworld.c -o helloworld.foo.out
but instead have to use:
clang -target bar --sysroot=<path-for-bar> -L <libs-for-bar> -I <includes-for-bar> helloworld.c -o helloworld.bar.out
clang -target x86_64 --sysroot=<path-for-foo> -L <libs-for-foo> -I <includes-for-foo> helloworld.c -o helloworld.x86.out
clang helloworld.c -o helloworld.foo.out
It also means that the current CMake descriptions for building LibC++ and Compiler-RT cannot build these libraries for each of the targets configured for LLVM (using '-DLLVM_TARGETS_TO_BUILD=FOO;BAR;X86').
I had hoped that there was a less clunky way of doing this which I didn’t know about, or possibly in development by somebody else.
All the best,
MartinO
-----Original Message-----
From: Paweł Sikora [mailto:pawels at alatek.krakow.pl]
Sent: 07 June 2018 17:50
To: Martin J. O'Riordan <MartinO at theheart.ie>
Cc: Joerg Sonnenberger <joerg at bec.de>; Clang Dev <cfe-dev at lists.llvm.org>
Subject: Re: [cfe-dev] Single instance 'clang', multi-target support for headers and libraries
----- Oryginalna wiadomość -----
> I don't think this helps, perhaps my explanation is not really clear enough.
> (...)
generally you can crosscompile for any target (enabled in llvm) with -target/--sysroot switches:
https://clang.llvm.org/docs/CrossCompilation.html#target-triple
afaics there's a minor bug in clang driver, it searches target compiler-rt files inside clang installation tree instead of --sysroot:
https://bugs.llvm.org/show_bug.cgi?id=36053
i'm using a clang/llvm toolchain with lld linker and libcxxabi/libcxx/compiler-rt runtime for 32/64-bit linux crosscompilation and it works pretty fine.
More information about the cfe-dev
mailing list