Building Subsurface from Source =============================== Subsurface uses quite a few open source libraries and frameworks to do its job. The most important ones include libdivecomputer, Qt, Marble (more precisely libmarblewidget), libxml2, libxslt, libsqlite3, libzip, libgrantlee5 and libgit2. Below are instructions for building Subsurface under some popular Linux distributions, for building Subsurface using Homebrew on a Mac, and for cross-building Subsurface for Windows. The lack of a working package management system for Windows makes it really painful to build Subsurface natively under Windows, so we don't support that at all. All of the prebuilt binaries that we provide (right now Windows, Mac, Ubuntu/Debian/LinuxMint, and openSUSE/Fedora) are built using our own custom "flavors" of libdivecomputer and libmarblewidget. You can get these from git://git.subsurface-divelog.org/marble (in the Subsurface-branch branch) git://git.subsurface-divelog.org/libdc (in the Subsurface-branch branch) Those branches won't have a pretty history and will include ugly merges, but they should always allow a fast forward pull that tracks what we believe developers should build against. In contrast to that both repositories also have Subsurface-clean branches. These should allow distros to see which patches we have applied on top of upstream. They will receive force pushes as we rebase to newer versions of upstream so they are not ideal for ongoing development (but they are of course easy to use for distributions as they always build "from scratch", anyway). The rationale for this is that we have no intention of forking either of these two projects. We simply are adding a few patches on top of their latest versions and want to do so in a manner that is both easy for our developers who try to keep them updated frequently, and anyone packaging Subsurface or trying to understand what we have done relative to their respective upstreams. At this point Qt5 is required, Qt5.4 or newer is recommended and on the Mac, in order to get native Bluetooth support, Qt5.5 is necessary. Similarly, in order for our cloud storage to be fully functional you need libgit2 0.23 or newer. Finally, as of Subsurface 4.5 we have switched our build system to cmake. qmake based builds are no longer supported. Build options for Subsurface ---------------------------- The following options are recognized when passed to cmake: -DCMAKE_BUILD_TYPE=Release create a release build -DCMAKE_BUILD_TYPE=Debug create a debug build The Makefile that was created using cmake can be forced into a much more verbose mode by calling make VERBOSE=1 Many more variables are support, the easiest way to interact with them is to call ccmake . in your build directory. Building the development version of Subsurface under Linux ---------------------------------------------------------- On Fedora you need sudo yum install git gcc-c++ make autoconf automake libtool cmake \ libzip-devel libxml2-devel libxslt-devel libsqlite3x-devel \ libgit2-devel libudev-devel libusbx-devel libcurl-devel libssh2-devel\ qt5-qtbase-devel qt5-qtdeclarative-devel qt5-qtscript-devel \ qt5-qtwebkit-devel qt5-qtsvg-devel qt5-qttools-devel \ qt5-qtconnectivity-devel qt5-qtlocation-devel Note that beginning with Fedora 22, you should be using the dnf command instead as yum is being deprecated. Package names are sadly different on OpenSUSE sudo zypper install git gcc-c++ make autoconf automake libtool cmake libzip-devel \ libxml2-devel libxslt-devel sqlite3-devel libgit2-devel libusb-1_0-devel \ libqt5-linguist-devel libqt5-qttools-devel libQt5WebKitWidgets-devel \ libqt5-qtbase-devel libQt5WebKit5-devel libqt5-qtsvg-devel \ libqt5-qtscript-devel libqt5-qtdeclarative-devel \ libqt5-qtconnectivity-devel libqt5-qtlocation-devel libcurl-devel On Debian Jessie and recent Ubuntu flavors this seems to work sudo apt-get install git g++ make autoconf libtool cmake pkg-config \ libxml2-dev libxslt1-dev libzip-dev libsqlite3-dev \ libusb-1.0-0-dev libgit2-dev \ qt5-default qt5-qmake qtchooser qttools5-dev-tools libqt5svg5-dev \ libqt5webkit5-dev libqt5qml5 libqt5quick5 libqt5declarative5 \ qtscript5-dev libssh2-1-dev libcurl4-openssl-dev qttools5-dev \ qtconnectivity5-dev qtlocation5-dev On PCLinuxOS you appear to need the following packages su -c "apt-get install -y autoconf automake cmake libtool gcc-c++ git \ lib64usb1.0-devel lib64zip-devel lib64qt5webkitwidgets-devel qttools5 \ qttranslations5 lib64qt5xml-devel lib64qt5test-devel lib64qtscript-devel \ lib64qt5svg-devel lib64qt5concurrent-devel lib64qt5bluetooth-devel" In order to build Subsurface, use the supplied build script. This should work on most systems that have all the prerequisite packages installed. You should have Subsurface sources checked out in a sane place, something like this: mkdir -p ~/src cd ~/src git clone git://subsurface-divelog.org/subsurface ./subsurface/scripts/build.sh # <- this step will take quite a while as it # compiles a handful of libraries before # building Subsurface Now you can run Subsurface like this: cd ~/src/subsurface/build ./subsurface Note: on many Linux versions (for example on Kubuntu 15.04) the user must belong to the dialout group. You may need to run something like sudo usermod -a -G dialout username with your correct username and log out and log in again for that to take effect. If you get errors like: ./subsurface: error while loading shared libraries: libGrantlee_Templates.so.5: cannot open shared object file: No such file or directory You can run the following command: sudo ldconfig ~/src/install-root/lib Building Subsurface under MacOSX (using Homebrew) ------------------------------------------------- 0) You need to have XCode installed. The first time (and possibly after updating OSX) you need to run $ xcode-select --install 1) Install Homebrew $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2) Install needed dependencies $ brew install asciidoc libzip sqlite cmake libusb pkg-config automake libtool hidapi libxml2 curl openssl libssh2 3) Make the brew version of sqlite the default $ brew link --force sqlite 4) Download and install Qt You can build Qt from source or use the prebuilt binaries for Mac. Start by downloading the online installer: $ curl -L -o ~/Downloads/qt-unified-mac-x64-online.dmg \ http://download.qt.io/official_releases/online_installers/qt-unified-mac-x64-online.dmg $ open ~/Downloads/qt-unified-mac-x64-online.dmg Double click on the Qt installer shown in the Finder window. In the installer, chose an install folder (the build script we are using below assumes that you accept the default of /home//Qt), in "Select components" select the most recent version and (if you want to build Qt from source) be sure you also install the "Source Components". To save time and disk space you can unselect Android and IOS packages as well as QtWebEngine, Qt3D, Qt Canvas 3D and the Qt Extras. If you want to build from source (which takes a very long time and a lot of disk) $ cd ~/Qt/5.5/Src/ $ ./configure -prefix /usr/local -opensource $ make -j4 $ make install 5) run the build script cd ~/src bash subsurface/scripts/build.sh After the above is done, Subsurface.app will be available in the subsurface/build directory. You can run Subsurface with the command $ open subsurface/build/Subsurface.app or you can move this folder to /Applications to install Subsurface for every user. Cross-building Subsurface on Linux for Windows ---------------------------------------------- Subsurface builds nicely with MinGW - the official builds are done as cross builds under Linux (currently on Ubuntu 14.04). A shell script to do that (plus the .nsi file to create the installer with makensis) are included in the packaging/windows directory. Please read through the explanations and instructions in packaging/windows/mxe-based-build.sh if you want to build the Windows version on your Linux system. Building Subsurface on Windows ------------------------------ This is NOT RECOMMENDED. To the best of our knowledge there is one single person who regularly does this. The Subsurface team does not provide support for Windows binary build from sources natively under Windows... Building Subsurface for Android ------------------------------- To compile the mobile version you will need: -Qt for Android (this can be downloaded from: http://www.qt.io/download-open-source/) -Android SDK -Android NDK In the packaging/android folder, open the build.sh file and add the paths to the SDK, NDK and Qt for android at the top. After that, you can run: ./subsurface/packaging/android/build.sh This will generate an apk file in ./subsurface-mobile-build-arm/bin