We’re smarter together. Learn from this collection of community knowledge and add your expertise.

How to build the latest unixODBC driver manager for Solaris

by SAS Employee KatT_sas on ‎03-11-2016 09:15 AM (713 Views)

Overview

This article is part of a series.  See Using SAS/ACCESS Interface to ODBC on UNIX Platforms for a listing of all articles in this series.

 

Requirements

To use SAS/ACCESS Interface to ODBC on UNIX platforms, you must have one or more 64-bit ODBC drivers for the data sources to which you need to connect and an ODBC driver manager.  In most cases, you can use a single ODBC driver manager with multiple ODBC drivers.  Unless you license ODBC drivers from such vendors as DataDirect, the ODBC drivers that you obtain do not include an ODBC driver manager.  You typically pair these drivers with a freeware unixODBC driver manager.

 

Process

Here are the steps to obtain and build this driver manager for Solaris.

 

  1. It is recommended that you use the current release of the unixODBC driver manager. Download a zipped tar file (unixODBC-x.x.x.tar.gz) for unixODBC from the unixODBC project home page.  (x.x refers to the most recent subrelease.) 

    Use FTP in binary mode to move this file to your UNIX box.  Place the zipped tar file in the directory of your choice.  This directory is used only during installation.  For example, you might create a directory named unixODBC_download for this file. 

 

  1. From this directory, unzip and untar the file to unpackage the unixODBC driver manager components. At this point the unixODBC-x.x subdirectory is created.  Switch to this directory before proceeding with the build.

By default, the unixODBC driver manager is installed in a directory such as /usr/local driectory on Solaris.  Because this directory already contains many other third-party components, which makes it difficult to identify unixODBC-specific components, it is recommended that you do NOT install the unixODBC driver manager in that directory.  To make it easier to find and maintain, install it instead in its own directory.

 

If you already have write privileges there, you can install it in the /opt directory.  Here is an example of how you might create a directory in /opt named unixODBCx.x.x.

 

cd /opt
mkdir unixODBCx.x.x

 

  1. Before you can build the unixODBC driver manager, set these environment variables.

 

 

export PATH=/usr/ccs/bin:$PATH
export CFLAGS="-m64 -DBUILD_REAL_64_BIT_MODE" 
export CXXFLAGS="-m64 -DBUILD_REAL_64_BIT_MODE"

 

  1. From the unixODBCx.x (no hyphen) subdirectory that was created in step 2, issue these commands to build the unixODBC driver manager. Use the —prefix option with the CONFIGURE command to specify that you want to install unixODBC in the /opt/unixODBCx.x.x directory that you just created.

 

 

./configure --prefix=/opt/unixODBCx.x.x 
make
make install

 

This log provides one example of how you can build a 64-bit unixODBC x.x.x ODBC driver manager on Solaris.  Note that not all tar-related output in STDOUT is included.

 

 

# uname -a
SunOS theborg 5.10 Generic_147440-01 sun4u sparc SUNW,SPARC-Enterprise
$ pwd
/tmp/sasswl/unixodbc_download
$ ls
unixODBC-2.3.2.tar.gz
$ gunzip $ ls
unixODBC-2.3.2.tar
$ ls
unixODBC-2.3.2.tar
$ tar -xvf unixODBC-2.3.2.tar

.
.  (some output has been omitted)
.

x unixODBC-2.3.2/lst/lstOpenCursor.c, 1087 bytes, 3 tape blocks
x unixODBC-2.3.2/lst/lstGetBookMark.c, 298 bytes, 1 tape blocks
x unixODBC-2.3.2/lst/ChangeLog, 587 bytes, 2 tape blocks
x unixODBC-2.3.2/lst/Makefile.in, 18297 bytes, 36 tape blocks
x unixODBC-2.3.2/lst/lstFirst.c, 316 bytes, 1 tape blocks
x unixODBC-2.3.2/lst/TODO, 1319 bytes, 3 tape blocks
x unixODBC-2.3.2/ChangeLog, 63949 bytes, 125 tape blocks
x unixODBC-2.3.2/extras, 0 bytes, 0 tape blocks
x unixODBC-2.3.2/extras/snprintf.c, 17335 bytes, 34 tape blocks
x unixODBC-2.3.2/extras/Makefile.am, 206 bytes, 1 tape blocks
x unixODBC-2.3.2/extras/vms.c, 11723 bytes, 23 tape blocks
x unixODBC-2.3.2/extras/strcasecmp.c, 1040 bytes, 3 tape blocks
x unixODBC-2.3.2/extras/Makefile.in, 15987 bytes, 32 tape blocks
x unixODBC-2.3.2/Makefile.in, 25767 bytes, 51 tape blocks
x unixODBC-2.3.2/README.OSX, 3487 bytes, 7 tape blocks
$ ls
unixODBC-2.3.2      unixODBC-2.3.2.tar
$ cd unixODBC-2.3.2
$ ls
AUTHORS             README.AIX          configure.in        m4
COPYING             README.CYGWIN       cur                 man
ChangeLog           README.INTERIX      depcomp             missing
DRVConfig           README.OSX          doc                 mkinstalldirs
DriverManager       README.QNX          exe                 odbcinst
Drivers             README.SOLARIS      extras              samples
INSTALL             README.VMS          include             unixodbc_conf.h.in
Interix             acinclude.m4        ini                 vms
Makefile.am         aclocal.m4          install-sh          vmsbuild.com
Makefile.in         config.guess        libltdl             ylwrap
Makefile.svn        config.h.in         log
NEWS                config.sub          lst
README              configure           ltmain.sh
$ su root
Password:
# cd /opt
# pwd
/opt

