Skip to content

Compiling gImageReader

strixaluco edited this page Jul 27, 2017 · 21 revisions

If you would like to compile gImageReader from source, follow these steps:

Linux (various distributions)

  1. Make sure you have cmake and a C++ compiler supporting C++11 installed.
  2. Install the development packages of the following required build dependencies ([Gtk], [Qt5] and [Qt4] indicate dependencies required for compiling the respective gImageReader interface):
  • tesseract (>=3.03.00, recommended 3.04.00 or newer)
  • sane
  • podofo
  • libjpeg
  • [Gtk] gtkmm
  • [Gtk] gtkspellmm (>=3.0.5)
  • [Gtk] gtksourceviewmm
  • [Gtk] cairomm
  • [Gtk] poppler-glib
  • [Gtk] json-glib
  • [Gtk] libxml++
  • [Qt5] qt5-qtbase
  • [Qt5] qtspell-qt5
  • [Qt5] poppler-qt5
  • [Qt4] qt4
  • [Qt4] qtspell-qt4
  • [Qt4] poppler-qt4

For Debian based systems, the specific package names are those listed as Build-Dependsin the package control file.

For Fedora based systems, the specific package names are those listed as BuildRequires in the package spec file.

  1. Configure the build: from within the extracted source tarball or git clone folder, type

     $ mkdir build
     $ cd build
     $ cmake -DINTERFACE_TYPE=<type> ..
    

where <type> is either gtk, qt5, qt4. The qt4 interface is only recommended if your distribution does not provide Qt5 >= 5.5.0 (Qt5 < 5.5.0 suffer from QTBUG-43562 which causes gImageReader to crash).

Other standard cmake configuration options (such as CMAKE_INSTALL_PREFIX) can also be specified, type ccmake .. inside the build folder to start the cmake configuration editor which lists all available configuration options.

  1. Compilation: from within the created build directory, type

     make
    
  2. Installing: from within the created build directory, type

     make install
    
  3. Alternatively to installing the application with make install, it can also be run from within the build directory.

  • For the Qt4 and Qt5 variants, it is sufficient to type from within the build directory

       ./gimagereader-qt5 # or ./gimagereader-qt4
    
  • For the Gtk variant, one needs to first add the local glib schema directory to XDG_DATA_DIRS before running the application:

       export XDG_DATA_DIRS=$PWD:$XDG_DATA_DIRS
       ./gimagereader-gtk
    

Windows

Official Windows builds are cross-compiled from Fedora using its MinGW environment, which contains all required dependencies. Compilation on Windows itself has never been attempted by the author, and likely requires several dependencies to be compiled from source before even getting to compile gImageReader. Compilation from other distributions providing a reasonably complete MinGW environment might also work, though likely some build dependencies will need to be compiled first.

Cross-compiling Windows builds from Fedora

  1. Install all needed dependency packages, in particular mingw{32,64}-gcc-c++, mingw32-nsis, mingw{32,64}-twaindsm (latter is available from this COPR repository) and the mingw variant of the dependencies listed in the package spec file (for example gtkmm30-devel -> mingw{32,64}-gtkmm30). If you intend to build for 32-bit Windows, you'll need the ming32-* packages, for 64-bit Windows you'll need the mingw64-* packages.

  2. Change directory to packaging/win32 and run the build script makeinstaller.sh which performs the compilation and generates the installers (this script is written specifically for usage with Fedora's MinGW toolchain, so it may need tweaking when used in other distros). The script takes two optional arguments: the target architecture and the desired interface type, for example

     ./makeinstaller.sh i686 qt5
    

will produce an installer for the Qt5 interface compiled for 32-bit Windows. For 64-bit Windows, use x86_64 instead of i686.

Clone this wiki locally