[llvm-dev] build issue in llvm-clang cross tool chain for arm target

712 views
Skip to first unread message

Balasaheb Dabhade via llvm-dev

unread,
May 6, 2016, 1:28:11 PM5/6/16
to llvm...@lists.llvm.org
Hello All,

I am building llvm-clang cross tool chain for arm target, after successful build for Linux host now I am now building toolchain for arm target. However, I am getting below error message which seems to be confusing and not getting any idea how to resolve this issue.

Command :
#CC='clang' CXX='clang++' cmake -G Ninja /home/iiita/crossbuild/llvm -DLLVM_ENABLE_LIBCXX=ON -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=/home/iiita/crossbuild/build -DLLVM_TABLEGEN=/home/iiita/llvm-3.8/build/bin/llvm-tblgen -DCLANG_TABLEGEN=/home/iiita/llvm-3.8/build/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/ -mfloat-abi=hard -ccc-gcc-name arm-linux-gnueabihf-gcc'

Error message:
CMake Error at cmake/modules/CheckAtomic.cmake:33 (message):
  Host compiler must support std::atomic!
Call Stack (most recent call first):
  cmake/config-ix.cmake:296 (include)
  CMakeLists.txt:407 (include)


-- Configuring incomplete, errors occurred!
See also "/home/iiita/crossbuild/build/CMakeFiles/CMakeOutput.log".
See also "/home/iiita/crossbuild/build/CMakeFiles/CMakeError.log".


Does anyone know how to resolve this issue or any other way to build tool chain for arm from source code?

Thanks,
Bala


CMakeError.log

Renato Golin via llvm-dev

unread,
May 6, 2016, 2:50:48 PM5/6/16
to Balasaheb Dabhade, LLVM Dev
On 6 May 2016 at 18:28, Balasaheb Dabhade via llvm-dev

<llvm...@lists.llvm.org> wrote:
> Error message:
> CMake Error at cmake/modules/CheckAtomic.cmake:33 (message):
> Host compiler must support std::atomic!

Hi,

It's possible that you don't have the required ARM libraries in your system?

cheers,
--renato
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

Renato Golin via llvm-dev

unread,
May 8, 2016, 10:22:19 AM5/8/16
to Balasaheb Dabhade, LLVM Dev
On 6 May 2016 at 18:28, Balasaheb Dabhade via llvm-dev
<llvm...@lists.llvm.org> wrote:
> -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/ -mfloat-abi=hard -ccc-gcc-name
> arm-linux-gnueabihf-gcc'

I can think of two things:

1. You're using a triple that is different from your gcc name:

'-target armv7a-linux-gnueabihf'

vs

'-ccc-gcc-name arm-linux-gnueabihf-gcc'

You should use the target as "arm-linux-gnueabihf".

2. You're not including the GCC headers or libraries.

You need to find where GCC keeps its libraries (normally
/usr/lib/gcc/arm-linux-gnueabihf) and headers (if necessary).

In your case, just adding -L"where your gcc libs are" should be enough.

Balasaheb Dabhade via llvm-dev

unread,
May 8, 2016, 11:18:43 AM5/8/16
to Renato Golin, LLVM Dev
Thanks a lot  Renoto,

I really appreciate your help.

As you mentioned I have modified the command to include gcc libs path(-L ) option in cmake command as below :

cmake -G Ninja /home/iiita/crossbuild/llvm -DLLVM_ENABLE_PIC=False -DLLVM_ENABLE_LIBCXX=ON -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=/home/iiita/crossbuild/build -DLLVM_TABLEGEN=/home/iiita/llvm-3.8/build/bin/llvm-tblgen -DCLANG_TABLEGEN=/home/iiita/llvm-3.8/build/bin/clang-tblgen -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DCMAKE_CXX_FLAGS='-target arm-linux-gnueabihf-gcc -mcpu=cortex-a9 -I/usr/arm-linux-gnueabihf/include/c++/4.7.3/arm-linux-gnueabihf/ -I/usr/arm-linux-gnueabihf/include/ -L/usr/lib/gcc/arm-linux-gnueabihf -mfloat-abi=hard -ccc-gcc-name arm-linux-gnueabihf-gcc'

However, I am still facing the issue since cmake not able to find header file path as per CMakeError.log (attached for email for reference) error message

Do you have any idea about how to include header file path in cmake command line or is there any other thing I am missing?


Thanks,
Bala

 
CMakeError.log

Renato Golin via llvm-dev

unread,
May 9, 2016, 6:25:57 AM5/9/16
to Balasaheb Dabhade, LLVM Dev
On 8 May 2016 at 16:18, Balasaheb Dabhade <dabhadeb...@gmail.com> wrote:
> However, I am still facing the issue since cmake not able to find header
> file path as per CMakeError.log (attached for email for reference) error
> message.

From the log, it seems to me you're missing the correct include path somewhere.

The easiest way is to use "find /usr -name <header>" and then use the
directory that is the base for <header>.

Also, I couldn't find anywhere in my system (including ARM and AArch64
directories) the following headers:

* malloc/malloc.h (my malloc.h is directly that the include path, ie,
no "malloc/")
* ndir.h / sys/ndir.h / mach/mach.h / mach-o/dyld.h / histedit.h
(seems to be Apple specific?)

If you're moving your source from Apple to Linux you *will* need to
make it portable, and that includes choosing headers, defining macros,
etc.

I *did* find:

* cxxabi.h (it was directly on the include path, at
/usr/arm-none-eabi/include/c++/5.3.0/cxxabi.h, but you may have to add
that to -I)
* valgrind/valgrind.h (but only on my x86 include path, you may have
to install valgrind-dev:armhf)

Also, the error:

/usr/bin/ld: cannot find -lz

shows me that you don't have Zlib installed, you'll need that.

Reply all
Reply to author
Forward
0 new messages