Author Topic: MAC builders: test new build system  (Read 2385 times)

sledgehammer_999

  • qBittorrent maintainer
  • Administrator
  • Forum addict
  • *****
  • Posts: 2406
  • Karma: +150/-2
    • View Profile
MAC builders: test new build system
« on: May 13, 2014, 06:52:55 pm »
Hi, to all potential MAC builders.

For v3.2.0 I migrated the build system to autotools. If you have time, please help me test it.
You'll need the latest git master which can be found here. If you don't want to set up git on your machine you can always download the code from as zip file. (click the "download zip" button at right side).
Then you need to replace the macxconf.pri file with this content: http://pastebin.com/mTV8U8MW

To build:
1. Open a terminal
2. cd into the source dir (where qbittorrent.pro is)
3. Issue "./configure --with-geoip-database-embedded"
4. Issue "make"

Of course you'll need to install from homebrew/macports : qt, libtorrent, boost, openssl, zlib, pkg-config

What I want you to test?

1. If a standard qt4 build compiles and works fine.
2. If a qt5 build compiles and works fine. (if homebrew/macports provides a package for qt5). Use "--with-qt5"
3. If a nox build (headless) compiles and works fine. In this case use "--disable-gui" and drop "--with-geoip-database-embedded"
4. Combine number 2 and 3.
5. In number 1 try to remove this line from macxconf.pri "LIBS += -framework Carbon -framework IOKit" and see if the compilation finishes.

NOTE: For the nox build I have disabled the making of an app_bundle. Only a binary is made. However, what should be done about the translations? The binary doesn't contain them, they are always contained in the bundle. Should I re-enalbe the making of a bundle even for the nox build?

NOTE2: If something fails please post here (or on pastebin):
1. config.log
2. Terminal output
3. any other log that might get created.

Thank you.
« Last Edit: May 13, 2014, 06:57:52 pm by sledgehammer_999 »

pyed

  • Newbie
  • *
  • Posts: 14
  • Karma: +3/-0
    • View Profile
Re: MAC builders: test new build system
« Reply #1 on: May 14, 2014, 01:26:40 am »
well here's my testing results, I had to re-install my qt via home-brew with d-bus included, and I had to install 'zlib' via home-brew too, although I think OS X provides a version of zlib.

so my env is:
brew install qt --with-d-bus
brew install libtorrent-rasterbar    <-- this will install 'boost' and 'pkg-config' as dependency
brew install openssl    <-- you have to --force link it, cuz it's a keg-only
brew install https://raw.githubusercontent.com/Homebrew/homebrew-dupes/master/zlib.rb      <-- zlib formula is located on homebrew-dupes, since OSX provide it's own version but I had to install this one for this to work.

my first attempt:
 - I downloaded the latest git master.
 - replaced 'macxconf.pri' with the provided pastebin file.
 - then I placed the 'GeoIP.Dat' at `src/geoip`
 - issued: "./configure --with-geoip-database-embedded"
 - issued: "make"

this one was successful and I was able to package a working 'qbittorrent.app' which works fine for me

my second attempt:
 - I downloaded the latest git master.
 - replaced 'macxconf.pri' with the provided pastebin file and deleted the 12th line "LIBS += -framework Carbon -framework IOKit"
 - then I placed the 'GeoIP.Dat' at `src/geoip`
 - issued: "./configure --with-geoip-database-embedded"
 - issued: "make"

this one failed with this error: http://pastebin.com/NDNWkxCf
and here's the config.log from this attempt : http://pastebin.com/CQRAU5YJ

I hope this was helpful, If I have more time I'll test qt5 and the nox build.
« Last Edit: May 14, 2014, 01:31:17 am by pyed »

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: MAC builders: test new build system
« Reply #2 on: May 14, 2014, 04:31:34 am »

