<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 --- - lld shared libraries build is broken on MacOS (and probably has been for a while)"
   href="https://llvm.org/bugs/show_bug.cgi?id=30345">30345</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld shared libraries build is broken on MacOS (and probably has been for a while)
          </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>All
          </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>MachO
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>davide@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While trying the MachO lld I saw some tests failing with BUILD_SHARED_LIBS,
e.g.:

******************** TEST 'lld :: mach-o/linker-as-ld.yaml' FAILED
********************


The reason is that dyld gets confused and can't find the library:

dyld: Library not loaded: @rpath/liblldDriver.dylib
  Referenced from:
/Users/davide/work/llvm/build-shared/tools/lld/test/mach-o/Output/linker-as-ld.yaml.tmp.dir/ld
  Reason: image not found

$ otool -L
/Users/davide/work/llvm/build-shared/tools/lld/test/mach-o/Output/linker-as-ld.yaml.tmp.dir/lld
/Users/davide/work/llvm/build-shared/tools/lld/test/mach-o/Output/linker-as-ld.yaml.tmp.dir/lld:
@rpath/liblldDriver.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/liblldCOFF.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/liblldELF.dylib (compatibility version 0.0.0, current version 0.0.0)
@rpath/libLLVMSupport.dylib (compatibility version 0.0.0, current version
0.0.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
1226.10.1)

Apparently, just moving the built lld to the parent directory (../) will cause
the same problem. I suspected it was rpath related and actually forcing rpath
to the absolute correct value (via install_name_tool) seems to work around the
problem.

I think this should be fixed in the build system, anyway (and maybe a bot
should be set up to catch up these kind of failures).</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>