Installation

GixSQL is distributed as source code. This chapter explains how to build and install it on GNU/Linux. Building for Windows (Visual Studio or MSYS2/MinGW) is described in Building on Windows.

Requirements

To build GixSQL, you need:

  • a C++17 compiler (GCC 8 or later, or Clang);
  • the autotools (autoconf, automake, libtool) and pkg-config, when building from the git repository;
  • bison 3.7 or later and flex;
  • the development package of spdlog (and of fmt, its dependency);
  • for each database driver you want, the development package of its client library:
Driver Debian/Ubuntu package Notes
pgsql libpq-dev
mysql libmariadb-dev (or libmysqlclient-dev)
odbc unixodbc-dev plus the ODBC driver of the database
oracle none to build the Oracle client libraries (Instant Client) are needed at run time
sqlite none SQLite is built in

On Debian or Ubuntu:

$ sudo apt install build-essential autoconf automake libtool pkg-config \
    bison flex libspdlog-dev libfmt-dev \
    libpq-dev libmariadb-dev unixodbc-dev

To run the programs, you also need GnuCOBOL (cobc and libcob).

Building from the git repository

$ git clone https://github.com/superbol4gnucobol/gixsql-superbol.git
$ cd gixsql-superbol
$ autoreconf -fi
$ mkdir _build && cd _build
$ ../configure --prefix=/opt/gixsql
$ make
$ sudo make install

The generated autotools files are not stored in the repository: autoreconf -fi is always needed after a clone.

Configuration options

By default, configure builds the precompiler and every driver whose client library is found. The following options change this behavior:

Option Effect
--enable-gixpp / --disable-gixpp build the precompiler gixpp (default: yes)
--disable-pgsql do not build the PostgreSQL driver
--disable-oracle do not build the Oracle driver
--disable-mysql do not build the MySQL/MariaDB driver
--disable-odbc do not build the ODBC driver
--disable-sqlite do not build the SQLite driver
--with-default-driver=DRIVER driver used when the connection string does not name one: none (default), pgsql, oracle, mysql, odbc, sqlite (see The default driver)

When a driver is explicitly enabled (--enable-pgsql) and its client library is missing, configure fails; otherwise the driver is silently skipped. Check the summary printed at the end of configure.

For example, to build only the precompiler:

$ ../configure --disable-mysql --disable-odbc --disable-pgsql \
               --disable-oracle --disable-sqlite --enable-gixpp

To build the runtime with PostgreSQL and Oracle only:

$ ../configure --prefix=/opt/gixsql --disable-mysql --disable-odbc --disable-sqlite

Installed files

With --prefix=/opt/gixsql, make install installs:

File Description
bin/gixpp the precompiler
lib/libgixsql.so the runtime library, linked with the programs
lib/libgixsql-<driver>.so the database drivers, loaded at run time
share/gixsql/copy/SQLCA.cpy the SQLCA copybook
NoteTo be verified

Check the exact list and paths of installed files (make install DESTDIR=...).

At run time, libgixsql loads the driver libgixsql-<driver>.so with dlopen: the lib directory must be in the library search path, for example:

$ export LD_LIBRARY_PATH=/opt/gixsql/lib:$LD_LIBRARY_PATH

Building with Nix

The repository contains a Nix flake:

$ nix build .#runtime     # the runtime, with the Oracle and PostgreSQL drivers
$ nix build .#gixpp       # the precompiler only
$ result/bin/gixpp --version

Building on Windows

Visual Studio

The solution file gixsql.sln builds GixSQL with Visual Studio 2019 or later. The dependencies are expected from vcpkg:

> vcpkg install libpq:x64-windows libmariadb:x64-windows fmt:x64-windows-static-md spdlog:x64-windows-static-md

MSYS2/MinGW

The configure script also works under MSYS2, with the packages:

$ pacman -S mingw-w64-x86_64-pkg-config autoconf make automake libtool bison flex \
    mingw-w64-x86_64-gcc mingw-w64-x86_64-postgresql mingw-w64-x86_64-libmariadbclient \
    mingw-w64-x86_64-unixodbc mingw-w64-x86_64-spdlog
Warning

The Windows builds are not tested by the SuperBOL maintainers.

Checking the installation

$ gixpp --version
gixpp - the ESQL preprocessor for Gix-IDE/GixSQL
Version: 1.0.21dev
libgixpp version: 1.0.21dev

The test suite of the precompiler uses autofonce: from the source directory, after building in _build, run autofonce run.