Hello, I have Questions, about lldb:(

Hello

I’m a university student in korea

I have a project in my school, that related dissembleing arm machine code

( I’ll use python script language to my project)

so I found this llvm project and i tried to build llvm

but I faced some problems…

(my compilation enviroment is Ubuntu Linux 10.x )

I saw http://lldb.llvm.org/build.html , and worked step by step

first problem is that the llvm_revision doesn’t update,…

typed as I saw in manual “svn update -r 127682” ,doesn’t work properly…

the result is as below…

The instructions posted on the build page are slightly out-of-date. LLDB trunk builds against LLVM and Clang trunk, and not a pinned revision as the docs mention. If you’re using older revisions, you should update all your working copies to trunk.

The error you’re seeing with importing _lldb is due to a problem in one of the Makefiles. Python requires an _lldb.so symlink (pointing to liblldb.so) on the PYTHONPATH in order for the import to work correctly. I am working on a cross-platform way to generate it with the Makefiles, but until it is ready, try the following workaround (creating the symlink manually):

$ ln –sf /Debug+Asserts/lib/liblldb.so /Debug+Asserts/lib/python/lldb/python2.7+/_lldb.so

Then, if your PYTHONPATH is set to “/Debug+Asserts/lib/python/lldb/python2.7+”, you should be able to run:

$ python –c ‘import lldb’

with no errors.

Best of luck,

Dan

The instructions posted on the build page are slightly out-of-date. LLDB trunk builds against LLVM and Clang trunk, and not a pinned revision as the docs mention. If you’re using older revisions, you should update all your working copies to trunk.

The error you’re seeing with importing _lldb is due to a problem in one of the Makefiles. Python requires an _lldb.so symlink (pointing to liblldb.so) on the PYTHONPATH in order for the import to work correctly. I am working on a cross-platform way to generate it with the Makefiles,

I have a patch for you right now.

I originally wrote this patch so I could build with Makefiles on Darwin. (For the record, I have commit access, so I can commit this once approved).

I'll note that with this change, the liblldbInterpreter.a Makefile is *radically* simpler.

Summary of changes:
- Stop assuming that "Darwin" means "being built by Xcode". There's a slight chance this could break Xcode builds, but I carefully reworked the argument parsing in the scripts so that Xcode builds don't need to change. Apple devs: if this patch breaks Xcode builds, feel free to scream loudly at me so I can go fix it. :wink:
- Use the finish script to install, too.
- Make swig auto-generate dependencies if DISABLE_AUTO_DEPENDENCIES is off (like before).
- Ask python where to put site-specific files using the distutils.sysconfig.get_python_lib() function. (Tests' Makefile was changed to do this, too.) This is what you're "supposed" to do, but I avoided doing that when I first wrote the Makefile because I thought that not all python installs would have it. I hope I was wrong...
- Fix out-of-tree builds. For out-of-tree builds, you have to pass to the edit-swig-python-wrapper-file.py script the directory where swig put the LLDBWrapPython.cpp file, or it won't be able to find it. The Makefiles were doing this before Filipe went in and started this.
- Completely eliminate duplication of logic between Makefile and Xcode builds. Radically simplify the Interpreter Makefile; now there aren't two versions of the same rule (one of which wasn't even being maintained!).

I've tested this patch with several self-host builds of Clang, and I have had no trouble building, installing, or running LLDB.

Chip

big-makefile-swig-cleanup.patch (18.9 KB)

Hi Chip,

You made my day with the build system patch! It looks good to me, however, I’m not an expert on the SWIG scripts…so maybe someone else who is more familiar with the old source/Interpreter/Makefile can take a look too?

After applying it, I noticed a small problem on Linux with the generation of the _lldb.so symlink. On Ubuntu 11.10 (with GNU Make 3.81) I did a clean out-of-tree build and ended up with the following files:

[OK] build/Debug+Asserts/lib/liblldb.so

[BROKEN] build/Debug+Asserts/lib/python2.7/site-packages/lldb/_lldb.so → …/…/liblldb.so

To fix the problem, either the symlink needs to point 3 (instead of 2) directories up, or the it needs to be located one directory up.

However, to keep PYTHONPATH simple, I recommend the latter option, since the former would require adding two directories to the PYTHONPATH (“site-packages” as well as “lldb”). I am attaching a patch (can be applied on top of yours) that places the _lldb.so symlink in “site-packages” instead of “lldb”.

Otherwise, your patch looks great. I can confirm no test regressions on Linux (but a couple of fixes!). I tried it out on Mac OS X too, and noticed no build problems on 10.8.

Cheers,

Dan

fixup_lldb_symlink.patch (448 Bytes)

Seems okay to me.
Charles, will you commit either with Daniel’s patch or with the corrected symlink? (I would prefer to have everything under the lldb directory, but can accept it either way)

Regards,

Filipe