# ls
IBM                            netbeans-5.5.1
SUNWits                        np_axsmod
SUNWmlib                       nz
SUNWrtvc                       sfw
SUNWspro                       staroffice8
SUNWsscs                       teradata
lost+found                     uninstall_Sun_Studio_12.class
# mkdir unixODBC_2.3.2
# ls
IBM                            np_axsmod
SUNWits                        nz
SUNWmlib                       sfw
SUNWrtvc                       staroffice8
SUNWspro                       teradata
SUNWsscs                       uninstall_Sun_Studio_12.class
lost+found                     unixODBC_2.3.2
netbeans-5.5.1
# cd /tmp/sasswl/unixodbc_download
# ls
unixODBC-2.3.2      unixODBC-2.3.2.tar
# cd unixODBC-2.3.2
# pwd
/tmp/sasswl/unixodbc_download/unixODBC-2.3.2
# ls
AUTHORS             README.AIX          configure.in        m4
COPYING             README.CYGWIN       cur                 man
ChangeLog           README.INTERIX      depcomp             missing
DRVConfig           README.OSX          doc                 mkinstalldirs
DriverManager       README.QNX          exe                 odbcinst
Drivers             README.SOLARIS      extras              samples
INSTALL             README.VMS          include             unixodbc_conf.h.in
Interix             acinclude.m4        ini                 vms
Makefile.am         aclocal.m4          install-sh          vmsbuild.com
Makefile.in         config.guess        libltdl             ylwrap
Makefile.svn        config.h.in         log
NEWS                config.sub          lst
README              configure           ltmain.sh
# export PATH=/usr/ccs/bin:$PATH
# export CFLAGS="-m64 -DBUILD_REAL_64_BIT_MODE"
# export CXXFLAGS="-m64 -DBUILD_REAL_64_BIT_MODE"
# echo $PATH
/usr/ccs/bin:/usr/sbin:/usr/bin
# echo $CFLAGS
-m64 -DBUILD_REAL_64_BIT_MODE
# echo $CXXFLAGS
-m64 -DBUILD_REAL_64_BIT_MODE
# ./configure --prefix=/opt/unixODBC_2.3.2

.
.  (some output has been omitted)
.

checking for argz_next... no
checking for argz_stringify... no
checking whether libtool supports -dlopen/-dlpreopen... yes
checking for unistd.h... (cached) yes
checking for dl.h... no
checking for sys/dl.h... yes
checking for dld.h... no
checking for mach-o/dyld.h... no
checking for dirent.h... yes
checking for closedir... yes
checking for opendir... yes
checking for readdir... yes
checking for strlcat... yes
checking for strlcpy... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
# make

.
.  (some output has been omitted)
.

/SQLSetCursorName.o .libs/SQLSetDescRec.o .libs/SQLSetDescField.o .libs/SQLSetParam.o .libs/SQLSetPos.o .libs/SQLSetScrollOptions.o .libs/SQLSetStmtAttr.o .libs/SQLSetStmtOption.o .libs/SQLSpecialColumns.o .libs/SQLStatistics.o .libs/SQLTablePrivileges.o .libs/SQLTables.o .libs/SQLTransact.o   -lthread -lc  -m64 -mt   -mt
libtool: link: rm -f .libs/libodbccr.so.2.0.0.exp
libtool: link: (cd ".libs" && rm -f "libodbccr.so.2" && ln -s "libodbccr.so.2.0.0" "libodbccr.so.2")
libtool: link: (cd ".libs" && rm -f "libodbccr.so" && ln -s "libodbccr.so.2.0.0" "libodbccr.so")
libtool: link: ( cd ".libs" && rm -f "libodbccr.la" && ln -s "../libodbccr.la" "libodbccr.la" )
Making all in DRVConfig
Making all in Drivers
Making all in include
Making all in doc
Making all in AdministratorManual
Making all in ProgrammerManual
Making all in Tutorial
Making all in UserManual
Making all in lst
Making all in man
Making all in samples
# make install

