<div dir="ltr"><br><div class="gmail_extra">Hey. i've tried both options.<br></div><div class="gmail_extra">Unfortunately none of them works.<br></div><div class="gmail_extra">I will add detailed information below each of it.<br>
</div><div class="gmail_extra"><br><div class="gmail_quote">2013/9/28 Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div class="im">On 28 September 2013 04:20, Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span> wrote:<br></div><div class="gmail_extra">
<div class="gmail_quote"><div class="im">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div>Then configure and getting an error:<br>
</div></div><div>/usr/bin/c++ -target armv7a-linux-gnueabihf -mcpu=cortex-a9<br>
  -I/usr/arm-linux-gnueabihf/include/c++/4.7.3/arm-linux-gnueabihf/<br>  -I/usr/arm-linux-gnueabihf/include/ -mfloat-abi=hard -ccc-gcc-name<br>  arm-linux-gnueabihf-gcc -o<br>  CMakeFiles/cmTryCompileExec1473115348.dir/testCXXCompiler.cxx.o -c<br>


  /home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx<br></div></div></blockquote><div><br></div></div><div>Yes, it's choosing the system compiler, which is clearly wrong.</div><div><br></div><div>
Since you should have "arm-linux-gnueabihf-gcc" on your path, I believe the CMake variable "LLVM_DEFAULT_TARGET_TRIPLE" doesn't work in the way I thought it would, in which case you'd have to force CC and CXX. During my examples, I was mainly using Clang to cross-compile, so I may have skipped a few steps to compile with GCC, in which case I'll have to fix the docs accordingly.</div>

<div><br></div><div>You have two options now:</div><div> 1. Fully compile Clang+LLVM to your host platform and use "CC=clang CXX=clang++ cmake ... " to configure your directory.</div></div></div></div></blockquote>
<div><br></div><div>both clang and clang++ compiled for host are on path and working:<br><br>asmirnov@vmb:~/llvm_cmake_build$ CC=clang<br>asmirnov@vmb:~/llvm_cmake_build$ CXX=clang++<br>asmirnov@vmb:~/llvm_cmake_build$ PATH=/home/asmirnov/llvm_host_installed/bin:$PATH<br>
asmirnov@vmb:~/llvm_cmake_build$ clang<br>clang: error: no input files<br>asmirnov@vmb:~/llvm_cmake_build$ clang++<br>clang: error: no input files<br>asmirnov@vmb:~/llvm_cmake_build$ <br><br></div><div>But they are not able to configure using documented cmake:<br>
<br>asmirnov@vmb:~/llvm_cmake_build$ cmake ../llvm -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=/home/asmirnov/llvm_cmake_installed -DLLVM_TABLEGEN=/home/asmirnov/llvm_host_build/Release+Asserts/bin/llvm-tblgen -DCLANG_TABLEGEN=/home/asmirnov/llvm_host_build/Release+Asserts/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'<br>
-- The CXX compiler identification is unknown<br>-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++<br>-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++ -- broken<br>CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54 (message):<br>
  The C++ compiler "/usr/bin/arm-linux-gnueabihf-g++" is not able to compile<br>  a simple test program.<br><br>  It fails with the following output:<br><br>   Change Dir: /home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp<br>
<br>  <br><br>  Run Build Command:/usr/bin/make "cmTryCompileExec3118678986/fast"<br><br>  /usr/bin/make -f CMakeFiles/cmTryCompileExec3118678986.dir/build.make<br>  CMakeFiles/cmTryCompileExec3118678986.dir/build<br>
<br>  make[1]: Entering directory<br>  `/home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp'<br><br>  /usr/bin/cmake -E cmake_progress_report<br>  /home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp/CMakeFiles 1<br><br>
  Building CXX object<br>  CMakeFiles/cmTryCompileExec3118678986.dir/testCXXCompiler.cxx.o<br><br>  /usr/bin/arm-linux-gnueabihf-g++ -target armv7a-linux-gnueabihf<br>  -mcpu=cortex-a9<br>  -I/usr/arm-linux-gnueabihf/include/c++/4.7.3/arm-linux-gnueabihf/<br>
  -I/usr/arm-linux-gnueabihf/include/ -mfloat-abi=hard -ccc-gcc-name<br>  arm-linux-gnueabihf-gcc -o<br>  CMakeFiles/cmTryCompileExec3118678986.dir/testCXXCompiler.cxx.o -c<br>  /home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx<br>
<br>  arm-linux-gnueabihf-g++: error: unrecognized command line option<br>  ‘-target’<br><br>  arm-linux-gnueabihf-g++: error: armv7a-linux-gnueabihf: No such file or<br>  directory<br><br>  arm-linux-gnueabihf-g++: error: unrecognized command line option<br>
  ‘-ccc-gcc-name’<br><br>  arm-linux-gnueabihf-g++: error: arm-linux-gnueabihf-gcc: No such file or<br>  directory<br><br>  make[1]: Leaving directory<br>  `/home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp'<br><br>
  make[1]: ***<br>  [CMakeFiles/cmTryCompileExec3118678986.dir/testCXXCompiler.cxx.o] Error 1<br><br>  make: *** [cmTryCompileExec3118678986/fast] Error 2<br><br>  <br><br>  <br><br>  CMake will not be able to correctly generate this project.<br>
