LLVM cross compilation for arm target

Hello All,

I am building llvm-clang tool chain for arm target by following the steps from

http://clang.llvm.org/docs/CrossCompilation.html

However when I tried following cmake command for build tool chain it gives the error message :

#CC=‘clang’ CXX=‘clang++’ cmake -G Ninja /home/iiita/llvm-exp/llvm -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=/home/iiita/llvm-exp/llvm/build -DLLVM_TABLEGEN=/usr/bin/host/llvm-tblgen -DCLANG_TABLEGEN=/usr/bin/host/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.1/arm-linux-gnueabihf/ -I/usr/arm-linux-gnueabihf/include/ -mfloat-abi=hard -ccc-gcc-name arm-linux-gnueabihf-gcc’

error :

CMake Error at cmake/modules/CheckCompilerVersion.cmake:38 (message):
Host Clang must be able to find libstdc++4.7 or newer!
Call Stack (most recent call first):
cmake/config-ix.cmake:14 (include)
CMakeLists.txt:412 (include)

I have installed libstdc++4.7-dev library but still same issue is coming.

Does anyone know how to resolve this issue?

Thanks,

Bala

Hi Bala,

Without more information it’ll be difficult to debug. What I would do is look at the CMake error log file. That will tell you the exact program it tried to run to determine if the host compiler could find libstdc++, and the error it got. From there, it should be easier to determine what the actual problem was.

Cheers,

James

Thanks James for your help!!

libstdc++4.7 issue has been been resolved after adding -DLLVM_ENABLE_LIBCXX=ON option in cmake commands but it now it showing below error :

Error :
Host compiler must support std::atomic!
Call Stack (most recent call first):
cmake/config-ix.cmake:301 (include)
CMakeLists.txt:412 (include)

Does anyone know how to resolve this issue?

Thanks,

Bala