[LLVMdev] Building clang on Raspberry Pi2

Richard Pennington rich at pennware.com
Thu Feb 12 19:20:49 PST 2015


On 02/12/2015 08:43 PM, Ben Pope wrote:
> On Friday, February 13, 2015 06:28 AM, Richard Pennington wrote:
>> On 02/12/2015 10:06 AM, Ben Pope wrote:
>>> The raspberry Pi2 is an armv7a chip (Cortex-A7), the first stage
>>> builds fine with the native g++ (if not a little slowly at 10+ hours),
>>> but it crashes at some point with this command line:
>>>
>>> Program arguments:
>>> /home/ben/development/llvm/3.6.0/rc2/Phase2/Release/llvmCore-3.6.0-rc2.install/bin/clang 
>>>
>>> -cc1 -triple armv7-unknown-linux-gnueabihf -emit-obj -disable-free
>>> -disable-llvm-verifier -main-file-name APFloat.cpp -mrelocation-model
>>> pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose
>>> -mconstructor-aliases -fuse-init-array -target-cpu cortex-a8
>>> -target-abi aapcs-linux -mfloat-abi hard -target-linker-version
>>> 2.24.90.20141023 -dwarf-column-info -ffunction-sections
>>> -fdata-sections -coverage-file
>>>
>>> But it's a Cortex-A7, not A8, how do I convince the test-release.sh or
>>> build scripts to make Phase1 clang target Cortex A7 for Phase2? (with
>>> vfpv4-d16)
>>>
>>> Whilst we're at it, I'm not convinced that the Pi2 would make a great
>>> cross-compilation machine, so is it possible to reduce the enabled
>>> targets? "X86 Sparc PowerPC ARM AArch64 Mips XCore MSP430 CppBackend
>>> NVPTX Hexagon SystemZ R600"
>>
>> Hi Ben,
>>
>> What sort of error are you getting? Isn't APFloat.cpp the first source
>> file that's being compiled by the newly built clang?
>
> All sorts of errors, the binary is not compatible with the system, but 
> bus error and spitting out crash dumps (where it packages the cpp and 
> build file) are typical.
>
>> Trimming targets is easy. I had to do it when I built clang for ARM in
>> the early days beucase the statis bild got too big. You can limit set
>> code generators used in the configure line with -"-enable-targets=arm".
>
> Thanks, I'm not sure if I can pass that through test-release.sh, but 
> perhaps I can modify that script.
>
>> A 10 hour build. Why not just cross build it?
>
> That was just the first phase of 3 :P  I'm just trying to see what the 
> Pi2 is capable of, but I also thought it would be easier to convince 
> the build to run correctly on the native machine.
>
> Ben
>
Ben,

My son bought me a Raspberry Pi for Christmas. I've been itching to try 
my cross compiled pre-built clang binaries on it. 
(http://ellcc.org/blog/?page_id=20295). I hope to soon.

-Rich



More information about the llvm-dev mailing list