Attached are two patches which (along with recent commits) allow
compiling lldb on Linux; the generated executable even works to the
point where it can disassemble named functions from an x86-32 ELF
file. The build procedure is essentially just check out lldb into
llvm/tools/ in an LLVM tree with a built LLVM and clang, apply this
patch, and run make in the lldb directory. Note that the makefiles
depend on a Python 2.6 install, and the presence of libedit, which
isn't normally installed on Linux (but libedit-dev is available in
Ubuntu).
The Makefiles aren't quite complete; they're missing steps to generate
some files. The second patch is required because of this. Any help
with that and reviews would be welcome.
-Eli
lldbmakefiles.txt (22.9 KB)
lldbhack.txt (1.46 KB)
Hi Eli,
Eli Friedman <eli.friedman@gmail.com> writes:
The Makefiles aren't quite complete; they're missing steps to generate
some files. The second patch is required because of this. Any help
with that and reviews would be welcome.
These patches worked for me on x86_64 Fedora 11. Only immediate issue
was locating auto generated clang headers (.inc) when srcdir != objdir.
I used the following addition to the top level makefile:
CPP.Flags += -I$(PROJ_OBJ_DIR)/$(LLDB_LEVEL)/../clang/include
- Steve
Eli,
the generated file you’re looking for is LLDB_vers.c, a file generated by Apple Generic Versioning, which is described in more detail
here: http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man8/agvtool.8.html.
A properly-built LLDB_vers.c looks like this:
–
const unsigned char LLDBVersionString attribute ((used)) = “@(#)PROGRAM:LLDB PROJECT:lldb-24” “\n”; const double LLDBVersionNumber attribute ((used)) = (double)24.;
–
I’ve attached a simple Perl script that generates the above code given the location of the .pbxproj as input.
Sean
generate-vers.pl (1.07 KB)
Cool, thanks; I didn't realize that was missing. I've managed to
integrate it in (but I'm not attaching a patch yet; see below).
The other thing that is missing is generating the SWIG bindings; see
http://lists.cs.uiuc.edu/pipermail/lldb-dev/2010-June/000045.html .
I've managed to get it mostly working, but I'm running into an issue
with circular dependencies: bindings -> source/API ->
source/Interpreter -> bindings. I'm not sure how to go about dealing
with this... I'm tempted to just collapse lldb into a single .a file,
but I don't know how to tell the LLVM Makefile system to do that. Any
ideas?
-Eli
Eli,
the generated file you're looking for is LLDB_vers.c, a file generated by
Apple Generic Versioning, which is described in more detail
here: http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man8/agvtool.8.html.
A properly-built LLDB_vers.c looks like this:
–
const unsigned char LLDBVersionString[] __attribute__ ((used)) =
"@(#)PROGRAM:LLDB PROJECT:lldb-24" "\n"; const double LLDBVersionNumber
__attribute__ ((used)) = (double)24.;
–
I've attached a simple Perl script that generates the above code given the
location of the .pbxproj as input.
Cool, thanks; I didn't realize that was missing. I've managed to
integrate it in (but I'm not attaching a patch yet; see below).
The other thing that is missing is generating the SWIG bindings; see
http://lists.cs.uiuc.edu/pipermail/lldb-dev/2010-June/000045.html .
I've managed to get it mostly working, but I'm running into an issue
with circular dependencies: bindings -> source/API ->
source/Interpreter -> bindings. I'm not sure how to go about dealing
with this... I'm tempted to just collapse lldb into a single .a file,
but I don't know how to tell the LLVM Makefile system to do that. Any
ideas?
Is this a header file include issue? All files in "include/lldb/API" should only be pulling in stuff from "lldb/API/*.h" and from "lldb/lldb-*.h".
I will try and build this on my Ubuntu install and see if I can recognize anything. Can you send me a patch with your SWIG changes in? I can then check it out and let you know what I find.
Version with the additional fixes attached. The issue is if I try to
get rid of the hacks in source/Interpreter/ScriptInterpreterPython.cpp
, there isn't any possible ordering of libraries that will make
everything link successfully.
-Eli
lldb.txt (27 KB)
I was able to build successfully with no changes to your patch Eli.
I did have to install the dev packages for python 2.6 and editline (version 1) main things you need to intall:
python2.6-dev
libghc6-editline-dev
Right... the issue is "if I try to get rid of the hacks in
source/Interpreter/ScriptInterpreterPython.cpp"...
-Eli
Ah. I just checked in some clarification on where the "init_lldb()" function comes from.
"init_lldb()" is in the C++ output file generated by SWIG after it is run on all of the headers in "lldb/API/SB*.h".
So we need to get SWIG generation working and it will need to be in the makefile in "lldb/source/Interpreter".
Eli, did you have some Makefile changes that I can use to get swig generation going so I can see the issue you were running into?
Greg Clayton
Here's the precise version which doesn't link.
-Eli
xx.txt (25.6 KB)