Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

lldb python error

Tags:

macos

lldb

I tried running lldb on my mac and get this at startup:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/System/Library/PrivateFrameworks/LLDB.framework/Versions/A/Resources/Python/lldb/embedded_interpreter.py", line 1, in <module>
    import readline
ImportError: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'run_one_line' is not defined

I tried adding the environment variable VERSIONER_PYTHON_PREFER_32_BIT=yes but this error still appears. I'd reckon that the lldb is using a different python environment than it's Mac host so where do I make the change to make it use 32bit mode? thanks.

UPDATE:

I did an arch -i386 lldb and it works in 32-bit. To make it work in 64-bit, I installed a 64-bit version of python readline for OS X but got more problems with native python libraries such as termios and time. So I downloaded python 2.7.3 64-bit installer DMG file and installed its binary; now lldb works in 64 bit finally on my 10.8 mountain lion. Thanks.

like image 617
gigasai Avatar asked Mar 17 '13 04:03

gigasai


2 Answers

It looks like you installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so at some point on your system (I don't see it on my Mac OS X 10.7.5 installation, although maybe it's included in 10.8), and that dylib is only built 32-bit. You can confirm with

file /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so

on your system. You could try to force lldb to also run in 32-bit mode (the distribution binary is built 32-/64- universal) but instead I would recommend removing that 32-bit-only readline.so from your system unless you really need it there.

like image 82
Jason Molenda Avatar answered Oct 19 '22 18:10

Jason Molenda


For the sake of anyone else coming to this question looking for a quick fix - Linus Oleander's answer worked for me -- that is, run

pip install six

Hazarding a guess as to why this works, I think this smooths over some python incompatibility issues that lldb is facing when running on machines with a 'non-standard' python installation. This also works when using Homebrew's version of llvm.

like image 1
catalogue_number Avatar answered Oct 19 '22 17:10

catalogue_number