[Erlang Systems]

3 How to compile Erlang ODBC on Unix

This chapter shows how to compile the C code in Erlang ODBC application on Unix.
To be able to compile the Erlang ODBC application on Unix the following are required:

  1. Erlang

  2. GCC (GNU Compiler Collection) C Compiler version 2.7.2 or higher

  3. ODBC drivers for your database

3.1 C Compiler on Unix

The C code in Erlang ODBC application should be compiled with GCC C Compiler version 2.7.2 or higher. The GCC C Compiler must be found in the PATH environment variable. This is easily verified by running the Unix command which gcc.

3.2 Configuring the Erlang ODBC application

After installing Erlang, the Erlang ODBC application source code is located in the <OTPROOT>/lib/odbc-<odbcversion>/src subdirectory. <OTPROOT> can, for example, be the path /usr/local/erlang. In the subdirectory is a Makefile containing path to the ODBC import library and the header files. These paths must be set properly.

3.3 Configuring Makefile

Erlang ODBC application requires ODBC import library and header files, which are a part of the ODBC driver for your database.
To be able to access the import library you must set the variables ODBCLDFLAGS, ODBCLIBS and ODBCINCLUDE properly in the Makefile. ODBCLDFLAGS defines the path of ODBC import library, ODBCLIBS defines the name of ODBC import library and ODBCINCLUDE defines the path to the ODBC header files.
The Erlang ODBC application also uses header files from the Erl_Interface. Hence, the variable EIROOT, which defines the path to the Erl_Interface application, e.g., $(OTPROOT)/lib/erl_interface-3.3.0, must be point to the version of Erl_Interface you intend to use. To be able to use a later version, EIROOT must be updated.

3.4 Compile ODBC

  1. Change to <OTPROOT>/lib/odbc-<odbcversion>/src subdirectory.

  2. Compile ODBC by typing gmake.

Copyright © 1991-2002 Ericsson Utvecklings AB