[cfe-dev] How to compile Clang for ARM Linux on x86_64 Linux?

Anton Smirnov dev at antonsmirnov.name
Sun Sep 29 22:40:11 PDT 2013


i've unpacked libLLVMSupport.a file and object files inside are ELF 32-bit,
ARM. So it seems .obj files are compiled for host correctly and packed to
.a correctly.

ld is taken from correct toolchain:
/usr/lib/gcc-cross/arm-linux-gnueabihf/4.7/../../../../arm-linux-gnueabihf/bin/ld:
../../lib/libLLVMSupport.a(regcomp.c.o): Relocations in generic ELF (EM: 3)

Any thoughts?


2013/9/29 Anton Smirnov <dev at antonsmirnov.name>

> Can someone just compile clang for ARM and for x86 (not x86_64) linux
> (Android to be more detailed), link statically and strip? i will be very
> thankful.
> It seems that a bunch of different unexpected problems..
>
>
> 2013/9/29 Anton Smirnov <dev at antonsmirnov.name>
>
>> Not sure it is the reason - according to output clang and clang++
>> (symlinked to clang) is identified:
>>
>> -- The C compiler identification is Clang 3.4.0
>> -- The CXX compiler identification is Clang 3.4.0
>> -- Check for working C compiler: /home/asmirnov/llvm_installed/bin/clang
>> -- Check for working C compiler: /home/asmirnov/llvm_installed/bin/clang
>> -- works
>> -- Detecting C compiler ABI info
>> -- Detecting C compiler ABI info - done
>> -- Check for working CXX compiler:
>> /home/asmirnov/llvm_installed/bin/clang++
>> -- Check for working CXX compiler:
>> /home/asmirnov/llvm_installed/bin/clang++ -- works
>> -- Detecting CXX compiler ABI info
>> -- Detecting CXX compiler ABI info - done
>> -- Looking for C++ include cxxabi.h
>> -- Looking for C++ include cxxabi.h - found
>>
>>
>> I have tried with -DCMAKE_C_COMPILER and -DCMAKE_CXX_COMPILER vars - the
>> same error.
>>
>>
>> 2013/9/29 Anton Korobeynikov <anton at korobeynikov.info>
>>
>>> > It looks like it didn't find clang++, but it did find clang, so maybe
>>> you
>>> > need the symlink from clang++ to clang there to make it work. It
>>> should be
>>> > there, no idea why it's not.
>>> >
>>> > arm-linux-gnueabihf-g++ will not be able to compile a simple test
>>> program
>>> > because CMake will try to execute it and it won't run (it's ARM).
>>> cmake seems does not honor CC / CXX env. variables. The "hard way" to
>>> specify C/C++ compiler there is via -DCMAKE_C_COMPILER=clang
>>> -DCMAKE_CXX_COMPILER=clang++
>>>
>>> Also, I remember that some versions of cmake had bug, where it used
>>> clang as C compiler and something else as C++ compiler. Something like
>>> http://www.cmake.org/Bug/view.php?id=13505
>>> --
>>> With best regards, Anton Korobeynikov
>>> Faculty of Mathematics and Mechanics, Saint Petersburg State University
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130930/599accf5/attachment.html>


More information about the cfe-dev mailing list