[llvm-dev] bug: cross-compile Clang/LLVM for ARM using Clang/LLVM

李阳 via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 25 02:39:36 PDT 2016


​Hi all,

I'm new to LLVM project and now I need to cross-compile Clang/LLVM for ARM.
My host is Ubuntu 14.04 and I could compile Clang/LLVM for X86, however
when I cross-compile Clang/LLVM for ARM, I come across a few problems.

My build structure is in the picture. [llvm-source-code] is from github
llvm-mirror; [build4x86] is that I follow the guide  [Clang Getting
Started] and build clang/llvm to produce it; [build4arm] is that I try to
cross-compile clan/llvm for arm on x86 PC, the problem exist here.

Sorry to finish reading, thanks. My command is as follows:

CC='clang' CXX='clang++' cmake -G Ninja ../llvm-source-code
-DCMAKE_CROSSCOMPILING=True
-DCMAKE_INSTALL_PREFIX=./llvm
-DLLVM_TABLEGEN=/home/lab/workspace/llvm/build4x86/bin/llvm-tblgen
-DCLANG_TABLEGEN=/home/lab/workspace/llvm/build4x86/bin/clang-tblgen
-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf
-DLLVM_TARGET_ARCH=ARM
-DLLVM_TARGETS_TO_BUILD=ARM
-DCMAKE_CXX_FLAGS='-target armv7a-linux-gnueabihf -mcpu=cortex-a9
-I/usr/arm-linux-gnueabihf/include/c++/4.7.3/arm-linux-gnueabihf/
-I/usr/arm-linux-gnueabihf/include/
-I/home/lab/workspace/llvm/llvm-source-code/lib4arm/
-I/home/lab/workspace/llvm/llvm-source-code/lib2ubuntu/
-I/usr/lib/gcc/x86_64-linux-gnu/4.8/libatomic.so
-I/usr/lib/gcc/x86_64-linux-gnu/4.8/libatomic.so
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/libatomic.so
-L/usr/lib/gcc/x86_64-linux-gnu/4.8/libatomic.a -mfloat-abi=hard
-ccc-gcc-name arm-linux-gnueabihf-gcc'
-DLLVM_ENABLE_LIBCXX=ON
-DLLVM_ENABLE_PIC=False

The error is as follows:
1. Host compiler appears to require libatomic, but cannot find it.
2. Host Clang must be able to find libstdc++4.7 or newer!

Could anyone give me some suggestions? Thanks in advance!

Best,
Liyang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160425/192555b8/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot from 2016-04-25 17:03:03.png
Type: image/png
Size: 17474 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160425/192555b8/attachment-0001.png>


More information about the llvm-dev mailing list