<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Lei,<div class=""><br class=""></div><div class="">The issues that you’re reporting here are on my mind.</div><div class=""><br class=""></div><div class="">I have a patch out for review now (<a href="http://reviews.llvm.org/D19742" class="">http://reviews.llvm.org/D19742</a>) that allows building builtins without a full toolchain.</div><div class=""><br class=""></div><div class="">One of the next steps after this is to support alternate sysroots for different targets, and to identify builtins that need target headers so that they can be excluded in cases where target headers are not available. We can drive that all with compiler tests so that it is seamless to the user.</div><div class=""><br class=""></div><div class="">We will also be working on ways of specifying lists of targets to the LLVM/Clang build so that you won’t need to set COMPILER_RT_DEFAULT_TARGET_ARCH, and so that you can easily build for multiple targets while you build clang.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">-Chris</div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 3, 2016, at 7:24 PM, 王磊 <<a href="mailto:wanglei@ia.ac.cn" class="">wanglei@ia.ac.cn</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">I finally solved my problem. Chris's suggestion helps much, but there are still a few problems to build cross platform compiler-rt.<div class="">-DLLVM_BUILD_EXTERNAL_COMPILER_RT=On -> This is valid and required to force compiler-rt to be built by the just-built clang.</div><div class="">-DCOMPILER_RT_DEFAULT_TARGET_ARCH= -> This does not work, but -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE works.</div><div class="">While using there two additional options, I still got errors. The build system successfully configured and built clang/LLVM but failed to configure compiler-rt due to the clang checking in compiler-rt's Cmake system.</div><div class="">I add x86 into LLVM_TARGET_ARCH, and this helps the just-built clang pass the CMake check, but failed in another checking which is invoked by test_target_arch. The test_target_arch is used to setup flags used for building compiler-rt, but it uses try_compile() function, which compiles a simple test code using libraries and invokes linker and linker scripts, flags, etc.. Without compiler-rt, clang will, of course, fails to link programs. However, compiler-rt does not need clang to link. I forced try_compile() successful, and everything goes smoothly. Inconveniently, I have to use clang integrated an spare x86 target.</div><div class="">Moreover, in compiler-rt's built-in library, there are some emulating (?) libraries, such as emutls and eprintf, that are using host system header files, which may potentially cause compatible problem. I'm not sure if they should be included in GENERIC_SOURCES.</div><div class="">I hope this information could help the cross-compiling of compiler-rt.</div><div class="">Thank you. Thanks, Chris and yanglee.</div><div class=""><br class=""></div><div class="">Lei</div><div class=""><br class=""><blockquote name="replyContent" style="padding-left:5px;margin-left:5px;border-left:#b6b6b6 2px solid;margin-right:0" class="">-----Original Messages-----<br class="">
<b class="">From:</b> "Chris Bieneman" <<a href="mailto:beanz@apple.com" class="">beanz@apple.com</a>><br class="">
<b class="">Sent Time:</b> Wednesday, May 4, 2016<br class="">
<b class="">To:</b> "李阳" <<a href="mailto:yanglee.cqu@gmail.com" class="">yanglee.cqu@gmail.com</a>><br class="">
<b class="">Cc:</b> "王磊" <<a href="mailto:wanglei@ia.ac.cn" class="">wanglei@ia.ac.cn</a>>, "LLVM Dev" <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>><br class="">
<b class="">Subject:</b> Re: [llvm-dev] Problem on cross-compiling compiler-rt<br class=""><br class=""><div class="">This is currently a rough area in our build system, but there are two CMake options you probably need to set.</div><div class=""><br class=""></div><div class="">(1) -DLLVM_BUILD_EXTERNAL_COMPILER_RT=On —> This option causes the build to use the just-built clang when building compiler-rt</div><div class="">(2) -DCOMPILER_RT_DEFAULT_TARGET_ARCH=??? —> This is where you specify which architecture you want to build the compiler-rt archives and libraries for</div><div class=""><br class=""></div><div class="">Hopefully in the near future we’ll have a better story for building this functionality.</div><div class=""><br class=""></div><div class="">Hope this helps,</div><div class="">-Chris</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On May 3, 2016, at 12:09 AM, 李阳 via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi WangLei,<div class=""><br class=""></div><div class="">Do you mean that the version 3.9 is LLVM project 3.9 and 3.5 is CMake 3.5?</div><div class=""><br class=""></div><div class="">In the guide[GetStarted.rst], the tutorial says before running CMake command, you must checkout all the source code. CMake does not pickup newly added source directories in incremental builds.</div><div class=""><br class=""></div><div class="">Have you cross-compiled the LLVM/Clang for ARM, or other successfully?</div><div class=""><br class=""></div><div class="">Cheers,</div><div class="">Liyang </div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">2016-05-03 14:42 GMT+08:00 王磊 via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span>:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="">Hi.<div class="">I'm trying to use Clang/LLVM as a cross-compiling toolchain. In previous version of LLVM with the old configure/Makefile building system, I'm able to build Clang/LLVM for target architecture with the host GCC firstly and then use the generated cross compiler to compile the compiler-rt project, and, consequently, I can get a cross compiler as well as the compiler-rt library. However, when I move to version 3.9 which abandoned configure/Makefile and uses CMake now, it always compile the compiler-rt simultaneously with the host GCC. The same problem is also existing in 3.5 CMake building system. It seems that in the CMake building system compiler-rt is not dependent on the generated toolchain. I also tried to compile the compiler-rt after Clang/LLVM has been built, and there is another problem that the generated Clang/LLVM cannot pass the CMake checking without compiler-rt, which is obvious... So is there any way that I can solve this problem. Thank you.</div><div class=""><br class=""></div><div class="">Lei Wang</div><div class=""><br class=""><br class=""><span class=""></span><div class=""><div class=""><span class=""></span><a title="发音" class="" target="_blank"></a><u class=""></u><u class=""></u><div class=""><a title="加入单词表" class="" target="_blank"></a><a title="移出单词表" class="" target="_blank"></a><a href="x-msg://106/#m_-2483977491504695984_" title="查看单词详细释义" class="" target="_blank"></a><a title="关闭查询窗" class="" target="_blank"></a></div><br style="clear:both" class=""></div><div class=""></div></div></div><br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="" target="_blank">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="" target="_blank">llvm-dev@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class=""></div></blockquote></div><br class=""></blockquote><br class=""><span class=""></span></div><iframe id="tmp_downloadhelper_iframe" style="display: none;" class=""></iframe><br class=""><br class=""><br class=""></div></blockquote></div><br class=""></div></body></html>