Author Topic: Compiling latest qBittorrent with MacPorts package manager  (Read 48995 times)

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Compiling latest qBittorrent with MacPorts package manager
« on: March 31, 2014, 02:12:16 AM »


To compile qBittorrent from latest source code in Mac OS 10.9.2, you not only need Unix packages required by qBittorrent directly (qt4-mac and lib torrent-rasterbar) but also all additional Unix packages where there are dependencies among themselves (total 33 packages). Most of these Unix packages are open-sourced and are not included in Apple's Darwin Unix (Mac OS X builds on it). Of course you can always download these open-source Unix packages (distributed in source code format), and compile all of them to fulfil all dependencies before compiling qBittorrent.

A easier way is to make use of Unix package manager  Homebrew (http://brew.sh) or MacPorts (https://www.macports.org), to take care of all dependencies among packages as well as to handle compilation and installation automatically for all required Unix packages. You will never miss a single Unix package in order to fulfil the all important dependencies.

This thread is devoted to compiling qBittorrent in Mac OS X from latest version of source code released in this site with MacPorts Unix package manager. If you want to compile qBittorrent with Homebrew Unix package manager, please refer to following thread started by pyed:

http://qbforums.shiki.hu/index.php/topic,2423.0.html

« Last Edit: March 31, 2014, 02:24:37 AM by littletree76 »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #1 on: March 31, 2014, 02:13:55 AM »

I have just re-registered for another dropbox account with different email address as there has been problem with my original dropbox account with two-tier security validation (since I changed my mobile number and dropbox support refused to fix the problem). The qbittorrent 3.1.9 build with latest Xcode 5.1 and corresponding Command Line Tools kit and MacPorts system for Unix packages has been uploaded to this new dropbox account:

https://www.dropbox.com/sh/45qkagvurvxh3tp/UX0Ni-BVK3

Note this build is compiled for any Mac model with quad-core processor thus not suitable for Mac models with dual-core processor such as Mac Mini or Macbook. If you need to test with Mac with dual-core processor, let me know and I will recompile and upload the required build.

It has been tested on mid-2011 iMac (2.8GHz Core i7, 256GB DDR, 16GB DDR3 RAM, Mac OS 10.9.2) successfully with at least 10 downloads and bandwidth between 2MB/s to 5MB/s (with 100 Mbps download and 50 Mbps upload fibre broadband Internet connection). Three downloads had been activated simultaneously without problem and no crash has been encountered so far. Make sure you have opened ports in your router to allow incoming peer connections through firewall/NAT configuration in order to achieve the above mentioned bandwidth.

Please report back any problem as soon as possible as the maintainer need to know the outcome to make version 3.1.9 build release for Mac platform.
« Last Edit: April 12, 2014, 01:35:12 AM by littletree76 »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #2 on: March 31, 2014, 02:15:15 AM »

Sure the more users test it the better is the quality confirmation. I will try to compile a dual-core version and uploaded to the same dropbox account. Would you please try to download from the link provided to confirm that there is no permission issue as I have not use dropbox for long time ?
Modify message
« Last Edit: March 31, 2014, 02:18:47 AM by littletree76 »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #3 on: March 31, 2014, 02:17:48 AM »

First of all, allow me to clarify a confusion I have caused in my previous post:
The command line option "-j4" in make command line is an option which determine how many commands can be executed in parallel during the compilation process, thus it has nothing to do with the resultant build of qbittorrent 3.1.9 rather the speed of compilation. There is no distinction between dual-core and quad-core processors as far as final build of qbittorrent is concerned. Sorry for the confusion and I will not use this command line option anymore to allow compilation process to work on any Mac model regardless of number of processor cores. Thus you may download qbittorrent 3.1.9 build from link given in previous post:

https://www.dropbox.com/sh/45qkagvurvxh3tp/UX0Ni-BVK3

Followings are complete log of the build process with these assumptions:
Mac OS 10.9.x Mavericks, 100 Mbps downlink and 50 Mbps uplink through broadband Internet, a port on Apple Time Capsule has been opened for incoming peer connections (this important step to improve download bandwidth can not be overemphasised). Last but not least, you are comfortable with standard Unix commands in Terminal application.

-- No Xcode installation is required (ignore it if you have already installed). Download and install Command Line Tools kit available at:
https://developer.apple.com/downloads/index.action
Free registration of developer account is required. Note Mac OS 10.9.x is bundled with xcode-select command and any invocation of developer's commands in Terminal application such as "xcode-select --install" or "gcc --version" will cause a popup on display to request for online installation of the tool kit from Apple update servers, just click on "Install" button to proceed.

-- Use xcode-select command to determine active developer directory: xcode-select --print-path
Either "/Applications/XCode.app/Contents/Developer" for Xcode installation or "/Library/Developer/CommandLineTools" for Command Line Tools kit installation will be displayed.
Set it to newly installed directory /Library/Developer/CommandLineTools with following command:
Code: [Select]
xcode-select --switch /Library/Developer/CommandLineTools

Alternatively environment variable DEVELOPER_DIR can be set to the desired directory as follows in your shell profile file. This environment variable overrides setting done through xcode-select command. Whichever directory selected for developer tools make no difference in compiling qbittorrent.
Code: [Select]
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer

To trash Xcode installation to recover huge disk space, simply drag the Xcode application to trash as Apple has packaged everything within this self-contained application since release of Xcode 4.3.

-- Install MacPorts according to instructions given in: https://guide.macports.org/index.html
It is not necessary to install X11 package (for X Windows applications) for qbittorrent application. The easier way is to download installer package MacPorts-2.2.1-10.9-Mavericks.pkg and install it like any applications. Use the default /opt/local root directory for installations of all Unix packages by MacPorts. Take note of proper settings of environment variables PATH (for executable binary files) and MANPATH (for manual page documentation) in your shell after installation of MacPorts.

-- Install all Unix packages required by qbittorrent application:
Code: [Select]
sudo port install qt4-mac libtorrent-rasterbar pkgconfig

Administrator password required by the command prefix sudo. All together there will be 33 Unix packages being installed, so be patient as fetching, building and installation of these packages take time particularly if your processor or Internet connection is slow. To confirm these packages have been installed:
Code: [Select]
port installed
The following ports are currently installed:
  autoconf @2.69_2 (active)
  automake @1.14.1_1 (active)
  boost @1.55.0_2+no_single+no_static+python27 (active)
  bzip2 @1.0.6_0 (active)
  db46 @4.6.21_9 (active)
  db_select @0.1_2 (active)
  dbus @1.6.12_0+startupitem (active)
  expat @2.1.0_0 (active)
  gdbm @1.11_0 (active)
  gettext @0.18.3.2_0 (active)
  icu @51.2_1 (active)
  jpeg @9a_1 (active)
  lcms @1.19_5 (active)
  libedit @20121213-3.0_0 (active)
  libgeoip @1.5.1_0 (active)
  libiconv @1.14_0 (active)
  libmng @1.0.10_3 (active)
  libpng @1.6.9_1 (active)
  libtool @2.4.2_3 (active)
  libtorrent-rasterbar @0.16.13_0+python27 (active)
  m4 @1.4.16_0 (active)
  ncurses @5.9_2 (active)
  openssl @1.0.1f_0 (active)
  perl5 @5.12.4_0+perl5_16 (active)
  perl5.16 @5.16.1_3 (active)
  pkgconfig @0.28_0 (active)
  python27 @2.7.6_0 (active)
  python_select @0.3_3 (active)
  qt4-mac @4.8.5_1 (active)
  sqlite3 @3.8.3.1_0 (active)
  tiff @4.0.3_2 (active)
  xz @5.0.5_0 (active)
  zlib @1.2.8_0 (active)


-- Download qbittorrent 3.1.9 source compressed archive and GeoIP.dat.gz compressed data file and place them in a folder under your home directory:
Code: [Select]
ls ~/project/qbittorrent
qbittorrent-3.1.9.tar.gz   GeoIP.dat.gz
cd ~/project/qbittorrent


-- Unpack qbittorrent's source code and GeoIP.dat data file as follows:
Code: [Select]
gzip -cd qbittorrent-3.1.9.tar.gz | tar -xvf -
gzip -cd GeoIP.dat.gz > qbittorrent-3.1.9/src/geoip/GeoIP.dat


-- Modify path settings in configuration file macxconf.pri
Code: [Select]
sed -i '.backup' '/^INCLUDEPATH/,/^LIBS/ s:/opt/local:/usr/local:g' qbittorrent-3.1.9/macxconf.pri


-- Change directory to create Make file and initiate compilation, the resultant qbittorrent application file will be located in src directory.
Code: [Select]
cd qbittorrent-3.1.9
qmake qbittorrent.pro
make


-- Optional steps to package and create disk image file for future distribution:
Code: [Select]
sudo macdeployqt src/qbittorrent.app -dmg


-- Clean up directory to conserve disk space as last step:
Code: [Select]
make clean

That's it, you may want to print this log for future reference.
« Last Edit: April 23, 2014, 05:54:15 PM by littletree76 »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #4 on: March 31, 2014, 02:20:57 AM »

To those who are wondering how to install Apple's Command Line Tools for developer's commands without huge Xcode installation and how to remove XCode for good, please refer to following two articles published in OSXDaily site:

http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/
http://osxdaily.com/2012/02/20/uninstall-xcode/

If you have installation of XCode version 4.3 and above, simply drag the Xcode application to trash and empty the trash, otherwise follow instructions in above article for complete removal. The difference is due to the fact that Apple has bundled all software components within self-contained Xcode application (thats why it is so huge in size and updated so often) for later versions.

There are many users install huge Xcode (5 GB in size) just to make all standard developer's commands (make, gcc, ld, cpp, clang etc with total size of just 130 MB) available in Darwin Unix environment for their software development.

qBittorrent must be configured properly to improve performance and avoid crashing due to depletion of resources on your mac. See following article on limit settings for download/upload bandwidth and number of active torrents/connections.

http://www.techsupportalert.com/optimizing-qbittorrent-speed

After you have tuned settings in qBittorrent, use following torrent to test download speed and stability. This torrent is linked to a ISO disk image file for Ubuntu installation (768 MB in size) with a lot of seeds and peers at all time. I achieved download speed of 5 MB/s without crash on my mid-2011 2.8 GHz Core i7 iMac and 100Mbps downlink / 50 Mbps uplink fibre broadband Internet connection.

https://btguard.com/support/index.php?/Knowledgebase/Article/View/4/1/how-do-i-test-my-torrent-download-speeds

« Last Edit: March 31, 2014, 03:15:51 AM by littletree76 »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #5 on: April 12, 2014, 12:47:48 AM »

Apple has just released new version of Xcode (5.1.1, downloadable for free in Apple's Mac App Store)and corresponding Command Line Tools package on 10-April-2014. Identical essential command/library/include files which make up command line tools for developer are packaged within these two installations in two different paths (/Applications/Xcode.app/Contents/Developer for Xcode and /Library/Developer/CommandLIneTools for Command Line Tools). Either path can be selected with xcode-select command as follows for compilation of qbittorrent.

% xcode-select --switch /Applications/Xcode.app/Contents/Developer
% xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

Again environment variable DEVELOPER_DIR can be set to the desired directory to override all other settings for the same purpose.
% export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer

Whether to install the huge Xcode (5 GB) or the Command Line Tools (130 MB) depends on available disk space and need for graphical development environment in developing Mac OS X and iOS applications. Command Line Tools package contains more files than Xcode installation though set of essential files are the same. Take note that for Xcode after version 4.3, locations of these command line files are actually within application package file (/Applications/Xcode.app) in Mac OS Finder.

MacPorts installation and all Unix packages ported to Mac OS X by MacPorts (all under /opt/local directory) can be upgraded to latest versions regularly as follows:

% port selfupdate
% port upgrade installed



« Last Edit: April 23, 2014, 05:45:59 PM by littletree76 »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #6 on: April 12, 2014, 01:32:32 AM »

After upgraded Xcode (Command Line Tools) and MacPorts (all ported Unix packages) to latest version, I have created a shell script build-qbittorrent.sh for automated compilation of qbittorrent. All you have to do is download all files (locate them by following the given dropbox link) to any local directory and then execute the shell script (you will be prompted for administrator password). During compilation all warning messages can be ignored safely and a disk image file qbittorrent.dmg and a log file qbittorrent-log.txt will appear in the local directory. Administrator right is required to package qbittorrent application into disk image file.

https://www.dropbox.com/sh/45qkagvurvxh3tp/UX0Ni-BVK3

% cd ~/project/qbittorrent
% ./build-qbittorrent.sh
% ls -l
total 39616
[email protected] 1 littletree  staff   3923413 Mar  1 20:43 qbittorrent-3.1.9.tar.gz
[email protected] 1 littletree  staff    357461 Mar  6 00:45 GeoIP.dat.gz
[email protected] 1 littletree  staff     30857 Mar 20 14:42 test.torrent
[email protected] 1 littletree  staff      2862 Apr 11 23:00 build-qbittorrent.sh*
-rw-r--r--  1 littletree  staff      1302 Apr 11 23:21 qbittorrent-log.txt
[email protected] 1 littletree  staff  15947184 Apr 11 23:23 qbittorrent.dmg

The same process can be repeated again and again for future releases of qbittorrent (just remember to download latest versions of the two archive files from this site). The log file is reused for each compilation run through the shell script and records date/time stamps and versions for the compilations. Of course you can just download the resultant disk image file qbittorrent.dmg for immediate installation and ignore compilation completely. A test torrent file test.torrent (for 850 MB Ubuntu installation ISO disk image file) is also provided for testing after qbittorrent has been installed. I achieved 5 MB/s download speed and completed within three minutes with 2.8 GHz Core i7 iMac and 100 Mbps / 50 Mbps fibre broadband Internet connection.

The newly compiled qbittorrent application works better than previous compiled version in that you no longer see this message "qbittorrent (not responding)" in Forced Quit Applications window (option-command-esc key combination) or Activity Monitor window.
« Last Edit: April 12, 2014, 02:40:14 AM by littletree76 »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #7 on: April 29, 2014, 01:00:31 AM »

Latest release version 3.1.9.1 of qbittorrent to fix openssl Heartbleed security issue has been compiled and tested successfully. Please download the disk image file qbittorrent-3191.dmg from usual Dropbox site:

https://www.dropbox.com/sh/45qkagvurvxh3tp/UX0Ni-BVK3

As usual you may compile on your own through the shell script build-qbittorrent.sh located at the same site. MacPorts has upgraded openssl to version 1.0.1g_0 so please upgrade all outdated Unix packages before compiling qbittorrent as follows:

sudo port selfupdate
sudo port upgrade outdated

« Last Edit: April 29, 2014, 01:10:30 AM by littletree76 »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #8 on: April 30, 2014, 05:20:41 PM »

The latest version 3.1.9.2 of qbittorrent is released for changes in Windows version and does not affect Mac version. Nevertheless I have recompiled with the new source codes and tested with test.torrent successfully. Please find all updated files at usual download site:

https://www.dropbox.com/sh/45qkagvurvxh3tp/UX0Ni-BVK3

Followings are versions of essential Unix packages ported through MacPorts and used in the compilation:

Code: [Select]
Wangs-iMac:~$ port installed qt4-mac boost libtorrent-rasterbar
The following ports are currently installed:
  boost @1.55.0_2+no_single+no_static+python27 (active)
  libtorrent-rasterbar @0.16.13_0+python27 (active)
  qt4-mac @4.8.5_1 (active)

Nemo

  • qBittorrent Forum
  • Administrator
  • Forum addict
  • *****
  • Posts: 1469
  • Karma: +91/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #9 on: April 30, 2014, 08:20:16 PM »
Thanks for your efforts littletree76 (and pyed too), much appreciated :).
Forum Rules and Guidelines

Forum Admin.
Dutch & Turkish Translator.




littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #10 on: May 01, 2014, 01:27:40 AM »

All Mac users are welcomed to try out the build. I have been using uTorrent Mac version 1.84/Beta1.9.1 for some time before decided to switch from uTorrent to qBittorrent. As far as qBittorrent is concerned, not only I can compile from latest release of source code on my mac, the user interface is more responsive during file transfers. Just look at the gap between Windows version (3.4.4) and Mac version (1.9.1) of uTorrent and you can see that Mac users have become second-class citizen for too long !

In fact after I have created the shell script build-qbittorrent.sh to automate executions for placement of data file, editing of configuration file and finally compilation, the whole process from downloading latest files to complete of compilation takes not more than half an hour on my mac. So maintenance does not take up too much time and any mac user can do it without prerequisite of technical knowledge.

I would like to invite any mac users to try out latest release (3.1.9.2) of qBittorrent either by downloading disk image file qbittorrent-3192.dmg directly or downloading all files and execute the shell script on your mac (of course it requires installations of Xcode/Command Line Tools and MacPorts first). Choice between huge Xcode and compact Command Line Tools depends on whether you need graphical development environment of Xcode for other development works (and available disk space), either one will work for compiling qBittorrent.
« Last Edit: May 01, 2014, 01:32:00 AM by littletree76 »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #11 on: May 08, 2014, 12:13:59 AM »

On Monday Dropbox has disabled some links to fix bug, but the link (to my dropbox online storage) given in previous posts for downloading files is still valid and working.

https://www.dropbox.com/sh/45qkagvurvxh3tp/UX0Ni-BVK3

I have modified the shell script build-qbittorrent.sh for automated compilation to allow compilation of latest alpha version of qbittorrent downloaded from GitHub site. All you have to do is to assign variable ARCHIVE at beginning of the shell script to suitable file name (refer to commented out line).

The Unix package qt4-mac has been upgraded to version 4.8.6 and latest release version of qbittorrent 3.1.9.2 has been recompiled with new version of qt4-mac and tested with test.torrent without issue.

As usual, updated files qbittorrent-3192.dmg, build-qbittorrent.sh  and qbittorrent-log.txt have been uploaded to the dropbox site.

Code: [Select]
gs-iMac:~/project/qbittorrent$ sudo port selfupdate
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.2.1 installed,
MacPorts base version 2.2.1 downloaded.
--->  Updating the ports tree
--->  MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated
Wangs-iMac:~/project/qbittorrent$ sudo port upgrade outdated
--->  Computing dependencies for qt4-mac
--->  Fetching archive for qt4-mac
--->  Attempting to fetch qt4-mac-4.8.6_0.darwin_13.x86_64.tbz2 from http://jog.id.packages.macports.org/macports/packages/qt4-mac
--->  Attempting to fetch qt4-mac-4.8.6_0.darwin_13.x86_64.tbz2 from http://lil.fr.packages.macports.org/qt4-mac
--->  Attempting to fetch qt4-mac-4.8.6_0.darwin_13.x86_64.tbz2.rmd160 from http://lil.fr.packages.macports.org/qt4-mac
--->  Installing qt4-mac @4.8.6_0
--->  Cleaning qt4-mac
--->  Computing dependencies for qt4-mac
--->  Deactivating qt4-mac @4.8.5_1
--->  Cleaning qt4-mac
--->  Activating qt4-mac @4.8.6_0
NOTE: Qt database plugins for mysql55, postgresql91, and sqlite2 are NOT installed by this port; they are installed by qt4-mac-*-plugin instead.
--->  Cleaning qt4-mac
--->  Updating database of binaries: 100.0%
--->  Scanning binaries for linking errors: 100.0%
--->  No broken files found.
« Last Edit: May 08, 2014, 06:28:03 AM by littletree76 »

Nemo

  • qBittorrent Forum
  • Administrator
  • Forum addict
  • *****
  • Posts: 1469
  • Karma: +91/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #12 on: May 08, 2014, 09:12:08 PM »
Thanks mate :).
Forum Rules and Guidelines

