<html>
    <head>
      <base href="http://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 --- - LLDB fails to compile from command line"
   href="http://llvm.org/bugs/show_bug.cgi?id=20689">20689</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLDB fails to compile from command line
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@cs.uiuc.edu
          </td>
        </tr>

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

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This is the result of a Stack Overflow question:
<a href="http://stackoverflow.com/questions/24923650/undefined-symbols-systemruntimemacosxinitialize-and-systemruntimemacosxtermi">http://stackoverflow.com/questions/24923650/undefined-symbols-systemruntimemacosxinitialize-and-systemruntimemacosxtermi</a>.

I'm using 3.4.2 releases from their respective downloads. Attempting to build
LLDB along with LLVM, Clang, Compiler_RT and Extras results in a compile
failure. LLVM, Clang, Compiler_RT and Extras are fine alone. The problem arises
when LLDB is added to the process.

The issue may (or may not) exist in other versions.

The recipe to automate fetching, untarring and building is attached. And the
missing Makefile is attached.

*****

There's a few issues with the build, but the first issue encountered is:

...
llvm[3]: Linking Release+Asserts Shared Library liblldb.dylib
Undefined symbols for architecture x86_64:
  "SystemRuntimeMacOSX::Initialize()", referenced from:
      lldb_private::Initialize() in liblldbInitAndLog.a(lldb.o)
  "SystemRuntimeMacOSX::Terminate()", referenced from:
      lldb_private::Terminate() in liblldbInitAndLog.a(lldb.o)
ld: symbol(s) not found for architecture x86_64

*****

First issue. Credit goes to Matt on Stack Overflow. Matt found
<a href="https://github.com/llvm-mirror/lldb/commit/7a53199e140843235d2bd2b12182ceb764419c8a">https://github.com/llvm-mirror/lldb/commit/7a53199e140843235d2bd2b12182ceb764419c8a</a>.
It appears a Makefile is missing, and once found, the Makefile needs to be
wired into the build:

    cp Missing-Makefile
llvm/tools/lldb/source/Plugins/SystemRuntime/MacOSX/Makefile
    sed -i '' "s|lldbPluginProcessMachCore.a|lldbPluginSystemRuntimeMacOSX.a
lldbPluginProcessMachCore.a|" llvm/tools/lldb/lib/Makefile

*****

After fixing the first issue, I encountered:

...
llvm[4]: Building Release+Asserts Archive Library liblldbUtility.a
make[3]: *** No rule to make target
`/Users/jwalton/Clang-3.4.2/build/Release+Asserts/lib/liblldbPluginSystemRuntimeMacOSX.a',
needed by `/Users/jwalton/Clang-3.4.2/build/Release+Asserts/lib/liblldb.dylib'.
 Stop.

*****

Second issue. Credit goes to Cos on Stack Overflow. It appears another Makefile
needs to be patched, and the SystemRuntime/MacOSX directory needs to be
wire-into the Makefile:

    sed -i '' "s|Process/mach-core|Process/mach-core SystemRuntime/MacOSX|"
llvm/tools/lldb/source/Plugins/Makefile

*****

Once the two solutions by Matt and Cos are incorporated, the build proceeds and
completes successfully.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>