<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Project LTO does not build on Windows if the build path has spaces in it."
   href="https://llvm.org/bugs/show_bug.cgi?id=23313">23313</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Project LTO does not build on Windows if the build path has spaces in it.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Build scripts
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>cmake
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jujjyl@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14240" name="attach_14240" title="patch to fix build when build path has spaces in it.">attachment 14240</a> <a href="attachment.cgi?id=14240&action=edit" title="patch to fix build when build path has spaces in it.">[details]</a></span>
patch to fix build when build path has spaces in it.

STR:

Clone LLVM+Clang to a path that has spaces in it, and do a cmake build with
Visual Studio 2013 to a directory that has spaces in it.

Observed:

When building LLVM in VS2013, it will fail with the following error:

1>------ Build started: Project: LTO, Configuration: RelWithDebInfo x64 ------
1>  LTODisassembler.cpp
1>  lto.cpp
1>LINK : fatal error LNK1104: cannot open file
'sdk/emsdk/clang/fastcomp/build_incoming_vs2013_64/tools/lto/LTO.def'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

In this case, LLVM build path was located in C:/code/em
sdk/emsdk/clang/fastcomp/build_incoming_vs2013_64/.

Looking at the generated VS project closer, and the CMakeLists.txt, this can be
fixed by adding quotes in cmake/modules/AddLLVM.cmake:

-      set(export_file_linker_flag "/DEF:${export_file_linker_flag}")
+      set(export_file_linker_flag "/DEF:\"${export_file_linker_flag}\"")

after which the build passes ok. Attached is a patch to illustrate the fix.

This bug was originally reported in Emscripten SDK bug tracker:
<a href="https://github.com/kripken/emscripten/issues/3382">https://github.com/kripken/emscripten/issues/3382</a> .</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>