<div dir="ltr">Hi all,<div><br></div><div>Long time fan, first time caller.</div><div><br></div><div>I'm trying to generate an arm->arm clang using the instructions here:</div><div><br></div><div><a href="http://llvm.org/docs/HowToCrossCompileLLVM.html">http://llvm.org/docs/HowToCrossCompileLLVM.html</a><br></div><div><br></div><div>I've had to make some minor modifications for my environment</div><div><br></div><div><span id="docs-internal-guid-9176a388-2d28-7c2c-fe4f-247dc5c545a0"><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">CC='clang' \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">CXX='clang++' \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">cmake -G Ninja \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">../llvm \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DCMAKE_CROSSCOMPILING=True \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DCMAKE_INSTALL_PREFIX:PATH=$ROOT_DIR/install \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DLLVM_TABLEGEN=$HOME/bin/llvm-tblgen \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DCLANG_TABLEGEN=$HOME/bin/clang-tblgen \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DLLVM_TARGET_ARCH=ARM \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DLLVM_TARGETS_TO_BUILD=ARM \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DCMAKE_CXX_FLAGS='-target arm-linux-gnueabihf -mcpu=cortex-a9 -I/usr/arm-linux-gnueabihf/include/c++/4.7.3/arm-linux-gnueabihf/ -I/usr/arm-linux-gnueabihf/include/c++/4.7.3/ -I/usr/arm-linux-gnueabihf/include/ -mfloat-abi=hard -ccc-gcc-name arm-linux-gnueabihf-gcc-4.7' \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DCMAKE_BUILD_TYPE=Release \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-DLLVM_ENABLE_PIC=False \</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-Wno-dev</span></p><div><span><br></span></div><div><span>I've tried clang 3.5, clang tot</span></div><div><span>I've tried </span><span style="font-size:13px;color:rgb(0,0,0);font-family:Arial;line-height:15.7815275192261px;white-space:pre-wrap">arm-linux-gnueabihf 4.7.3 (ubuntu) and 4.9.2 (Linaro)<br></span><br></div><div>I'm getting this error:</div></span></div><div><span><br><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-- Performing Test LLVM_NO_OLD_LIBSTDCXX</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">-- Performing Test LLVM_NO_OLD_LIBSTDCXX - Failed</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">CMake Error at cmake/modules/HandleLLVMOptions.cmake:38 (message):</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">  Host Clang must be able to find libstdc++4.7 or newer!</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">Call Stack (most recent call first):</span></p><p dir="ltr" style="line-height:1.21396363865245;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:transparent">  CMakeLists.txt:339 (include)</span></p><br></span></div><div><span>Checking into the cmake logs, it's trying to compile this program, which I can build just fine:</span></div><div><span><br></span></div><div><span><div>vharron@tifa:~/ll/cross/build$ cat test.cpp</div><div>#include <atomic></div><div>std::atomic<float> x(0.0f);</div><div>int main() { return (float)x; }</div><div><br></div><div>vharron@tifa:~/ll/cross/build$ clang++ -std=c++0x test.cpp -target arm-linux-gnueabihf -mcpu=cortex-a9 -I/usr/arm-linux-gnueabihf/include/c++/4.7.3/arm-linux-gnueabihf/ -I/usr/arm-linux-gnueabihf/include/c++/4.7.3/ -I/usr/arm-linux-gnueabihf/include/ -mfloat-abi=hard -ccc-gcc-name arm-linux-gnueabihf-gcc-4.7<br></div><div><br></div><div>vharron@tifa:~/ll/cross/build$ file a.out</div><div>a.out: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=c998b71c4d3a063e0f8804f24b47303455318cf2, not stripped</div><div><br></div></span></div><div><br></div><div>The docs for check_cxx_source_compiles</div><div><a href="http://www.cmake.org/cmake/help/v3.0/module/CheckCXXSourceCompiles.html">http://www.cmake.org/cmake/help/v3.0/module/CheckCXXSourceCompiles.html</a><br></div><div>say that you can modify the way check is run by setting CMAKE_REQUIRED_FLAGS</div><div>so I tried that, but it didn't help.  </div><div><br></div><div>How can I figure out what command line check_cxx_source_compiles is using?</div><div><br></div><div><div>diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake</div><div>index 2ee0dd5..c949f5d 100644</div><div>--- a/cmake/modules/HandleLLVMOptions.cmake</div><div>+++ b/cmake/modules/HandleLLVMOptions.cmake</div><div>@@ -28,7 +28,8 @@ if(NOT LLVM_FORCE_USE_OLD_TOOLCHAIN)</div><div>     if(NOT LLVM_ENABLE_LIBCXX)</div><div>       set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})</div><div>       set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})</div><div>-      set(CMAKE_REQUIRED_FLAGS "-std=c++0x")</div><div>+      set(CMAKE_REQUIRED_FLAGS "-std=c++0x " ${CMAKE_CXX_FLAGS} )</div><div>+      message( CMAKE_REQUIRED_FLAGS = ${CMAKE_REQUIRED_FLAGS} )</div><div>       check_cxx_source_compiles("</div><div> #include <atomic></div><div> std::atomic<float> x(0.0f);</div></div><div><br></div><div>There are several more check_cxx_source_compiles failures.  I can get past them if I hack them all out but I'm looking for the "right" way.</div><div><br></div><div>Thanks,</div><div><br></div><div>Vince</div><div><br></div><div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><br><table cellspacing="0" cellpadding="0" style="font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Vince Harron |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Technical Lead Manager |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:vharron@google.com" target="_blank">vharron@google.com</a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"> 858-442-0868</td></tr></tbody></table><br></div></div>
</div></div>