Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The standard approach does not work:

brew install libtorrent-rasterbar

Will install the boost requirement (linked against the system Python), and libtorrent-rasterbar will install without any Python bindings at all.

How do you fix this?

share|improve this question
add comment

1 Answer

After lots of digging, googling and trial and error, I've been able to get this all to work. I'm sharing my experiences here in the hope to save others the trouble.

The first step is to make sure that you have your Python properly installed. Check that which python gives back the right Python version (probably something like /usr/local/bin/python)

Properly linked boost

Check if your boost is linked against the right version of Python using the following command (Change /usr/local to your Homebrew prefix where necessary).

otool -L /usr/local/lib/libboost_python-mt.dylib

The result should contain the line:

/usr/local/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.0)

If it points to somewhere in /System/Library/Frameworks, you need to rebuild your boost libraries and force a build from source (ref):

brew rm boost ; brew install boost --build-from-source

Once that is done you can run the above line to verify it linked correctly.

Libtorrent-rasterbar with Python bindings

Now that boost is installed properly, libtorrent-rasterbar can use them to build the Python bindings. We have to edit the formula to enable them, but also to educate the build process on where to find them.

Execute brew edit libtorrent-rasterbar and then change it to match this:

def install
system "./configure", "--disable-debug",
                      "--disable-dependency-tracking",
                      "--enable-python-binding",
                      "--with-boost-python=mt",
                      "--prefix=#{prefix}"

The two important lines here are to enable the python bindings with --enable-python-binding and the second is --with-boost-python=mt to show that it has been installed with an "mt" suffix (ref).

This will allow the build process to recognize the boost library which was installed in the first step. So close the editor, and do brew install libtorrent-rasterbar as normal.

Final Check

Finally, to make sure that it all worked:

% python
Python 2.7.3 (default, Feb 10 2013, 10:53:34) 
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.24)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtorrent
>>> 
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.