[cfe-dev] Heads up: Bug in CMake found when attempting 64-bit build with 32-bit clang-cl.

Sean Silva via cfe-dev cfe-dev at lists.llvm.org
Thu Sep 17 21:07:20 PDT 2015


Hi Nico, Hans, Takumi,

I made it to the bottom of the issue. Turns out that
CMAKE_C_FLAGS=-m64
CMAKE_CXX_FLAGS=-m64
CMAKE_EXE_LINKER_FLAGS=/machine:x64
is enough to do a 64-bit build correctly with a 32-bit clang-cl (i.e. one
that targets 32-bit by default). Hooray! The missing piece that I had to
track down is why I would see `deps = msvc` stuff spewing onto my terminal,
rather than consumed properly by ninja. I noticed that in rules.ninja,
CMake had generated:

msvc_deps_prefix = LINK : error LNK2001:

After some hunting in procmon, I found that there was a call to clang-cl
done during the configure process that *wasn't including -m64*, leading to
a link error. The text of the link error was then being interpreted as a
valid output for setting msvc_deps_prefix.

Attached is a quick hack patch for CMake that fixes the issue for me
locally. Some more details are in the commit message for the patch. It's
not ideal by any means... my CMake-fu is weak.

Brad, you seem to be roughly our liaison with the CMake community. Do you
know what the next steps are for getting this fixed in CMake upstream?

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150917/adaf44fd/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Make-sure-to-call-CMAKE_C_COMPILER-with-CMAKE_C_FLAG.patch
Type: application/octet-stream
Size: 2370 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150917/adaf44fd/attachment.obj>


More information about the cfe-dev mailing list