Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to import the Python dxr module

5 views
Skip to first unread message

James K. Lowden

unread,
Apr 1, 2012, 12:19:10 PM4/1/12
to dev-stati...@lists.mozilla.org
Hello list,

How to tell Python about the dxr module? I've never done anything with
Python.

I installed the OS X binary Clang 3.0 from
http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz
and of course dxr from git://github.com/mozilla/dxr.git. I followed the
README and landed here:

$ make
. dxr/setup-env.sh dxr.config freetds && \
python dxr/dxr-index.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named dxr
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named dxr
Could not load tokenizer: dlopen
(dxr/sqlite/libdxr-code-tokenizer.so, 6):
image not found

I tried setting PYTHONPATH, too, but no joy.

Many thanks.

--jkl

James K. Lowden

unread,
Apr 1, 2012, 6:40:46 PM4/1/12
to dev-stati...@lists.mozilla.org
On Sun, 1 Apr 2012 12:19:10 -0400
"James K. Lowden" <jklo...@schemamania.org> wrote:

Getting dxr running on Mac OS X proved to be too difficult in the time
I had available. If I knew Python and were running Ubuntu I'm sure it
would be easier, but I'm not and it's not.

Not to worry: my real interest is in the back end. My goal is
always to learn what dxr is able to garner for its database from
clang++. To that end, ISTM I need only build and install
libclang-index-plugin.so. (Or, rather, the OS X equivalent.)
Unfortunately, I'm getting linker errors that seem to indicate it won't
be possible.

I'm linking to the libraries included with
http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz.

The symbols I can't seem to find with nm(1) are the most basic ones:
operators new & delete, std::ios_base::Init::Init(), and so on. Where
are they defined?

--jkl


James K. Lowden

unread,
Apr 1, 2012, 9:48:19 PM4/1/12
to dev-stati...@lists.mozilla.org
The following command line linked correctly:

/usr/local/clang30/bin/clang -stdlib=libc++ -fPIC -g -Wl,-rpath
-Wl,/usr/local/lib -L/usr/local/clang30/lib -shared -lLLVMARMCodeGen
-lLLVMAlphaCodeGen -lLLVMAnalysis -lLLVMCodeGen -lLLVMCore
-lLLVMMBlazeCodeGen -lLLVMMC -lLLVMMCDisassembler -lLLVMMipsCodeGen
-lLLVMSelectionDAG -lLLVMSupport -lLLVMSystemZCodeGen -lLLVMX86CodeGen
-lclang -lclangAST -lclangAnalysis -lclangBasic -lclangDriver
-lclangFrontend -lclangLex -lclangParse -lclangSema
-lclangSerialization /usr/lib/libstdc++.6.dylib dxr-index.o sha1.o -o
libclang-index-plugin.so -shared

Notes:

1. The OS X ld(1) seems not to support -R, but -rpath works.
2.
http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz
doesn't include a standard C++ runtime library.
3. I don't know whether to use libc++ or libstdc++. I don't
understand the consequences, if any, of linking to the one
in /usr/lib.

--jkl

0 new messages