Skip to content

Compiling gImageReader

hendrack edited this page Mar 8, 2024 · 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 [Qt6] indicate dependencies required for compiling the respective gImageReader interface):

    • tesseract (>=3.03.00, recommended 3.04.00 or newer)
    • sane
    • podofo
    • libjpeg
    • djvulibre
    • intltool
    • libzip
    • libuuid
    • libxml-cpp
    • [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
    • [Qt5] quazip-qt5
    • [Qt6] qt6
    • [Qt6] qtspell-qt6
    • [Qt6] poppler-qt6
    • [Qt6] quazip-qt6

    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.

  3. 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, qt6.

    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.

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

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

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

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

         ./gimagereader-qt5 # or ./gimagereader-qt6
      
    • For the Gtk variant, one needs to ensure the path to the local glib schemas is added to XDG_DATA_DIRS when running the application:

         XDG_DATA_DIRS=$PWD:$XDG_DATA_DIRS ./gimagereader-gtk
      
  7. Note for musl-libc systems:

    On systems with the musl C library you need to edit CMakeLists.txt and add one line to TARGET_LINK_LIBRARIES:

    TARGET_LINK_LIBRARIES(gimagereader
    ${TESSERACT_LDFLAGS}
    ${gimagereader_LIBS}
    ${SANE_LDFLAGS}
    ${ddjvuapi_LDFLAGS}
    ${ENCHANT_LDFLAGS}
    ${PODOFO_LDFLAGS}
    -ldl
    -lintl
    )

    The linker is expecting some gettext symbols which are present in glibc, but not in musl.

Windows

The easiest way to compile gImageReader for Windows is by using the provided Docker image, performing the following steps from the root directory of the gImageReader source tree:

  1. Build the image (only required once resp. periodically to update it):

    docker build -t gimagereader_buildenv packaging/win32
    
  2. Compile gImageReader and build the installers:

    • 32-bit build:

      docker run -v $PWD:/workspace gimagereader_buildenv packaging/win32/makeinstaller.sh i686 qt5
      
    • 64-bit build:

      docker run -v $PWD:/workspace gimagereader_buildenv packaging/win32/makeinstaller.sh x86_64 qt5
      
    • Note: If the build fails with errors such as

      RCC: Error in '/workspace/qt/data/gimagereader.qrc': Cannot find file '../../data/icons/angle.png'
      

      try running docker with --security-opt seccomp:unconfined, i.e.

      docker run --security-opt seccomp:unconfined -v $PWD:/workspace gimagereader_buildenv packaging/win32/makeinstaller.sh x86_64 qt5
      
  3. The built installers can then be found inside the build trees:

    • 32-bit build: build/mingw32-qt5/gImageReader_$VERSION_qt5_i686.exe
    • 64-bit build: build/mingw64-qt5/gImageReader_$VERSION_qt5_x86_64.exe
Clone this wiki locally