Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save pyed/197f6a9348212e92c211ad3d3cff710a to your computer and use it in GitHub Desktop.
Save pyed/197f6a9348212e92c211ad3d3cff710a to your computer and use it in GitHub Desktop.
Compiling rtorrent on a mac
#!/bin/bash
# Installs the XCode command line tools if you don't have them
xcode-select --install
# Installs brew if you don't have it
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Makes your account the owner of /usr/local, which is preferred on single user Macs
sudo chown -R `whoami` /usr/local
# Installs all the dependencies for building libtorrent and rtorrent
brew install automake libtool boost curl lzlib libsigc++ openssl pkg-config xmlrpc-c
# Uninstall libtorrent-rasterbar if you already have it
brew uninstall libtorrent-rasterbar
# Get the repos
git clone https://github.com/rakshasa/rtorrent.git
git clone https://github.com/rakshasa/libtorrent.git
cd libtorrent
./autogen.sh
# Adds the openssl includes to your build command
export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig
CC=clang CXX=clang++ CXXFLAGS="-Wno-deprecated-declarations -O3 -std=c++11 -stdlib=libc++ -I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib" ./configure
make
# Installs libtorrent to /usr/local/lib
make install
cd ../rtorrent
./autogen.sh
CC=clang CXX=clang++ CXXFLAGS="-Wno-deprecated-declarations -O3 -std=c++11 -stdlib=libc++ -I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib" ./configure --with-xmlrpc-c
make
# Installs rtorrent to /usr/local/bin
make install
# Run rtorrent
rtorrent
@c0llision
Copy link

Thanks. I got it working, but before I did CC=clang... on the rtorrent folder, I had to run

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

Because my libtorrent was installed there.

@maliksjsu
Copy link

maliksjsu commented Jun 2, 2019

checking for XMLRPC-C... failed
for people who get ^ error
do 👍
./configure --disable-instrumentation
and make install

@prof-miles0
Copy link

prof-miles0 commented Jul 18, 2019

Thanks for your guide, but when I try to "make" rtorrent I get the following error:

command_logging.cc:134:59: error: no member named 'log_close_output_str' in namespace 'torrent'; did you mean 'log_close_output'?
  CMD2_ANY_STRING_V("log.close",      std::bind(&torrent::log_close_output_str, std::placeholders::_2));
                                                 ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
                                                          log_close_output
./command_helpers.h:70:123: note: expanded from macro 'CMD2_ANY_STRING_V'
#define CMD2_ANY_STRING_V(key, slot) CMD2_A_FUNCTION(key, command_base_call_string<rpc::target_type>, object_convert_void(slot), "i:s", "")
                                                                                                                          ^~~~
./command_helpers.h:51:82: note: expanded from macro 'CMD2_A_FUNCTION'
  rpc::commands.insert_slot<rpc::command_base_is_type<rpc::function>::type>(key, slot, &rpc::function, \
                                                                                 ^~~~
/opt/local/include/torrent/utils/log.h:231:6: note: 'log_close_output' declared here
void log_close_output(const char* name) LIBTORRENT_EXPORT;
     ^
In file included from command_logging.cc:19:
./command_helpers.h:182:70: error: no matching function for call to object of type 'std::__1::__bind<void (*)(const char *), const std::__1::placeholders::__ph<2> &>'
  torrent::Object operator () (const Arg1& arg1, const Arg2& arg2) { m_slot(arg1, arg2); return torrent::Object(); }
                                                                     ^~~~~~
/Library/Developer/CommandLineTools/usr/include/c++/v1/type_traits:4339:23: note: in instantiation of function template specialization 'object_convert_type<std::__1::__bind<void
      (*)(const char *), const std::__1::placeholders::__ph<2> &>, void>::operator()<rpc::rt_triple<int, void *, void *>, std::__1::basic_string<char> >' requested here
_LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))

Any clues?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment