Bug #31500 installation of myodbc 3.51.20 failed on AIX 5.3 64bit
Submitted: 10 Oct 2007 9:33 Modified: 15 Oct 2007 8:32
Reporter: KAIYE XU Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:3.51.20 OS:IBM AIX (5.3 64bit)
Assigned to: CPU Architecture:Any
Tags: 5.3, AIX, magic, MyODBC, number

[10 Oct 2007 9:33] KAIYE XU
Description:
I tried to install myodbc on AIX 5.3 64bit, but when I test the odbc driver with unixodbc command, I get the error as following :

shell>isql myodbc3 root -v

[01000][unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libmyodbc3.so' : Could not load module /usr/local/lib/libmyodbc3.so.
        The module has an invalid magic number.
[ISQL]ERROR: Could not SQLConnect

How to repeat:
shell> gunzip mysql-connector-odbc-3.51.20-aix5.2-powerpc-64bit.tar.gz
shell> tar xvf mysql-connector-odbc-3.51.20-aix5.2-powerpc-64bit.tar
shell> cd mysql-connector-odbc-3.51.20-aix5.2-powerpc-64bit
shell> cp libmyodbc* /usr/local/lib
shell> cp odbc.ini /usr/local/etc
shell> export ODBCINI=/usr/local/etc/odbc.ini

Download unixODBC version 2.1.2 from http://www.unixodbc.org/ 
tar xvf unixODBC-2.2.12.tar
cd unixODBC-2.2.12
./configure --enable-gui=no --enable-shared 
make 
make install 

in odbc.ini
[ODBC Data Sources]
myodbc3     = MyODBC 3.51 Driver DSN

[myodbc3]
Driver       = /usr/local/lib/libmyodbc3.so
Description  = MyODBC 3.51 Driver DSN
SERVER       = localhost
PORT         = 3306
USER         = root
Password     =
Database     = test
OPTION       = 3
SOCKET       =
[10 Oct 2007 15:02] Kent Boortz
There are usually one of two problems on AIX, could you please
verify? One is that you verify you really have both manager
and driver 64 bits, could you please do (adjust path if needed)

  % file /usr/local/lib/libodbc*.so
  % file /usr/local/lib/libmyodbc.so

The second problem is that there are two kinds of shared libraries
on AIX, and we use the ".so" one. If you have

  % file /usr/local/lib/libodbc*.a

that is an indication. You need to make sure to compile
unixODBC, and maybe even your application (not sure), with

  LDFLAGS="-Wl,-brtl"
[11 Oct 2007 9:23] KAIYE XU
hello,Kent Boortz 

I followed your instruction and verified that the libodbc*.so, libmyodbc*.so and libodbc*.a are all in /usr/local/lib

I recompiled unixodbc with the LDFLAGS="-Wl,brtl" and then reinstall it.

but the problem of invalid magic number exist still.

Could you just give me more information?
[11 Oct 2007 19:57] Kent Boortz
Sorry, I might have been a bit unclear. I suggested
you run the "file" command on the shared libraries
involved, to verify they all are 64 bits. I.e. the
output should be something like

  % file /usr/local/lib/libodbcinst.so
  /usr/local/lib/libodbcinst.so: 64-bit XCOFF 
  executable or object module not stripped

  % file /usr/local/lib/libmyodbc3.so
  /usr/local/lib/libmyodbc3.so: 64-bit XCOFF 
  executable or object module not stripped

Also make sure you don't have LD_LIBRARY_PATH or
similar set so another "libodbcinst.so" is picked
up than you intended. One way to check that, is
to run ldd on your executable

  % ldd <yourexe or lib>

In the case of the driver it is explicitly loaded
by the manager, and will not show using "ldd", but
the "odbc.ini" content you showed should be enough.
[12 Oct 2007 16:32] KAIYE XU
yes, you are right, Kent

The file libodbc*.so is not of 64 bit but 32 bit, but libmyodbc*.so is of 64 bit. so I think that there is some problem in the installation of unixodbc 2.2.12, and I am verifying the compiler while installing unixodbc.

Do you have some suggestion for this problem? Do u know some standard 64 bit compiler on AIX 5.3?
[12 Oct 2007 21:20] Kent Boortz
If you use GCC, your only change is likely
to set CFLAGS="-m64 -O2 -g" CXXFLAGS="-m64 -O2 -g",
i.e. to configure like

  CFLAGS="-m64 -O1 -g" CXXFLAGS="-m64 -O1 -g" ./configure ....

I use the AIX VisualAge 6 to compile, my settings are

  CC=xlc_r
  CFLAGS="-qlanglvl=extended -ma -O2 -g -qstrict -qoptimize=2 -qmaxmem=8192"
  CXX=xlC_r
  CXXFLAGS="-ma -O2 -g -qstrict -qoptimize=2 -qmaxmem=8192"
  LDFLAGS="-Wl,-brtl"
  export CC CFLAGS CXX CXXFLAGS LDFLAGS
[15 Oct 2007 8:32] KAIYE XU
thank you very much, Kent

now unixodbc rocks.

I am going to test my cobol program with myodbc.

Since I am in Paris, I just give u a big "bisous" and say "Merci Monsieur"