.
.  (some output has been omitted)
.

Making install in Drivers
Making install in include
test -z "/opt/unixODBC_2.3.2/include" || /opt/sfw/bin/mkdir -p "/opt/unixODBC_2.3.2/include"
 .././install-sh -c -m 644 odbcinst.h odbcinstext.h sql.h sqlext.h sqltypes.h sqlucode.h autotest.h uodbc_stats.h uodbc_extras.h '/opt/unixODBC_2.3.2/include'
Making install in doc
Making install in AdministratorManual
Making install in ProgrammerManual
Making install in Tutorial
Making install in UserManual
Making install in lst
Making install in man
test -z "/opt/unixODBC_2.3.2/share/man/man1" || /opt/sfw/bin/mkdir -p "/opt/unixODBC_2.3.2/share/man/man1"
 .././install-sh -c -m 644 isql.1 odbcinst.1 '/opt/unixODBC_2.3.2/share/man/man1'
test -z "/opt/unixODBC_2.3.2/share/man/man5" || /opt/sfw/bin/mkdir -p "/opt/unixODBC_2.3.2/share/man/man5"
 .././install-sh -c -m 644 odbc.ini.5 odbcinst.ini.5 '/opt/unixODBC_2.3.2/share/man/man5'
Making install in samples
touch /opt/unixODBC_2.3.2/etc/odbcinst.ini
touch /opt/unixODBC_2.3.2/etc/odbc.ini
mkdir -p /opt/unixODBC_2.3.2/etc/ODBCDataSources
cp unixodbc_conf.h /opt/unixODBC_2.3.2/include/unixodbc_conf.h
# cd /opt/unixODBC_2.3.2
# pwd
/opt/unixODBC_2.3.2
# ls
bin      etc      include  lib      share
# cd lib
# ls
libodbc.la            libodbccr.la          libodbcinst.la
libodbc.so            libodbccr.so          libodbcinst.so
libodbc.so.2          libodbccr.so.2        libodbcinst.so.2
libodbc.so.2.0.0      libodbccr.so.2.0.0    libodbcinst.so.2.0.0
# file libodbc.so
libodbc.so:     ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped

 

Comments
by New Contributor KenMac
on ‎10-07-2016 01:39 PM

Hi,

 

This is a nice summary and very helpful.

 

I am attempting to install unixODBC on a Solaris 10 server and the ./configure script is failing (message below).

 

I suspect that my version of GNU C may be too far out of date (3.4.3).  Can you tell me what C compiler you used for the example in this article?

 

Thanks in advance!

 

Error Message

 

configure:4616: checking whether we are using the GNU C compiler
configure:4644: result: yes
configure:4653: checking whether gcc accepts -g
configure:4714: result: yes
configure:4731: checking for gcc option to accept ISO C89
configure:4808: result: none needed
configure:4830: checking dependency style of gcc
configure:4941: result: gcc3
configure:4961: checking for flex
configure:4977: found /usr/sfw/bin/flex
configure:4988: result: flex
configure:5025: flex conftest.l
configure:5029: $? = 0
configure:5031: checking lex output file root
configure:5045: result: lex.yy
configure:5050: checking lex library
configure:5064: gcc -o conftest -m64 -DBUILD_REAL_64_BIT_MODE conftest.c >&5
conftest.l: In function `yylex':
conftest.l:6: warning: comparison between pointer and integer
conftest.l:6: warning: assignment makes pointer from integer without a cast
Undefined first referenced
symbol in file
yywrap /var/tmp//ccEox5dk.o
ld: fatal: symbol referencing errors. No output written to conftest
collect2: ld returned 1 exit status
configure:5064: $? = 1

by SAS Employee SamLoflin
on ‎10-20-2016 10:26 AM

Hi, Ken.

 

I wrote this document as a courtesy to our customers, but I do not profess to understanding all if the ins and outs of building a unixODBC driver manager. 

 

I can tell you, though, that even though I see the same installs complaints that you do the unixODBC driver manager build neverthless completes successfully.

 

Once you do the build, do you liekwise end up with a new serviceable unixODBC install?  If not, we can take a look at your unixODBC config.log file.

 

Thanks,

 

Sam

by New Contributor KenMac
on ‎10-20-2016 11:11 AM

Thanks Sam,

 

Got through it.  Two main roadblocks were:

 

  1)  Our environment is not open source friendly and it took time to get the required GNU tools in place.

  2)  The script that runs the install (20k lines!) spends a great deal of time poking around testing the environment and it throws off a

        bunch of "error" messages that really just mean that a particular tool is not installed.  These "errors" can be ignored.

 

After finally understanding that, I did get it installed.

 

Thanks!

 

 

Contributors
Your turn
Sign In!

Want to write an article? Sign in with your profile.