DB2 Version 9.7 for Linux, UNIX, and Windows

DB2CI application compile and link options (Linux)

The compile and link options in this topic are recommended for building DB2CI applications with the GNU/Linux gcc compiler.

You can find the following options in the DB2DIR/samples/db2ci/bldapp batch file, where DB2DIR is the location where your DB2® copy is installed.

Compile and link options for bldapp
Compile options:
gcc
The C compiler.
$EXTRA_C_FLAGS
Contains one of the following:
  • -m31 on Linux for zSeries only, to build a 32-bit library;
  • -m32 on Linux for x86, x64 and POWER®, to build a 32-bit library;
  • -m64 on Linux for zSeries, POWER, x64, to build a 64-bit library; or
  • No value on Linux for IA64, to build a 64-bit library.
-I$DB2PATH/include
Specify the location of the DB2 include files. For example: $HOME/sqllib/include
-c
Perform compile only; no link. Compile and link are separate steps.
Link options:
gcc
Use the compiler as a front end for the linker.
$EXTRA_C_FLAGS
Contains one of the following:
  • -m31 on Linux for zSeries only, to build a 32-bit library;
  • -m32 on Linux for x86, x64 and POWER, to build a 32-bit library;
  • -m64 on Linux for zSeries, POWER, x64, to build a 64-bit library; or
  • No value on Linux for IA64, to build a 64-bit library.
-o $1
Specify the executable.
$1.o
Include the program object file.
utilci.o
Include the utility object file for error checking.
$EXTRA_LFLAG
For 32-bit it contains the value "-Wl,-rpath,$DB2PATH/lib32", and for 64-bit it contains the value "-Wl,-rpath,$DB2PATH/lib64".
-L$DB2PATH/$LIB
Specify the location of the DB2 static and shared libraries at link-time. For example, for 32-bit: $HOME/sqllib/lib32, and for 64-bit: $HOME/sqllib/lib64.
-ldb2ci
Link with the DB2CI library.