Rob Stewart
2013-Nov-27 13:57 UTC
[LLVMdev] Targeting ARM Cortex-a9 from x86_64 with clang
On 26 November 2013 16:44, Renato Golin <renato.golin at linaro.org> wrote:> On 26 November 2013 15:36, Rob Stewart <robstewart57 at gmail.com> wrote: >> >> $ clang -v -target armv7a-linux-eabi -mcpu=cortex-a9 -mfloat-abi=soft >> -mfpu=neon helloworld.c > > Hi Rod,I'm honoured. (But Rob is also OK) :-)> You need cross-binutils installed on your box. If you use Debian, there are > packages (gcc-4.7-arm-linux-gnueabi and friends). Other distros may have > similar packages, but you can always download the Linaro toolchain > (http://releases.linaro.org/latest/components/toolchain). > > Supposing you already have it, and it's in the PATH, Clang only recognizes > it automatically if your triple is identical to the name of your cross > compiler (See "Toolchain Options" in the referred doc). That means, you > either need to have an "armv7a-linux-eabi-gcc" on the path, or you have to > change your triple to something like "arm-linux-gnueabi", because that's > what your cross-GCC will probably be called. The -mcpu will take care of > choosing v7A.So on my Fedora box, I've installed packages gcc-arm-linux-gnu.x86_64 and cross-binutils-common.noarch . Moreover, the first of these two packages provide `/usr/bin/arm-linux-gnu-gcc` $ repoquery -lq gcc-arm-linux-gnu.x86_64 Repository google-chrome is listed more than once in the configuration /usr/bin/arm-linux-gnu-cpp /usr/bin/arm-linux-gnu-gcc /usr/bin/arm-linux-gnu-gcov /usr/lib/gcc/arm-linux-gnueabi /usr/lib/gcc/arm-linux-gnueabi/4.8.1 /usr/lib/gcc/arm-linux-gnueabi/4.8.1/crtbegin.o ... The -target that appears to be recognised by clang is `arm-none-eabi`. However, I'm now falling in to another trap. $ clang -v -target arm-none-eabi -mcpu=cortex-a9 -mfloat-abi=soft helloworld.c ... arm-none-eabi-gcc: fatal error: selected multilib '.' not installed I've put the -v output to gist: https://gist.github.com/robstewart57/7676030
Renato Golin
2013-Nov-27 14:34 UTC
[LLVMdev] Targeting ARM Cortex-a9 from x86_64 with clang
On 27 November 2013 13:57, Rob Stewart <robstewart57 at gmail.com> wrote:>> Hi Rod, > > I'm honoured. (But Rob is also OK) :-)Haha! That was my best typo ever! ;)> So on my Fedora box, I've installed packages gcc-arm-linux-gnu.x86_64 > and cross-binutils-common.noarch.I'm not sure Clang understands "arm-linux-gnu" as a triple. The driver is not the most sane code in Clang, so it might have holes in it that won't make sense. It is worth opening a new thread on cfe-dev@ discussing the possible outcome of using arm-linux-gnu or arm-linux-androideabi as your triple and get your toolchain to be detected correctly on Fedora.> The -target that appears to be recognised by clang is `arm-none-eabi`.That triple is normally used when targeting bare-metal ARM targets, which I don't think is your case. I can see from your output, all seem fine until...> arm-none-eabi-gcc: fatal error: selected multilib '.' not installedNormally, the problem with this is that you have libraries compiled with hard-float and is trying to compile code with soft-float. But you should focus on getting Clang to recognize your original triple first, I think. cheers, --renato
Richard Pennington
2013-Nov-27 14:55 UTC
[LLVMdev] Targeting ARM Cortex-a9 from x86_64 with clang
On 11/27/2013 07:57 AM, Rob Stewart wrote:> On 26 November 2013 16:44, Renato Golin <renato.golin at linaro.org> wrote: >> On 26 November 2013 15:36, Rob Stewart <robstewart57 at gmail.com> wrote: >>> $ clang -v -target armv7a-linux-eabi -mcpu=cortex-a9 -mfloat-abi=soft >>> -mfpu=neon helloworld.c >> Hi Rod, > I'm honoured. (But Rob is also OK) :-) > >> You need cross-binutils installed on your box. If you use Debian, there are >> packages (gcc-4.7-arm-linux-gnueabi and friends). Other distros may have >> similar packages, but you can always download the Linaro toolchain >> (http://releases.linaro.org/latest/components/toolchain). >> >> Supposing you already have it, and it's in the PATH, Clang only recognizes >> it automatically if your triple is identical to the name of your cross >> compiler (See "Toolchain Options" in the referred doc). That means, you >> either need to have an "armv7a-linux-eabi-gcc" on the path, or you have to >> change your triple to something like "arm-linux-gnueabi", because that's >> what your cross-GCC will probably be called. The -mcpu will take care of >> choosing v7A. > So on my Fedora box, I've installed packages gcc-arm-linux-gnu.x86_64 > and cross-binutils-common.noarch . Moreover, the first of these two > packages provide `/usr/bin/arm-linux-gnu-gcc` > $ repoquery -lq gcc-arm-linux-gnu.x86_64 > Repository google-chrome is listed more than once in the configuration > /usr/bin/arm-linux-gnu-cpp > /usr/bin/arm-linux-gnu-gcc > /usr/bin/arm-linux-gnu-gcov > /usr/lib/gcc/arm-linux-gnueabi > /usr/lib/gcc/arm-linux-gnueabi/4.8.1 > /usr/lib/gcc/arm-linux-gnueabi/4.8.1/crtbegin.o > ... > > The -target that appears to be recognised by clang is `arm-none-eabi`. > However, I'm now falling in to another trap. > $ clang -v -target arm-none-eabi -mcpu=cortex-a9 -mfloat-abi=soft helloworld.c > ... > arm-none-eabi-gcc: fatal error: selected multilib '.' not installed > > I've put the -v output to gist: https://gist.github.com/robstewart57/7676030 >Your link says that clang is using gcc to compile rather than compiling directly. You might want to look at the ELLCC project, which is designed for just the sort of cross compilation you are trying to do. http://ellcc.org -Rich
Renato Golin
2013-Nov-27 15:10 UTC
[LLVMdev] Targeting ARM Cortex-a9 from x86_64 with clang
On 27 November 2013 14:55, Richard Pennington <rich at pennware.com> wrote:> Your link says that clang is using gcc to compile rather than compiling > directly. You might want to look at the ELLCC project, which is designed for > just the sort of cross compilation you are trying to do. http://ellcc.orgHi Rich, No, his output only has gcc to assemble and link: "/usr/bin/arm-none-eabi-gcc" -v -mcpu=cortex-a9 -mfloat-abi=soft -c -o /tmp/helloworld-2n4ZGp.o -x assembler /tmp/helloworld-Iarp5R.s "/usr/bin/arm-none-eabi-gcc" -v -mcpu=cortex-a9 -mfloat-abi=soft -o a.out /tmp/helloworld-2n4ZGp.o Clang normally calls GAS in case "-integrated-as" is not specified for ARM. Btw, Rod, you might try the integrated assembler, too. cheers, --renato
Reasonably Related Threads
- [LLVMdev] Targeting ARM Cortex-a9 from x86_64 with clang
- [LLVMdev] Targeting ARM Cortex-a9 from x86_64 with clang
- [LLVMdev] Targeting ARM Cortex-a9 from x86_64 with clang
- [LLVMdev] Targeting ARM Cortex-a9 from x86_64 with clang
- [LLVMdev] Targeting ARM Cortex-a9 from x86_64 with clang