I downloaded compressed archive file (qBittorrent-master.zip) for latest master branch from GitHub site: https://github.com/qbittorrent/qBittorrent and created latest macxconf.pri configuration file with content given by you (named macxconf.pri.autotools). The build shell script build-qbittorrent has been updated with following lines:

-- Generation of Makefile for compilation, followed by make command to initiate compilation, linking and code generation and finally package application file for installation. The build mode (held in variable $VERSION with valid values: release / alpha / nox / test) determines how the Makefile is generated and how application file should be packaged.

Code: [Select]
case $VERSION in
release) $sed -i '.backup' '/^INCLUDEPATH/,/^LIBS/ s:/opt/local:/usr/local:g' ./macxconf.pri
$qmake qbittorrent.pro &> $CONFIGURE_LOG
;;
alpha) $cp -f $PROJECT_DIR/macxconf.pri.autotools ./macxconf.pri
./configure --with-geoip-database-embedded &> $CONFIGURE_LOG
;;
nox) $cp -f $PROJECT_DIR/macxconf.pri.autotools ./macxconf.pri
./configure --disable-gui &> $CONFIGURE_LOG
;;
test) $cp -f $PROJECT_DIR/macxconf.pri.autotools ./macxconf.pri
./configure --with-geoip-database-embedded &> $CONFIGURE_LOG
;;
esac

### Initiate compilation, linking and code generation.
### Resultant application file is located in src subdirectory.

$make &> $MAKE_LOG

### Package application file for installation and distribution accoding to build mode.
### Set ownerships of disk image file to current user rather than stay with administrator.

cd $LATEST_DIR/src

case $VERSION in
release|alpha|test) $macdeployqt qbittorrent.app -dmg
$mv ./qbittorrent.dmg $PROJECT_DIR/qbittorrent-$VERSION.dmg
$chown $OWNER:staff $PROJECT_DIR/qbittorrent-$VERSION.dmg
;;
nox) $cp ./qbittorrent-nox.app/Contents/MacOS/qbittorrent-nox $PROJECT_DIR
$chown $OWNER:staff $PROJECT_DIR/qbittorrent-nox
;;
esac

Application files (qbittorrent-alpha.dmg and qbittorrent-nox) have been built successfully for alpha and nox versions (both use version 3.2.0 source code and new macxconf.pri file). When the line for Carbon library (cater for transition from Mac OS 9 to Mac OS 10) "LIBS += -framework Carbon -framework IOKit" is commented out, following error happened during make process.

Code: [Select]
Wangs-iMac:~/project/qbittorrent$ ls -l 
total 17104
-rw-r--r--@ 1 littletree  staff    30857 Mar 20 14:42 test.torrent
-rw-r--r--@ 1 littletree  staff   383542 Apr  3 02:17 GeoIP.dat.gz
-rw-r--r--@ 1 littletree  staff  3923531 Apr 30 03:35 qbittorrent-3.1.9.2.tar.gz
-rw-r--r--@ 1 littletree  staff  4394659 May 14 01:50 qBittorrent-master.zip
-rw-r--r--  1 littletree  staff     2346 May 14 02:00 macxconf.pri.autotools
-rwxr-xr-x@ 1 littletree  staff     6385 May 14 03:29 build-qbittorrent*
Wangs-iMac:~/project/qbittorrent$
Wangs-iMac:~/project/qbittorrent$ ./build-qbittorrent -h

Usage:
  build-qbittorrent -v release - Building release version.
  build-qbittorrent -v alpha - Building alpha version.
  build-qbittorrent -v nox - Command line Bittorrent client in Unix.
  build-qbittorrent -v test - For software development test only.
  build-qbittorrent -h - Display help message.

