unixODBC: How to Generate ODBC Driver Shared Library libsqora on Linux/Unix

尛樣兒發表於2010-07-03

unixODBC: How to Generate ODBC Driver Shared Library libsqora on Linux/Unix [ID 779495.1]

Applies to:

Oracle ODBC Driver - Version: 10.1.0.2
HP-UX Itanium
IBM AIX Based Systems (64-bit)
Linux Itanium
Linux x86-64
Sun Solaris SPARC (64-bit)

Goal

This note describes how to generate / recreate the ODBC Driver shared library 

libsqora.so.X.1  (where X represents the main release - i.e. 10 for 10g, 11 for 11g etc.)


to be used in combination with unixODBC

Solution

  1. Ensure that the ODBC Driver is installed properly using the Oracle Universal Installer 
    This can be done by checking if following files exist:

    $ORACLE_HOME/odbc/lib/env_odbc.mk
    $ORACLE_HOME/odbc/lib/ins_odbc.mk

  2. Go to the ODBC library directory and perform

    cd $ORACLE_HOME/odbc/lib
    cp $ORACLE_HOME/lib/sqoci.a .
    cp $ORACLE_HOME/lib/sqora.a .
    cp $ORACLE_HOME/lib/utility.a .
    rm libsqora.so*


  3. When using Non-GNU "make" - for example on Solaris - it is required to put comments for first two makefile commands - changing

    $(INSTALL_SHORTCUT_TARGETS):
            $(MAKE) -f $(ODBCLIB)ins_odbc.mk relink  EXENAME=$@
    $(INSTALL_SHORTCUT_TARGETS):
            $(MAKE) -f $(ODBCLIB)ins_odbc.mk relink  EXENAME=$@ 

    to

    #$(INSTALL_SHORTCUT_TARGETS):
    #       $(MAKE) -f $(ODBCLIB)ins_odbc.mk relink  EXENAME=$@
    #$(INSTALL_SHORTCUT_TARGETS):
    #        $(MAKE) -f $(ODBCLIB)ins_odbc.mk relink  EXENAME=$@

    otherwise following errors are throw because makefile syntax is not understand by Non-GNU make:

    make: Warning: Too many rules defined for target /raid/oracle/ora111/app/oracle/
    product/111/odbc/lib/libsqora.so.11.1
    /usr/ccs/bin/make -f /raid/oracle/ora111/app/oracle/product/111/odbc/lib/ins_odb
    c.mk relink EXENAME=/raid/oracle/ora111/app/oracle/product/111/odbc/lib/libsqora
    .so.11.1
    make: Fatal error: Don't know how to make target `relink'
    Current working directory /raid/oracle/ora111/app/oracle/product/111/odbc/lib
    *** Error code 1
    make: Fatal error: Command failed for target `/raid/oracle/ora111/app/oracle/pro
    duct/111/odbc/lib/libsqora.so.11.1'

  4. Perform

    make -f ins_odbc.mk isqora
    cp libsqora.so* $ORACLE_HOME/lib 

    Output

    db111x@amachine:~/app/oracle/product/111/odbc/lib $ cp $ORACLE_HOME/lib/sqoci.a .
    db111x@amachine:~/app/oracle/product/111/odbc/lib $ cp $ORACLE_HOME/lib/sqora.a .
    db111x@amachine:~/app/oracle/product/111/odbc/lib $ cp $ORACLE_HOME/lib/utility.a .
    db111x@amachine:~/app/oracle/product/111/odbc/lib $ rm libsqora.so*
    db111x@amachine:~/app/oracle/product/111/odbc/lib $ make -f ins_odbc.mk isqora
    ins_odbc.mk:27: warning: overriding commands for target `/raid/home/vmware/64/oracle/db111x/app/oracle/product/111/odbc/lib/libsqora.so.11.1'
    ins_odbc.mk:5: warning: ignoring old commands for target `/raid/home/vmware/64/oracle/db111x/app/oracle/product/111/odbc/lib/libsqora.so.11.1'
     
     - Linking sqora
     
    rm -f /raid/home/vmware/64/oracle/db111x/app/oracle/product/111/odbc/lib/libsqora.so.11.1
    gcc -o /raid/home/vmware/64/oracle/db111x/app/oracle/product/111/odbc/lib/libsqora.so.11.1 -L/raid/home/vmware/64/oracle/db111x/app/oracle/product/111/odbc/lib/ -L/raid/home/vmware/64/oracle/db111x/app/oracle/product/111/lib/ -L/raid/home/vmware/64/oracle/db111x/app/oracle/product/111/lib/stubs/     `cat /raid/home/vmware/64/oracle/db111x/app/oracle/product/111/lib/sysliblist` -ldl -lm  -shared -Wl,-soname,libsqora.so.11.1  -Wl,-whole-archive /raid/home/vmware/64/oracle/db111x/app/oracle/product/111/odbc/lib/sqoci.a /raid/home/vmware/64/oracle/db111x/app/oracle/product/111/odbc/lib/utility.a -Wl,-no-whole-archive -L/raid/home/vmware/64/oracle/db111x/app/oracle/product/111/lib  -Bdynamic -lclntsh  /raid/home/vmware/64/oracle/db111x/app/oracle/product/111/lib/libcore11.a /raid/home/vmware/64/oracle/db111x/app/oracle/product/111/lib/libunls11.a -L/raid/home/vmware/64/oracle/db111x/app/oracle/product/111/odbc/public/osds/unixODBC/lib -lodbcinst -Wl,-whole-archive /raid/home/vmware/64/oracle/db111x/app/oracle/product/111/odbc/lib/sqora.a -Wl,-no-whole-archive   -L/raid/home/vmware/64/oracle/db111x/app/oracle/product/111/lib -lirc -lipgo -ldl
    db111x@amachine:~/app/oracle/product/111/odbc/lib $ cp libsqora.so* $ORACLE_HOME/lib

  5. If during linking the link editor "ld" outputs the following

    ld: fatal: library -lodbcinst: not found

    then the library path does not contain a hint to libodbcinst which is part of the unixODBC package. 
    In that case it is required to include the storage location of libodbcinst into library path by adding it to

    • Linux / Solaris: LD_LIBRARY_PATH
    • HP-UX : SHLIB_PATH
    • AIX: LIBPATH

    If unixODBC was build and installed by default procedure, then adding /usr/local/lib should be sufficient - for example

    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
    export LD_LIBRARY_PATH

    Detailed steps howto install unixODBC can be found here:

    Note:363686.1 How to Setup and Run Oracle ODBC 10g Driver on Solaris
    Note:404041.1 How to Setup and Verify Setup of Oracle ODBC Driver on Linux

    If unixODBC has been installed properly, repeat step 4.



 

References

NOTE:396635.1 - On What Unix/Linux OS are Oracle ODBC Drivers Available ?
NOTE:363899.1 - Using unixODBC with ODBC 3.X API and Oracle ODBC Driver for Solaris or Linux
NOTE:363686.1 - How to Setup and Run Oracle10g ODBC Driver on Solaris
NOTE:404041.1 - How to Setup and Verify Setup of Oracle ODBC Driver on Linux



 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23135684/viewspace-667077/,如需轉載,請註明出處,否則將追究法律責任。

相關文章