<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>The CrossCompile module is in a perpetual state of "when I get a chance...", and desperately needs some cleanup.</div><div><br></div><div>The problem you are hitting is caused by setting CMAKE_SYSTEM_NAME. When you set that CMake sets a variable CMAKE_CROSS_COMPILING. That variable should only be set when your host OS doesn't match your target OS. Since LLVM needs to build host-capable tools there is some goop to call out and configure a new CMake build directory to target the host.</div><div><br><div>-Chris</div></div><div><br>On Feb 10, 2016, at 6:20 AM, Mike Edwards <<a href="mailto:mike@sqlby.me">mike@sqlby.me</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi Tony,<div>I don't have experience with your specific circumstance, so sorry I can't be much help there.  Thank you though for pointing out what appears to be a typo.  CC'ing Chris Bieneman as he may be able to verify if this is correct.</div><div><br></div><div>Chris,</div><div>I have attached a patch which should fix the typo.  Would you mind having a look and committing if you think it is all good?</div><div><br></div><div>Hope you both have a good day.</div><div><br></div><div>Thanks,</div><div>Mike Edwards</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 9, 2016 at 8:21 PM, Tony Kelman via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I need to build libLLVM (individual static libraries are fine at the<br>
moment) using mingw-w64 cross compilers, i686-w64-mingw32-gcc and<br>
(separately) x86_64-w64-mingw32-gcc. I'd like this to work from both<br>
Linux and Cygwin build environments. With autotools, this worked fine:<br>
../configure --host=i686-w64-mingw32 and that's it (with mingw32-gcc-c++<br>
installed on Fedora 23, also works fine on Ubuntu, Cygwin, etc).<br>
I'm trying to recreate this with cmake so we don't get stuck on 3.8<br>
indefinitely. Here's what I've got so far:<br>
<br>
cmake .. -DCMAKE_C_COMPILER=/usr/bin/i686-w64-mingw32-gcc \<br>
  -DCMAKE_CXX_COMPILER=/usr/bin/i686-w64-mingw32-g++ \<br>
  -DCMAKE_SYSTEM_NAME=Windows \<br>
  -DCMAKE_RC_COMPILER=/usr/bin/i686-w64-mingw32-windres<br>
# (some older versions of cmake have issues if you don't<br>
# specify an absolute path to windres)<br>
<br>
When this gets to "Configuring NATIVE targets" it calls cmake again<br>
trying to use the same mingw compilers, but without CMAKE_SYSTEM_NAME<br>
set so it doesn't succeed in configuring. During the build I then get<br>
a "No rule to make target 'LLVMSupport'.  Stop." Full build log is at<br>
<a href="http://sprunge.us/bCUU" rel="noreferrer" target="_blank">http://sprunge.us/bCUU</a><br>
<br>
I'd like to go with the default behavior of building a native version<br>
of TableGen, but the way that's currently set up in cmake isn't working<br>
here. I'm looking at cmake/modules/CrossCompile.cmake (and I think<br>
"toochain" on the first line is a typo?) and trying to figure out how<br>
to make its call to execute_process(COMMAND ${CMAKE_COMMAND} ...) not<br>
inherit the top-level settings for CMAKE_C_COMPILER etc from the cross<br>
build. Any ideas? I've tried moving my mingw settings from the command<br>
line to a toolchain file but that hasn't done anything different so far.<br>
I've also tried specifically creating a native toolchain file and<br>
tweaking the call to llvm_create_cross_target_internal at the end of<br>
CrossCompile.cmake to use it, but that hasn't worked either - keeps giving<br>
Could not find toolchain file: "/home/llvm/cmake/platforms/NATIVE.cmake"<br>
<br>
Is this a configuration anyone else has gotten working with cmake?<br>
Thanks,<br>
Tony<br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><patch.txt></div></blockquote></body></html>