[Lldb-commits] [lldb] r374226 - Revert "[lldb] Calculate relative path for symbol links"

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 13:56:44 PDT 2019


Author: jingham
Date: Wed Oct  9 13:56:43 2019
New Revision: 374226

URL: http://llvm.org/viewvc/llvm-project?rev=374226&view=rev
Log:
Revert "[lldb] Calculate relative path for symbol links"

This reverts commit 958091c209d0a92e38b9cb27fb77a0ff7da11853.

This commit incorrectly sets the _lldb.so symlink (at least it does when
building in Stefans' two build directory mode, where you build llvm with
cmake/ninja and lldb with cmake/Xcode, using a cmake generated project.

The _lldb.so link is SUPPOSED to point to:

bin/LLDB.framework/Versions/A/LLDB

but instead it points to

bin/LLDB

which is where LLDB was staged to before constructing the framework.  This
causes all sorts of problems when we then build the lldb driver into bin -
remember that MacOS is a case-preserving but case insensitive filesystem -
so when we later go to dlopen _lldb.so, we dlopen the main executable instead.

Modified:
    lldb/trunk/scripts/Python/finishSwigPythonLLDB.py

Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=374226&r1=374225&r2=374226&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Wed Oct  9 13:56:43 2019
@@ -365,6 +365,7 @@ def make_symlink_native(vDictArgs, strSr
 # Throws:   None.
 #--
 
+
 def make_symlink(
         vDictArgs,
         vstrFrameworkPythonDir,
@@ -373,13 +374,27 @@ def make_symlink(
     dbg = utilsDebug.CDebugFnVerbose("Python script make_symlink()")
     strTarget = os.path.join(vstrFrameworkPythonDir, vstrTargetFile)
     strTarget = os.path.normcase(strTarget)
-    strPrefix = vDictArgs['--prefix']
+    strSrc = ""
 
     os.chdir(vstrFrameworkPythonDir)
+    bMakeFileCalled = "-m" in vDictArgs
+    eOSType = utilsOsType.determine_os_type()
+    if not bMakeFileCalled:
+        strBuildDir = os.path.join("..", "..", "..")
+    else:
+        # Resolve vstrSrcFile path relatively the build directory
+        if eOSType == utilsOsType.EnumOsType.Windows:
+            # On a Windows platform the vstrFrameworkPythonDir looks like:
+            # llvm\\build\\Lib\\site-packages\\lldb
+            strBuildDir = os.path.join("..", "..", "..")
+        else:
+            # On a UNIX style platform the vstrFrameworkPythonDir looks like:
+            # llvm/build/lib/python2.7/site-packages/lldb
+            strBuildDir = os.path.join("..", "..", "..", "..")
+    strSrc = os.path.normcase(os.path.join(strBuildDir, vstrSrcFile))
+
+    return make_symlink_native(vDictArgs, strSrc, strTarget)
 
-    strSrc = os.path.normcase(os.path.join(strPrefix, vstrSrcFile))
-    strRelSrc = os.path.relpath(strSrc, os.path.dirname(strTarget))
-    return make_symlink_native(vDictArgs, strRelSrc, strTarget)
 
 #++---------------------------------------------------------------------------
 # Details:  Make the symbolic that the script bridge for Python will need in




More information about the lldb-commits mailing list