Code: [Select]
Wangs-iMac:~/project/qbittorrent$ tail -27 make.log
Undefined symbols for architecture x86_64:
  "_AECreateAppleEvent", referenced from:
      misc::shutdownComputer(bool) in misc.o
  "_AECreateDesc", referenced from:
      misc::shutdownComputer(bool) in misc.o
  "_AEDisposeDesc", referenced from:
      misc::shutdownComputer(bool) in misc.o
  "_AESend", referenced from:
      misc::shutdownComputer(bool) in misc.o
  "_FSFindFolder", referenced from:
      fsutils::QDesktopServicesDataLocation() in fs_utils.o
      fsutils::QDesktopServicesCacheLocation() in fs_utils.o
  "_FSRefMakePath", referenced from:
      fsutils::QDesktopServicesDataLocation() in fs_utils.o
      fsutils::QDesktopServicesCacheLocation() in fs_utils.o
  "_IOPMAssertionCreate", referenced from:
      PowerManagement::setActivityState(bool) in powermanagement.o
      PowerManagement::setBusy() in powermanagement.o
  "_IOPMAssertionRelease", referenced from:
      PowerManagement::setActivityState(bool) in powermanagement.o
      PowerManagement::setIdle() in powermanagement.o
  "___CFConstantStringClassReference", referenced from:
      CFString in powermanagement.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [qbittorrent.app/Contents/MacOS/qbittorrent] Error 1
make: *** [sub-src-make_default] Error 2

Note the resultant nox build still ended up with standard Mac OS application package (qbittorrent-nox.app) with unnecessary graphic files for graphical user interface. Fortunately it is straight forward to extract the mere Unix executable from the application package content through following path (after all Mac OS X is built on top of Apple Darwin Unix):

./qbittorrent-nox.app/Contents/MacOS/qbittorrent-nox

I suggest all unnecessary components should be removed from the nox build (perhaps the whole Qt cross-platform user interface package is not needed ?) and it should be installed with standard "make install" command just like any other Unix executables. The GeoIP data file is not needed because web interface of qbittorrent does not display any country flags.

Both alpha and nox builds have been tested successfully with my test.torrent file (disk image ISO file for Ubuntu installation) with following issues:

-- Daemon mode of nox build does not work at all with application process disappeared from process space completely. Of course you can always improvise in any Unix shell to run it as background process:

Code: [Select]
Wangs-iMac:~/project/qbittorrent$ ./qbittorrent-nox &
[1] 786
Wangs-iMac:~/project/qbittorrent$
******** Information ********
To control qBittorrent, access the Web UI at http://localhost:8080
The Web UI administrator user name is: admin
The Web UI administrator password is still the default one: adminadmin
This is a security risk, please consider changing your password from program preferences.
14/05/2014 08:50:53 - The Web UI is listening on port 8080
14/05/2014 08:50:54 - qBittorrent is successfully listening on interface 0.0.0.0 port: TCP/54340
14/05/2014 08:50:54 - qBittorrent is successfully listening on interface :: port: TCP/54340
14/05/2014 08:50:54 - External IP: 175.156.69.19

-- Whatever settings changed in web interface do not have any effect at all (because of running as background process ?). You still have to change these settings in normal graphical interface of qbitttorrent before running the nox build.

-- Exiting qbittorrent Unix application in web interface does not work when it is running as background process, Unix kill command is required to achieve the purpose.

Otherwise the test file was downloaded successfully within 15 minutes with many seeds and no peers through 100/50 Mbps fibre broadband connection. I prefer the nox build over normal build as it takes up less system resources and working in background.

May I know when are you going to check in new version of macxconf.pri file (only the first line excluding comment lines is different), I will update my build shell script for the change. All updated files have been uploaded to my dropbox site for public download. Results of alpha build and nox build (qbittorrent-alpha.dmg and qbittorrent-nox) have been uploaded as well for those who are not bothered to compile on their own on their Mac computers.

« Last Edit: May 14, 2014, 04:44:44 am by littletree76 »

sledgehammer_999

  • qBittorrent maintainer
  • Administrator
  • Forum addict
  • *****
  • Posts: 2406
  • Karma: +150/-2
    • View Profile
Re: MAC builders: test new build system
« Reply #3 on: May 14, 2014, 11:05:23 pm »
@pyed

