<div dir="ltr"><p class="MsoNormal" style="box-sizing:border-box;margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;color:rgb(33,33,33)"><span lang="EN-US" style="box-sizing:border-box;font-family:等线;color:rgb(31,73,125);font-size:11pt">I can get llvm source code and the information “cross-compiling from x86_64 to ARM” from <a href="https://llvm.org/docs/HowToCrossCompileLLVM.html" style="box-sizing:border-box;background-color:transparent;color:rgb(5,99,193)">https://llvm.org/docs/HowToCrossCompileLLVM.html</a>. However, I still fail to build clang for ARM. It is strange, I have already set a target with "</span><span style="color:rgb(51,51,51);font-family:Lato;font-size:14.6667px;background-color:rgb(247,247,247)"> </span><span style="box-sizing:border-box;font-weight:700;font-size:14.6667px;background-color:rgb(247,247,247);font-family:宋体"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">  <span style="box-sizing:border-box;color:rgb(255,0,0)">-target arm-linux-gnueabihf </span></span></font></span><span style="color:rgb(51,51,51);font-family:Lato;font-size:14.6667px;background-color:rgb(247,247,247)"> "  .  I am describing the failure progress as below. Expecting any idea.</span></p><div style="box-sizing:border-box;color:rgb(51,51,51);font-family:Lato;font-size:15px;background-color:rgb(247,247,247)"><span lang="EN-US" style="box-sizing:border-box;font-family:等线;color:rgb(31,73,125);font-size:11pt"></span></div><p style="box-sizing:border-box;margin:0px;color:rgb(51,51,51);font-family:Lato;font-size:15px;background-color:rgb(247,247,247)"><span style="box-sizing:border-box;font-size:11pt"><br style="box-sizing:border-box"></span></p><div dir="ltr" style="box-sizing:border-box;font-size:12pt;color:rgb(0,0,0);font-family:Calibri,Arial,Helvetica,sans-serif"><div style="box-sizing:border-box"><div dir="ltr" style="box-sizing:border-box;font-size:12pt"><div style="box-sizing:border-box"><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt"><br style="box-sizing:border-box"></span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">The build steps:<br style="box-sizing:border-box"></span></div><div style="box-sizing:border-box;color:rgb(33,33,33);font-family:"Segoe UI","Segoe WP","Segoe UI WPC",Tahoma,Arial,sans-serif;margin:14pt 0px"><span style="box-sizing:border-box;font-size:11pt"><font face="宋体" style="box-sizing:border-box"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">cd llvm-project</span></font></span></font></span></div><div style="box-sizing:border-box;color:rgb(33,33,33);font-family:"Segoe UI","Segoe WP","Segoe UI WPC",Tahoma,Arial,sans-serif;margin:14pt 0px"><div style="box-sizing:border-box;margin:14pt 0px"><font face="宋体" style="box-sizing:border-box;font-size:11pt"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">mkdir build</span></font></span></font></div><div style="box-sizing:border-box;margin:14pt 0px"><font face="宋体" style="box-sizing:border-box;font-size:11pt"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">cd build</span></font></span></font></div><div style="box-sizing:border-box;margin:14pt 0px"><font face="宋体" style="box-sizing:border-box;font-size:11pt"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">cmake -DLLVM_ENABLE_PROJECTS=clang -G "Unix <span style="box-sizing:border-box;font-weight:700;color:rgb(33,33,33);font-family:宋体"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">Makefiles</span></font></span>"</span></font></span></font></div><div style="box-sizing:border-box;margin:14pt 0px"><font face="宋体" style="box-sizing:border-box;font-size:11pt"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">make</span></font></span></font></div><div style="box-sizing:border-box;margin:14pt 0px"><font face="宋体" style="box-sizing:border-box;color:rgb(75,165,36);font-size:11pt"><span style="box-sizing:border-box"><span style="box-sizing:border-box;font-weight:700"><font face="等线" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal"><span style="box-sizing:border-box">// After I built host llvm-tblgen  and clang-tblgen, I begin to return to build arm target clang as below steps:</span></span></font></span></span></font></div><div style="box-sizing:border-box;margin:14pt 0px"><font face="宋体" style="box-sizing:border-box;font-size:11pt"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">cd ..</span></font></span></font></div><span style="box-sizing:border-box;font-weight:700;font-family:宋体;font-size:11pt"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">mkdir build_arm_onx86</span></font></span></div><div style="box-sizing:border-box;color:rgb(33,33,33);font-family:"Segoe UI","Segoe WP","Segoe UI WPC",Tahoma,Arial,sans-serif;margin:14pt 0px"><span style="box-sizing:border-box;font-size:11pt"><font face="宋体" style="box-sizing:border-box"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">cd build_arm_onx86</span></font></span></font></span></div><div style="box-sizing:border-box;color:rgb(33,33,33);font-family:"Segoe UI","Segoe WP","Segoe UI WPC",Tahoma,Arial,sans-serif;margin:14pt 0px"><span style="box-sizing:border-box;font-size:11pt"><font face="宋体" style="box-sizing:border-box"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">mkdir stall_prefix</span></font></span></font></span></div><div style="box-sizing:border-box;color:rgb(33,33,33);font-family:"Segoe UI","Segoe WP","Segoe UI WPC",Tahoma,Arial,sans-serif;margin:14pt 0px"><span style="box-sizing:border-box;font-size:11pt"><font face="宋体" style="box-sizing:border-box"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">cmake -G "Unix Makefiles" -DCMAKE_CROSSCOMPILING=True  -DCMAKE_INSTALL_PREFIX=./stall_prefix  -DLLVM_TABLEGEN=/home_2t/workspace/llvm_clang/llvm-project/build/bin/llvm-tblgen -DCLANG_TABLEGEN=/home_2t/workspace/llvm_clang/llvm-project/build/bin/clang-tblgen -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM  <span style="box-sizing:border-box;color:rgb(255,0,0)">-target arm-linux-gnueabihf </span> -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi"  ../llvm    2>&1 | tee out_cofiguration.txt</span></font><font face="MS Gothic" color="#1F497D" style="box-sizing:border-box"><span style="box-sizing:border-box;font-weight:normal"></span></font></span></font></span></div><div style="box-sizing:border-box;color:rgb(33,33,33);font-family:"Segoe UI","Segoe WP","Segoe UI WPC",Tahoma,Arial,sans-serif;margin:14pt 0px"><span style="box-sizing:border-box;font-size:11pt"><font face="宋体" style="box-sizing:border-box"><span style="box-sizing:border-box;font-weight:700"><font face="等线" color="#1F497D" style="box-sizing:border-box"><span lang="en-US" style="box-sizing:border-box;font-weight:normal">make  2>&1 | tee out_make.txt</span></font></span></font></span></div><p style="box-sizing:border-box;margin:0px"><span style="box-sizing:border-box;font-size:11pt">The result:<br style="box-sizing:border-box"></span></p><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">build_arm_onx86$ file bin/clang-12</span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">bin/clang-12: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=3b669c10e300bb5d9bb96cfb77f927ce95728ca6, not stripped</span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt"><br style="box-sizing:border-box"></span></div><div style="box-sizing:border-box"><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">build_arm_onx86$ bin/clang --version</span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">clang version 12.0.0 (<a href="https://github.com/llvm/llvm-project.git">https://github.com/llvm/llvm-project.git</a> 3948341fa5fab2695b0df95edc248fe959e40664)</span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">Target:<span style="box-sizing:border-box;color:rgb(255,0,0)"> x86_64-unknown-linux-gnu</span><br style="box-sizing:border-box"></span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">Thread model: posix</span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">InstalledDir: /home_2t/workspace/llvm_clang/llvm-project/build_arm_onx86/bin</span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt"><br style="box-sizing:border-box">Seems it failed from the configuration as attached cmake output log.<br style="box-sizing:border-box"></span></div><div style="box-sizing:border-box"><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">-- LLVM host triple: <span style="box-sizing:border-box;color:rgb(255,0,0)">x86_64-unknown-linux-gnu</span><br style="box-sizing:border-box;color:rgb(255,0,0)"></span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;color:rgb(255,0,0);font-size:11pt">-- LLVM default target triple: x86_64-unknown-linux-gnu</span></div><div style="box-sizing:border-box"><br style="box-sizing:border-box;font-size:11pt"></div></div><div style="box-sizing:border-box"><br style="box-sizing:border-box;font-size:11pt"></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">Thanks in advance</span></div><span style="box-sizing:border-box;font-size:11pt"></span><br style="box-sizing:border-box;font-size:11pt"><span style="box-sizing:border-box;font-size:11pt"></span><br style="box-sizing:border-box;font-size:11pt"><span style="box-sizing:border-box;font-size:11pt"></span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">Best Regards,</span></div><div style="box-sizing:border-box"><span style="box-sizing:border-box;font-size:11pt">Andy</span></div></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 13, 2020 at 7:32 PM Dongdong Yang <<a href="mailto:contribute.kernel@gmail.com">contribute.kernel@gmail.com</a>> wrote:<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">May I ask how to build clang for arm on x86 linux ubuntu box? And how to use  <span style="color:rgb(31,35,41);font-family:"Helvetica Neue",Tahoma,"PingFang SC","Microsoft Yahei",Arial,"Hiragino Sans GB",sans-serif;font-size:14px;white-space:pre-wrap;background-color:rgb(245,246,247)">sysroot</span>  to cross compile clang  <span style="color:rgb(31,35,41);font-family:"Helvetica Neue",Tahoma,"PingFang SC","Microsoft Yahei",Arial,"Hiragino Sans GB",sans-serif;font-size:14px;white-space:pre-wrap;background-color:rgb(245,246,247)">libc++</span>  for arm on x86 linux?   Appreciate any guidance. <div><br></div><div>Thanks,</div><div>Andy</div></div>
</blockquote></div>