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:
- GCC (GNU Compiler Collection) C Compiler version 2.7.2 or higher
- 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
PATHenvironment variable. This is easily verified by running the Unix command
3.2 Configuring the Erlang ODBC application
After installing Erlang, the Erlang ODBC application source code is located in the
<OTPROOT>/lib/odbc-<odbcversion>/srcsubdirectory. <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
- Change to
- Compile ODBC by typing