Forum Admin.
Dutch & Turkish Translator.




littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #13 on: May 09, 2014, 03:31:39 PM »

I have refined the build script build-qbittorrent further by eliminating the need to edit this script file for building both release (3.1.9.2) and alpha (3.2.0) versions of source code. All you have to do is to download compressed archive file (qbittorrent-3.1.9.2.tar.gz or qBittorrent-master.zip in different formats) from this website or GitHub site and place them together with all other files within a directory. Note do not modify file names of the downloaded files as the script relies on proper file names to work. Then execute the script with following command line options/arguments in the directory contains all files (you can't go wrong as there are stringent checks in the script):

./build-qbittorrent -v release
./build-qbittorrent -v alpha

Another enhancement made to the script is all listings on display have been channeled to log files: qmake.log for qmake command, make.log for make command and qbittorrent.log for overall logging. File listing on display caused by extraction of source files from compressed archive file has also been eliminated (nobody want to read such uninteresting file listing).

I have also provided the downloaded archive file and disk image file for alpha version 3.2.0 of qbittorrent in the dropbox site. Feel free to try out the latest version 3.2.0 with extra features such as tray icon in notification area at right corner of menu bar of Mac OS Finder (unavailable in release version 3.1.9.2). Thus it is no longer necessary to maintain qbittorrent window in display during lengthy file transfers. Take note that this is a alpha version and might not be as stable as the release version 3.1.9.2, so use/test it at your own risk and please report back any bug you have found. As far as I am concerned, I have been using the alpha version 3.2.0 for all file transfers without issue so far.

« Last Edit: May 10, 2014, 05:43:43 PM by littletree76 »

sledgehammer_999

  • qBittorrent maintainer
  • Administrator
  • Forum addict
  • *****
  • Posts: 2398
  • Karma: +148/-1
    • View Profile
Re: Compiling latest qBittorrent with MacPorts package manager
« Reply #14 on: May 10, 2014, 12:24:01 AM »
@littletree76

Could you help me migrate the build system to autotools so you won't have to edit macxconf.pri manually?

1. Download git master
2. Replace macxconf.pri with these contents: http://pastebin.com/gud9u3nN
3. Install necessary libs from macports/homebrew
4. ./configure --with-geoip-database-embedded
5. make
6. make install

And then whatever you do to package it. You can also give the --prefix arg to configure. Just be sure to always use "--with-geoip-database-embedded".

If it fails please share the config.log file and whatever is the output in the terminal. Thanks.

EDIT: You'll need pkg-config too for the library detection.