李阳 via llvm-dev
2016-Apr-25 11:26 UTC
[llvm-dev] bug: cross-compile Clang/LLVM for ARM using Clang/LLVM
Hi renato, 1. The command above is followed by the guide[ HowToCrossCompileLLVM.rst ] and I specify some path(ex. <path-to-host-bin>). 2. The including x86_64 libraries is added because of some missing libraries(ex. "error: Host compiler appears to require libatomic, but cannot find it"). As I have found that the bugs needed to dealt with is some ARM-dependent libraries, I cannot download them on Ubuntu14, could you share them or some available links? Thanks very much! Best, Liyang 2016-04-25 18:33 GMT+08:00 Renato Golin <renato.golin at linaro.org>:> On 25 April 2016 at 10:39, 李阳 via llvm-dev <llvm-dev at lists.llvm.org> > wrote: > >> 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 >> > > Hi Liyang, > > You have "LLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf" and > "CMAKE_CXX_FLAGS='-target armv7a-linux-gnueabihf" which are different, and > may confuse Clang when finding tools and libraries. Use whatever is the ARM > triple in your system (looks like it's "arm-linux-gnueabihf") and make both > target triple and "-target" to be that exact same string. > > Also, you're including x86_64 libraries > (ex. -L/usr/lib/gcc/x86_64-linux-gnu/4.8/libatomic.so) to an ARM > compilation job, that won't work. You have to find the ARM version (maybe > /usr/lib/gcc/arm-linux-gnueabihf/ ?). > > Finally, the include paths with -I are only necessary if Clang cannot find > it. The first three should be ok, but using -I on a DSO object > (libatomic.so) makes no sense. > > cheers, > --renato >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160425/4c37cbfb/attachment.html>
James Molloy via llvm-dev
2016-Apr-25 11:48 UTC
[llvm-dev] bug: cross-compile Clang/LLVM for ARM using Clang/LLVM
Hi Liyang,> The including x86_64 libraries is added because of some missing librariesThis will never work. The reason the libatomic check is failing is almost certainly because a path to the C++ headers/libraries is missing. You've manually added them all: -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 But a much more robust way to do this is just to use a sysroot: -DCMAKE_CXX_FLAGS='-target armv7a-linux-gnueabihf -mcpu=cortex-a9 --sysroot=/usr/arm-linux-gnueabihf/' Cheers, James On Mon, 25 Apr 2016 at 12:26 李阳 via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hi renato, > > 1. The command above is followed by the guide[ HowToCrossCompileLLVM.rst ] > and I specify some path(ex. <path-to-host-bin>). > > 2. The including x86_64 libraries is added because of some missing > libraries(ex. "error: Host compiler appears to require libatomic, but > cannot find it"). As I have found that the bugs needed to dealt with is > some ARM-dependent libraries, I cannot download them on Ubuntu14, could you > share them or some available links? > > Thanks very much! > > Best, > Liyang > > 2016-04-25 18:33 GMT+08:00 Renato Golin <renato.golin at linaro.org>: > >> On 25 April 2016 at 10:39, 李阳 via llvm-dev <llvm-dev at lists.llvm.org> >> wrote: >> >>> 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 >>> >> >> Hi Liyang, >> >> You have "LLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf" and >> "CMAKE_CXX_FLAGS='-target armv7a-linux-gnueabihf" which are different, and >> may confuse Clang when finding tools and libraries. Use whatever is the ARM >> triple in your system (looks like it's "arm-linux-gnueabihf") and make both >> target triple and "-target" to be that exact same string. >> >> Also, you're including x86_64 libraries >> (ex. -L/usr/lib/gcc/x86_64-linux-gnu/4.8/libatomic.so) to an ARM >> compilation job, that won't work. You have to find the ARM version (maybe >> /usr/lib/gcc/arm-linux-gnueabihf/ ?). >> >> Finally, the include paths with -I are only necessary if Clang cannot >> find it. The first three should be ok, but using -I on a DSO object >> (libatomic.so) makes no sense. >> >> cheers, >> --renato >> > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160425/db26f9f8/attachment.html>
李阳 via llvm-dev
2016-Apr-25 15:40 UTC
[llvm-dev] bug: cross-compile Clang/LLVM for ARM using Clang/LLVM
Hi James, renato, So how do I download the missing ARM libraries on Ubuntu14.04? I cannot find any available libraries. Best, Liyang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160425/04dfc553/attachment.html>
Apparently Analagous Threads
- bug: cross-compile Clang/LLVM for ARM using Clang/LLVM
- Problem about compiling the LLVM source code on QEMU running the aarch64?
- LLVM cross compilation for arm target
- build issue in llvm-clang cross tool chain for arm target
- Problem on cross-compiling compiler-rt