Maybe you are right. Dbus seems to be needed/used only for linux/bsd. I'll have to rework my configure script.
Can you test something so I can confirm this? Locate the binary that you built using the configure script and issue in a terminal "ldd qbittorrent". Then copy the output here
Also I'll see what I can do about system zlib detection...

The "LIBS += blah blah" removal was a test to see if it is actually needed or if qmake automatically appends those libs. This isn't the case. They should remain in macxconf.pri.

@littletree76

I thought that "CONFIG -= app_bundle" in macxconf.pri was enough. I might need to pass this directly to qmake instead...

About the rest of the behavioral problems of nox: I think it works the same way in Linux(background process, doesn't exit). I have never tested the nox build. About the install target + translations that makes sense actually...
The new macxconf.pri + autotools is work in progress. When they are working they'll get merged into master.

@all

Subscribe to this topic, so when I publish new scripts to test you'll get notified.

Thanks for your tests and time.

pyed

  • Newbie
  • *
  • Posts: 14
  • Karma: +3/-0
    • View Profile
Re: MAC builders: test new build system
« Reply #4 on: May 15, 2014, 06:38:40 pm »
@sledgehammer_999
OSX doesn't have "ldd" we got "otool" instead:
Code: [Select]
>$ otool -L qbittorrent
qbittorrent:
/usr/local/lib/libtorrent-rasterbar.7.dylib (compatibility version 8.0.0, current version 8.0.0)
/usr/local/lib/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/opt/zlib/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/usr/local/lib/libboost_system.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/usr/local/lib/QtXml.framework/Versions/4/QtXml (compatibility version 4.8.0, current version 4.8.6)
/usr/local/lib/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.6)
/usr/local/lib/QtGui.framework/Versions/4/QtGui (compatibility version 4.8.0, current version 4.8.6)
/usr/local/lib/QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.6)
/usr/local/lib/libdbus-1.3.dylib (compatibility version 12.0.0, current version 12.4.0)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 855.16.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 59.0.0)

and the binary is located at "/src/qbittorrent.app/Contents/MacOS/qbittorrent"

littletree76

  • Member
  • **
  • Posts: 67
  • Karma: +3/-0
    • View Profile
Re: MAC builders: test new build system
« Reply #5 on: May 16, 2014, 03:01:17 am »

Followings are what I have found in nox build of qbittorrent:

-- QtNetwork and QtCore frameworks are used in building the nox version of qbittorrent.
-- Carbon and IOKit frameworks are required for Mac version of qbittorrent.

Code: [Select]
Wangs-iMac:~/project/qbittorrent$ file qbittorrent-nox
qbittorrent-nox: Mach-O 64-bit executable x86_64
Wangs-iMac:~/project/qbittorrent$ otool -L qbittorrent-nox
qbittorrent-nox:
/opt/local/lib/libtorrent-rasterbar.7.dylib (compatibility version 8.0.0, current version 8.0.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.8)
/opt/local/lib/libboost_system-mt.dylib (compatibility version 0.0.0, current version 0.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 157.0.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/opt/local/Library/Frameworks/QtNetwork.framework/Versions/4/QtNetwork (compatibility version 4.8.0, current version 4.8.6)
/opt/local/Library/Frameworks/QtCore.framework/Versions/4/QtCore (compatibility version 4.8.0, current version 4.8.6)
/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 59.0.0)

Allow me to reiterate requirements for nox build:

-- No extra components and packaging for graphical user interface are required.
-- No GeoIP.Dat data file is required for translation between IP addresses and countries to display country flags.
-- No language translation is required as this is strictly a Unix command-line application (unless you want manual page in multiple languages).
-- Daemon mode of qbittorrent process has to be fixed for proper execution and termination of the process.
-- Whatever working in graphical user interface of normal qbittorrent must be working in web interface as well.


« Last Edit: May 16, 2014, 03:07:44 am by littletree76 »