[cfe-dev] How to compile Clang for ARM Linux on x86_64 Linux?
Anton Smirnov
dev at antonsmirnov.name
Sat Sep 28 12:55:12 PDT 2013
Hey.
Executing cc and cxx in command line did not change error output:
asmirnov at vmb:~/llvm_cmake_build$ export
PATH=/home/asmirnov/llvm_host_installed/bin:$PATH
asmirnov at vmb:~/llvm_cmake_build$ CC=clang CXX=clang++ 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'
-- The CXX compiler identification is unknown
-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++
-- Check for working CXX compiler: /usr/bin/arm-linux-gnueabihf-g++ --
broken
CMake Error at /usr/share/cmake-2.8/Modules/CMakeTestCXXCompiler.cmake:54
(message):
The C++ compiler "/usr/bin/arm-linux-gnueabihf-g++" is not able to compile
a simple test program.
It fails with the following output:
Change Dir: /home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp
Run Build Command:/usr/bin/make "cmTryCompileExec1026959458/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec1026959458.dir/build.make
CMakeFiles/cmTryCompileExec1026959458.dir/build
make[1]: Entering directory
`/home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp'
/usr/bin/cmake -E cmake_progress_report
/home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp/CMakeFiles 1
Building CXX object
CMakeFiles/cmTryCompileExec1026959458.dir/testCXXCompiler.cxx.o
/usr/bin/arm-linux-gnueabihf-g++ -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 -o
CMakeFiles/cmTryCompileExec1026959458.dir/testCXXCompiler.cxx.o -c
/home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx
arm-linux-gnueabihf-g++: error: unrecognized command line option
‘-target’
arm-linux-gnueabihf-g++: error: armv7a-linux-gnueabihf: No such file or
directory
arm-linux-gnueabihf-g++: error: unrecognized command line option
‘-ccc-gcc-name’
arm-linux-gnueabihf-g++: error: arm-linux-gnueabihf-gcc: No such file or
directory
make[1]: Leaving directory
`/home/asmirnov/llvm_cmake_build/CMakeFiles/CMakeTmp'
make[1]: ***
[CMakeFiles/cmTryCompileExec1026959458.dir/testCXXCompiler.cxx.o] Error 1
make: *** [cmTryCompileExec1026959458/fast] Error 2
CMake will not be able to correctly generate this project.
What can we do?
2013/9/29 Renato Golin <renato.golin at linaro.org>
> On 28 September 2013 19:29, Anton Smirnov <dev at antonsmirnov.name> wrote:
>
>> asmirnov at vmb:~/llvm_cmake_build$ CC=clang
>> asmirnov at vmb:~/llvm_cmake_build$ CXX=clang++
>>
>
> Oh, no, you need to set them on the CMake line itself. And you may want to
> export the PATH (it's not necessary, you can use the full path on the
> CC/CXX variables):
>
> $ export PATH=/home/asmirnov/llvm_host_installed/bin:$PATH
> $ CC=clang CXX=clang++ 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'
>
> cheers,
> --renato
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130929/d0c8df4a/attachment.html>
More information about the cfe-dev
mailing list