[cfe-commits] [PATCH 2/2] [clang.py] Implement Token API

I just ran the most recent Python bindings on my OS X build and it works fine.

I suspect an older libclang is being loaded by the Python bindings. Try:

LD_LIBRARY_PATH=/path/to/llvm/lib python

You may also want to debug the library loading code and ensure the proper path is being picked up. You can always through a print statement in there or something.

Gregory

Sorry I guess I lost you on this one. Where can I change this variable?

I am currently setting this on my ~/.profile

PYTHONPATH="/Users/carlosandrade/Desktop/llvm/tools/clang/bindings/python:$PYTHONPATH"
export PYTHONPATH

I only found on read me file after running grep this:

$ env PYTHONPATH=$(echo ~/llvm/tools/clang/bindings/python/)
LD_LIBRARY_PATH=$(llvm-config --libdir)
nosetests -v

But I am a little clueless on how to go about this!

Thanks,

Carlos Andrade

http://carlosandrade.co

2012/7/12 Gregory Szorc <gregory.szorc@gmail.com>

From the command line, set LD_LIBRARY_PATH to where your compiled LLVM/Clang libraries (libclang.so) are. Then, try to run the unit tests:

$ LD_LIBRARY_PATH=/usr/local/lib nosetests -v /home/gps/llvm/tools/clang/bindings/python

If that works, then the libclang shared library being loaded isn't the right one. You should seek out and destroy references to the old version. If that doesn't work, you need to recompile a fresh source pull of LLVM/Clang and load that libclang.

Gregory

Sorry, still doesn’t rings a bell. I am not that acquainted with the clang project, if possible I would like I would ask a few extra pointers.

I don’t know where LLCM/CLang libraries default compile, nor lib clang.so defaults I never changed them and I am running on a MAC OS X as well, on Lion to be more precise.

I have many llvm and clang versions here, I run the installation using configure for most of them, and in fact took me considerable time to figure out even the debug+release folder that varies depending from where you are building. I don’t know the conventions being used on the project nor its inside (and I can’t make much sense of it which is why I decided on moving on this interface).

My /usr/local/lib/clang folder holds a 2.9 and a 3.1 folder. Am I expected to have a 3.2 folder after compiling and making the version on repository? If I run clang -v on my terminal (not ./clang on one of the release folders) I get clang version 3.0. So as you can see there are many versions floating around, but I am unaware on how to removing them either (I didn’t find documentation for such, nor posts related to this). I tried to google this, but I didn’t find any related problem so far).

I attempted running env like stated on the read me-file:

$ env PYTHONPATH=$(echo ~/llvm/tools/clang/bindings/python/)
LD_LIBRARY_PATH=$(llvm-config --libdir)
nosetests -v
tests.cindex.test_index.test_create … ok

But I am not getting this. Am I supposed to run this from any specific folder? nose tests -v are not being found either.

Running env get me some variables, along them the PYTHONPATH I set, but LD_LIBRARY_PATH was not settled. Running env sets the variable if I don’t put nose tests -v, but this is not really taking me nowhere.

Sorry, I’m still a rookie this, thank you for your patience.

Best Regards,

Carlos Andrade

http://carlosandrade.co

2012/7/12 Gregory Szorc <gregory.szorc@gmail.com>

Alright I figured it out. Silly slip, forgot to add ‘install’ on the make, this added 3.2 on the lib folder and it is now working :slight_smile:

Thanks again!

Carlos Andrade

http://carlosandrade.co

2012/7/12 Carlos Andrade <carlosviansi@gmail.com>