[Lldb-commits] [lldb] f07ddbc - [lldb] build failure for LLDB_PYTHON_EXE_RELATIVE_PATH on greendragon

Lawrence D'Anna via lldb-commits lldb-commits at lists.llvm.org
Wed Nov 17 09:27:03 PST 2021


Author: Lawrence D'Anna
Date: 2021-11-17T09:26:24-08:00
New Revision: f07ddbc620a0466ebbb41ccbc78f20a8591bed5a

URL: https://github.com/llvm/llvm-project/commit/f07ddbc620a0466ebbb41ccbc78f20a8591bed5a
DIFF: https://github.com/llvm/llvm-project/commit/f07ddbc620a0466ebbb41ccbc78f20a8591bed5a.diff

LOG: [lldb] build failure for LLDB_PYTHON_EXE_RELATIVE_PATH on greendragon

see: https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/38387/console

```
Could not find a relative path to sys.executable under sys.prefix
tried: /usr/local/opt/python/bin/python3.7
tried: /usr/local/opt/python/bin/../Frameworks/Python.framework/Versions/3.7/bin/python3.7
sys.prefix: /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7
```

It was unable to find LLDB_PYTHON_EXE_RELATIVE_PATH because it was not resolving
the real path of sys.prefix.

caused by: https://reviews.llvm.org/D113650

Added: 
    

Modified: 
    lldb/bindings/python/get-python-config.py

Removed: 
    


################################################################################
diff  --git a/lldb/bindings/python/get-python-config.py b/lldb/bindings/python/get-python-config.py
index 507a8aa072076..978dc07b3e4c0 100755
--- a/lldb/bindings/python/get-python-config.py
+++ b/lldb/bindings/python/get-python-config.py
@@ -24,19 +24,21 @@ def main():
     elif args.variable_name == "LLDB_PYTHON_EXE_RELATIVE_PATH":
         tried = list()
         exe = sys.executable
+        prefix = os.path.realpath(sys.prefix)
         while True:
             try:
-                print(relpath_nodots(exe, sys.prefix))
+                print(relpath_nodots(exe, prefix))
                 break
             except ValueError:
                 tried.append(exe)
                 if os.path.islink(exe):
-                    exe = os.path.join(os.path.dirname(exe), os.readlink(exe))
+                    exe = os.path.join(os.path.realpath(os.path.dirname(exe)), os.readlink(exe))
                     continue
                 else:
                     print("Could not find a relative path to sys.executable under sys.prefix", file=sys.stderr)
                     for e in tried:
                         print("tried:", e, file=sys.stderr)
+                    print("realpath(sys.prefix):", prefix, file=sys.stderr)
                     print("sys.prefix:", sys.prefix, file=sys.stderr)
                     sys.exit(1)
     elif args.variable_name == "LLDB_PYTHON_EXT_SUFFIX":


        


More information about the lldb-commits mailing list