Author Topic: build unixodbc on aix  (Read 1480 times)


  • Administrator
  • Hero Member
  • *****
  • Posts: 2041
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
build unixodbc on aix
« on: เมษายน 03, 2018, 10:22:28 AM »
Building on AIX


AIX seems to ship with a install tool /usr/bin/bsdinstall, unfortunatly
the version of autoconf that unixODBC uses doesn't seem to like this, so
make sure it doesn't find this. It may be best to define INSTALL as a
empty string before building, forcing it to use the builtin install-sh.


You need to decide to build with or without threads, if you want threads
I would do this

export CC=xlc_r
export CXX=xlC_r

If you don't want threads, do this

export CC=xlc
export CXX=xlC
./configure --enable-threads=no

Shared Libs

Because of the way that AIX builds its shared libs there are a couple of
points to remember

1. All drivers need changing into .so

The drivers will be build as a .a, containing a .so, BUT dlopen only is
able to open a .so, so to fix this, for each driver that is needed, do
the following (in this case the postgres driver).

Go to the target lib directory

        cd /usr/local/lib

extract the .so from the .a

        ar -x libodbcpsql.a

This will create

The same will need doing for the seyup libs

        ar -x libodbcpsqlS.a

2. Shared libs containing C++ are special

This is only a issue with the libodbcinstQ.a lib that is opened by
ODBCConfig. There are two things, first because libtool decides that
shared libs ar lib*.a the code trys to load libodbcinstQ.a, and also
we maye have to rebuild the lib using the IBM util makeC++SharedLib
(the name gives its away :-)

I have tried this with a current AIX, and it seems that all is needed is to extract the .so
from the .a by running ar -x libodbcinstQ.a to get the .so

If that doesn't help, or on older AIX's the following may need doing.

After the make install is done, go into the odbcinstQ dir on thE
build tree, and do the following

        makeC++SharedLib -p 0 -o -L$QTDIR/lib -lqt -L$PREFIX/lib -lodbc -lodbcinst  .libs/libodbcinstQ.lax/  *.o ../ini/*.lo

where QTDIR is set to the top of the qt tree, so $QTDIR/lib will contain libqt.a
and PREFIX is set to the unixODBC install tree, so $PREFIX/lib contains libodbc.a.
Ignore any duplicate symbol warnings they are due to the same things being in libodbc.a
and libodbcinst.a

this will then build a, we can copy that to the target lib dir,
and delete the existing lib, and link it (again replace $PREFIX with the correct path

        cp $PREFIX/lib
        cd $PREFIX/lib
        rm libodbcinstQ.a
        ln -s libodbcinstQ.a

Then all should be OK with ODBCConfig

Nick Gorham

####installed again
        touch /usr/local/etc/odbcinst.ini
        touch /usr/local/etc/odbc.ini
        mkdir -p /usr/local/etc/ODBCDataSources
        cp unixodbc_conf.h /usr/local/include/unixodbc_conf.h