From c0da1282fc036908cc721ee74f574fbb99d5e506 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Wed, 9 Oct 2019 20:56:43 +0000 Subject: 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. llvm-svn: 374226 --- lldb/scripts/Python/finishSwigPythonLLDB.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'lldb/scripts/Python/finishSwigPythonLLDB.py') diff --git a/lldb/scripts/Python/finishSwigPythonLLDB.py b/lldb/scripts/Python/finishSwigPythonLLDB.py index 902ad8a..d12c833 100644 --- a/lldb/scripts/Python/finishSwigPythonLLDB.py +++ b/lldb/scripts/Python/finishSwigPythonLLDB.py @@ -365,6 +365,7 @@ def make_symlink_native(vDictArgs, strSrc, strTarget): # 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 -- cgit v1.1