Is it possible to set up Clang for cross compiling for the ARM processor? The host will likely be on x86 ( AMD64 - Probably Ubuntu 12.04 ) and the target would be ARM ( Raspberry Pi as well as Pandaboard - will do separate compilations for each ), I may at some point also wish to cross compile for the PowerPC architecture? The program source is in C.
- Maybe this helps Is cross-compiling for ARM on x86 with llvm/Clang possible?Olaf Dietsche– Olaf Dietsche2013-02-04 23:39:43 +00:00Commented Feb 4, 2013 at 23:39
- github.com/dwelch67/raspberrypi I have examples that use clang in this repo and others. 3.2 allows for compiling straight to object rather than taking a step through assembly.old_timer– old_timer2013-02-05 01:31:20 +00:00Commented Feb 5, 2013 at 1:31
- stackoverflow.com/questions/5878292/…MoDJ– MoDJ2013-07-08 22:41:42 +00:00Commented Jul 8, 2013 at 22:41
2 Answers
To cross-compile for Raspberry Pi running soft-float Linux distros add flags -ccc-host-triple arm-eabi -marm -mfpu=vfp -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=softfp
To cross-compile for Raspberry Pi running hard-float Linux distros use the flags -ccc-host-triple arm-eabi -marm -mfpu=vfp -mcpu=arm1176jzf-s -mtune=arm1176jzf-s -mfloat-abi=hard
To cross-compile for Pandaboard use flags -ccc-host-triple arm-eabiv7 -mthumb -mfpu=neon-fp16 -mcpu=cortex-a9 -mtune=cortex-a9 -mfloat-abi=hard (assuming that your Pandaboard runs Ubuntu)
Note: more recent clang version use -target option instead of -ccc-host-triple
2 Comments
-target <triple> is not a recognised argument (though specified in the documentation), but --target=<triple> is.See EmbToolkit project. It gives ability to generate clang/llvm or gcc based cross compiler toolchain.