“brew install rtorrent” now failing to build

homebrewinstalltorrent

This morning, I tried to launch rtorrent on Mac OS X 10.10.3, and it failed with a "symbol not found" in libtorrent (I've lost the backtrace from my screen).

Tried a bunch of stuff, as documented below, but no luck on getting it to build.

I've seen that error before, and as I recall, it requires rebuilding libtorrent, so I did

brew uninstall rtorrent libtorrent
brew install libtorrent
brew install rtorrent

The latter now fails due to an error in make. Using brew install -vd rtorrent shows the following:

libtool: link: g++-5 -g -O2 -DNDEBUG -D_THREAD_SAFE -I/usr/local/Cellar/libtorrent/0.13.4/include -o rtorrent main.o -Wl,-bind_at_load  libsub_root.a ui/libsub_ui.a core/libsub_core.a display/libsub_display.a input/libsub_input.a rpc/libsub_rpc.a utils/libsub_utils.a -lncurses -lcurl -L/usr/local/Cellar/libtorrent/0.13.4/lib -ltorrent
Undefined symbols for architecture x86_64:
  "std::__basic_file<char>::is_open() const", referenced from:
      rpc::parse_command_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) in libsub_rpc.a(parse_commands.o)
[...]

and so on for lots of pages. So it appears to be a linker failure?

In Brew Install Rtorrent not Working, it seems the problem is with gcc 5.0.1. I tried following the instructions there (downgrade to gcc 4.9.2):

brew switch gcc 4.9.2

That works, but then brew install rtorrent fails even more spectacularly:

checking for Cppunit - version >= 1.9.6... no
checking whether the C++ compiler works... no
configure: error: in `/private/tmp/rtorrent20150526-82101-c1xxo5/rtorrent-0.9.4':
configure: error: C++ compiler cannot create executables
See `config.log' for more details

I look in config.log, and the problem is here:

configure:3319: checking whether the C++ compiler works
configure:3341: g++-4.9    conftest.cpp  >&5
dyld: Library not loaded: /usr/local/lib/libisl.10.dylib
  Referenced from: /usr/local/Cellar/gcc/4.9.2/libexec/gcc/x86_64-apple-darwin14.0.0/4.9.2/cc1plus
  Reason: image not found
g++-4.9: internal compiler error: Trace/BPT trap: 5 (program cc1plus)
./configure: line 3343: 82310 Abort trap: 6           $CXX $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5

That ain't good. Wonder where libisl10.dylib might have gotten to?

Best Answer

Oh, I did manage to get this working. Thought I'd answer my own question. The key was to create a symlink for the missing libisl.10.dylib so that gcc 4.9.2 runs correctly, then recompile libtorrent, then reinstall rtorrent.

Step 1: Downgrade gcc to 4.9.2.

brew switch gcc 4.9.2

Step 2: Ensure the symbolic link for libisl.10.dylib exists.

cd /usr/local/lib
ln -s libisl.dylib libisl.10.dylib

Step 3: Uninstall and reinstall libtorrent.

brew uninstall libtorrent
brew install libtorrent

Step 4: Reinstall rtorrent.

brew install rtorrent

Step 5: To be safe, switch gcc back to the latest version.

brew switch gcc 5.1.0