Call Stack (most recent call first):<br>  CMakeLists.txt:3 (project)<br><br><br>-- Configuring incomplete, errors occurred!<br><br></div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> 2. Use "CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ cmake ... ", and if that works, I'll update the docs to say it's required.</div>
</div></div></div></blockquote><div><br>asmirnov@vmb:~/llvm_cmake_build$ CC=arm-linux-gnueabihf-gcc<br>asmirnov@vmb:~/llvm_cmake_build$ CXX=arm-linux-gnueabihf-g++<br>asmirnov@vmb:~/llvm_cmake_build$ cmake ../llvm -DCMAKE_CROSSCOMPILING=True -DCMAKE_INSTALL_PREFIX=/home/asmirnov/llvm_cmake_installed -DLLVM_TABLEGEN=/home/asmirnov/llvm_host_build/Release+Asserts/bin/llvm-tblgen -DCLANG_TABLEGEN=/home/asmirnov/llvm_host_build/Release+Asserts/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'<br>
-- The CXX compiler identification is unknown<br>-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++<br>-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++ -- broken<br>CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54 (message):<br>
  The C++ compiler "/usr/bin/arm-linux-gnueabihf-g++" is not able to compile<br>  a simple test program.<br><br>  It fails with the following output:<br><br>   Change Dir: /home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp<br>
<br>  <br><br>  Run Build Command:/usr/bin/make "cmTryCompileExec2487419787/fast"<br><br>  /usr/bin/make -f CMakeFiles/cmTryCompileExec2487419787.dir/build.make<br>  CMakeFiles/cmTryCompileExec2487419787.dir/build<br>
<br>  make[1]: Entering directory<br>  `/home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp'<br><br>  /usr/bin/cmake -E cmake_progress_report<br>  /home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp/CMakeFiles 1<br><br>
  Building CXX object<br>  CMakeFiles/cmTryCompileExec2487419787.dir/testCXXCompiler.cxx.o<br><br>  /usr/bin/arm-linux-gnueabihf-g++ -target armv7a-linux-gnueabihf<br>  -mcpu=cortex-a9<br>  -I/usr/arm-linux-gnueabihf/include/c++/4.7.3/arm-linux-gnueabihf/<br>
  -I/usr/arm-linux-gnueabihf/include/ -mfloat-abi=hard -ccc-gcc-name<br>  arm-linux-gnueabihf-gcc -o<br>  CMakeFiles/cmTryCompileExec2487419787.dir/testCXXCompiler.cxx.o -c<br>  /home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx<br>
<br>  arm-linux-gnueabihf-g++: error: unrecognized command line option<br>  ‘-target’<br><br>  arm-linux-gnueabihf-g++: error: armv7a-linux-gnueabihf: No such file or<br>  directory<br><br>  arm-linux-gnueabihf-g++: error: unrecognized command line option<br>
  ‘-ccc-gcc-name’<br><br>  arm-linux-gnueabihf-g++: error: arm-linux-gnueabihf-gcc: No such file or<br>  directory<br><br>  make[1]: Leaving directory<br>  `/home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp'<br><br>
  make[1]: ***<br>  [CMakeFiles/cmTryCompileExec2487419787.dir/testCXXCompiler.cxx.o] Error 1<br><br>  make: *** [cmTryCompileExec2487419787/fast] Error 2<br><br>  <br><br>  <br><br>  CMake will not be able to correctly generate this project.<br>
Call Stack (most recent call first):<br>  CMakeLists.txt:3 (project)<br><br><br>-- Configuring incomplete, errors occurred!<br><br></div><div>In both cases g++ is targeted to compile for ARM and of coarse it fails to check compilation possibility for host (as far as i understand the output). It seems that this checking should be skipped because cross compilation flag is set. Or i don't understand why it fails indeed.<br>
</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div><br></div><div>cheers,</div><div>--renato</div></div></div></div></blockquote><div><br></div><div>Thanks for suggestions, Renato.<br></div><div>I understand that's a little difficult to fix it in such way, but i agree<br>
to do all you suggest in order to compile clang for ARM finally. <br></div></div><br></div></div>