<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - LLD cannot find library file linked via #pragma comment(lib)"
   href="https://bugs.llvm.org/show_bug.cgi?id=35476">35476</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLD cannot find library file linked via #pragma comment(lib)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>COFF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>zturner@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, llvm@inglorion.net, rnk@google.com, ruiu@google.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I found this when trying to configure a self-host build of LLVM which includes
the LLDB subproject, and when forces the use of lld via CMake.

It should be easy to create a trivial repro, but for now this is what I have.

1. Build clang and lld into some folder called foo.

2. Configure another build of LLVM with the following CMake arguments.

cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lld;lldb"
-DLLVM_TARGETS_TO_BUILD=X86 -DPYTHON_HOME=C:\Python35
-DCMAKE_C_COMPILER=foo/clang-cl.exe -DCMAKE_CXX_COMPILER=foo/clang-cl.exe
-DCMAKE_LINKER=foo/lld-link.exe <source-path>

When you build this, at the link step we can see it trying to run this command:

[1/1] Linking CXX shared library bin\liblldb.dll
FAILED: bin/liblldb.dll lib/liblldb.lib
cmd.exe /C "cd . && "C:\Program Files (x86)\CMake\bin\cmake.exe" -E vs_link_dll
--intdir=tools\lldb\source\API\CMakeFiles\liblldb.dir --manifests  --
E:\src\llvmbuild\ninja-release-x64\bin\lld-link.exe /nologo
@CMakeFiles/liblldb.rsp  /out:bin\liblldb.dll /implib:lib\liblldb.lib
/pdb:bin\liblldb.pdb /dll /version:6.0 /machine:X86 /MANIFEST:NO /debug
/INCREMENTAL   && cd ."
E:\src\llvmbuild\ninja-release-x64\bin\lld-link.exe: error: could not open
python35_d.lib: no such file or directory
LINK failed. with 1
ninja: build stopped: subcommand failed.


If we run that exact same command, replacing lld-link.exe with the path to the
Microsoft linker, it works.

python is special as the library is not specified on the command line, but in
one of the python header files via a #pragma comment.  

As mentioned, it should be easy to create a simple repro, but I'm just
recording the full steps I went through so this issue doesn't get lost.</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>