I was trying to build llvm-py on Mac OS X.
This is what I tried to do, I needed to download 11vm-2.7, and the README file has this comment: Make sure '--enable-pic' is passed to LLVM's 'configure'
- Download llvm 2.7.
- Build llvm 2.7: Run
./configure --prefix=LLVM_DIRECTORY --enable-pic
- Download llvm-py 0.6.
- Build llvm-py 0.6: Run
python setup.py build --llvm-config=LLVM_DIRECTORY/bin/llvm-config
Everything compiles without errors, but when I tried to run test file, I got this error message.
ImportError: 'dlopen(/Library/Python/2.7/site-packages/llvm/_core.so, 2): Symbol not found: __ZTVN4llvm16ExtractValueInstE\n Referenced from: /Library/Python/2.7/site-packages/llvm/_core.so\n Expected in: flat namespace\n in /Library/Python/2.7/site-packages/llvm/_core.so'
The message error seems to say that there is a missing function "llvmExtractValueInst" with flat namemspace issue. What's wrong with this?
In llvm 2.7, the Makefile.rules has this line
SharedLinkOptions=-Wl,-flat_namespace -Wl,-undefined -Wl,suppress \
-dynamiclib
I tried to remove the flat_namespace
, but I got compilation error.
ADDED
Following locojay's answer, I could build brew and llvmpy.
export REQUIRES_RTTI=1
brew install llvm --rtti
sudo pip install git+https://github.com/llvmpy/llvmpy
However, when I tried to execute the examples in the test directory, I still got different kind of error-
test> python example.py
Traceback (most recent call last):
File "example.py", line 4, in <module>
from llvm import *
File "/Library/Python/2.7/site-packages/llvm/__init__.py", line 11, in <module>
from llvm import _core
ImportError: dlopen(/Library/Python/2.7/site-packages/llvm/_core.so, 2): Symbol not found: __ZN4llvm10DataLayout2IDE
Referenced from: /Library/Python/2.7/site-packages/llvm/_core.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/llvm/_core.so
This is the result when I run otool -L /Library/Python/2.7/site-packages/llvm/_core.so
/Library/Python/2.7/site-packages/llvm/_core.so:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)