READ THIS
*******************************************************************************
PURPOSE
-------
The purpose of this short article is to document problems that maybe
encountered by customers installing or using any application (Oracle
or 3rd party) that attempts to load a 'thread local storage' shared
library
at execution time.
SCOPE & APPLICATION
-------------------
The advise given is generic and applies to any application
encountering the
documented problems.
However, the note has been prompted by problems encountered by IBM
during usage
of the IBM MQSeries Products against 8.1.6, specifically when the
IBM MQSeries
server processes attempted to load the Oracle shared library
(libclntsh.sl).
The problem is pertinent to HP-UX 11 only, and to any release of
Oracle 8i.
The commands given in the article were carried out on 8.1.6 (32
bit).
1. INTRODUCTION
---------------
On HP-UX, any attempt to dynamically load a shared library that uses
thread
local storage, will cause the dynamic loader to error with:
/usr/lib/dld.sl: Can't shl_load() a library containing Thread Local
Storage
/usr/lib/dld.sl: Exec format error
As explained in [NOTE:113395.1], if the Radius Authentication
Adapter is
installed, libclntsh.sl is dynamically linked with the 'thread local
storage'
library libjava.sl.
The 'chatr' command will show:
% cd $ORACLE_HOME/lib
% chatr libclnsth.sl
libclntsh.sl:
....
dynamic
/oracle/OFA_base/app/oracle/product/8.1.6/JRE/lib/PA_RISC/
native_threads/libjava.sl
.....
Assuming that the Radius Authentication Adapter is not required,
then it must
be deinstalled, in order to remove libjava.sl from the list of
dynamic libraries
for libclntsh.sl.
2. DEINSTALLING RADIUS
----------------------
2.1 Deinstalling using The Universal Installer
In order to deinstall using the Installer, the user needs to
a. Start the Installer, and choose 'Deinstall Products...'. From
the
product list, expand 'Oracle 8i Enterprise Edition 8.1.6.0.0'
and choose
to deinstall 'Authentication and Encryption'
This has the effect of deinstalling
- ALL authentication adapters (Radius, Kerberos, Identix,
Securid)
- ALL encryption algorithms
b. If the user requires that any other authentication adapter, or
the encryption algorithms are installed, then the user must use
the
Installer to install the required product. In order to do this,
choose to
install 'Oracle Advanced Security', and select the required
authentication
adapter(s). All encryption algorithms are installed when
'Oracle Advanced
Security' is chosen.
2.2 Deinstalling Manually
In order to remove references to libjava.sl from all link lines, the
user
needs to do the following.
a. regenerate the authentication adapter table
cd $ORACLE_HOME/network/lib
make -f ins_nau.mk NAU_ADAPTERS="<adapterlist>" nautab.o
where <adapterlist> is a space separated list of required
authentication
adapters. If none are required, then set this to NONE.
The usage is documented in the comments section of ins_nau.mk
b. remove references to libjava.sl in the link list
remove the contents of $ORACLE_HOME/network/install/ldflags.rad
from
$ORACLE_HOME/lib/ldflags
eg,
% cat $ORACLE_HOME/lib/ldflags
-lnbeq8 -lnhost8 -lnus8 -lnldap8 -lldapclnt8 -lnsslb8 -ln8
-lncrypt8
-ln8 -lncrypt8 -lnoname8 -ln8 -lncrypt8 -lnrad8 -ln8
-lncrypt8
-L/oracle/OFA_base/app/oracle/product/8.1.6/JRE/lib/PA_RISC/native_threads
-l:libjava.sl
-L/oracle/OFA_base/app/oracle/product/8.1.6/JRE/lib/PA_RISC/
native_threads -l:libjava.sl -lntcp8 -lntcps8 -lnsslb8 -lnent8
-lntcp8
-lntns8
% cat $ORACLE_HOME/network/install/ldflags.rad
-ln8 -lncrypt8 -lnrad8 -ln8 -lncrypt8
-L/oracle/OFA_base/app/oracle/product/8.1.6/JRE/lib/PA_RISC/native_threads
-l:libjava.sl
-L/oracle/OFA_base/app/oracle/product/8.1.6/JRE/lib/PA_RISC/
native_threads -l:libjava.sl
% cd $ORACLE_HOME/lib
% cp ldflags ldflags.orig
based on above, change ldflags such that
% cat $ORACLE_HOME/lib/ldflags
-lnbeq8 -lnhost8 -lnus8 -lnldap8 -lldapclnt8 -lnsslb8 -ln8
-lncrypt8
-ln8 -lncrypt8 -lnoname8
-lntcp8 -lntcps8 -lnsslb8 -lnent8 -lntcp8 -lntns8
3. REGENERATE SHARED LIBRARY
-----------------------------
To regenerate libclnsth, do:
% cd $ORACLE_HOME/bin
% ./genclntsh
To verify that libjava.sl is no longer linked in:
% cd $ORACLE_HOME/lib
% chatr libclntsh.sl
If genclntsh fails with
/usr/lib/dld.sl: Unresolved symbol: LhtStrCreate (code) from
<ORACLE_HOME>/lib/libwtc8.sl
/usr/lib/dld.sl: Unresolved symbol: LhtStrInsert (code) from
<ORACLE_HOME>/lib/libwtc8.sl
then refer to [NOTE:99383.1]. As discussed in this note, one way to
avoid these errors is to edit $ORACLE_HOME/rdbms/admin/shrept.lst,
such that
the lines
rdbms : LhtStrCreate
rdbms : LhtStrInsert
are added above the line
rdbms : lmxsrt
After editing this file, re-run genclntsh.
RELATED DOCUMENTS
-----------------
[NOTE:113395.1] Cannot shl_load a library with thread local
storage on HP-UX
[NOTE:99383.1] Errors Loading Shared Library using Oracle
Provided Makefile
on HP for 8.1.6
Solution: Errors Loading Shared Library using Oracle Provided
Makefile on HP for 8.1.6
Problem Description
-------------------
You are using the demo_rdbms.mk (oracle provided) make file to
create a
shared library using the macros extproc_with_context or
extproc_callback,
as show below:
make -f extproc_callback SHARED_LIBNAME=xxx.sl OBJS=xxx.o
After creating the shared library, you receive errors similar to the
following when trying to load it in the main application:
/usr/lib/dld.sl: Unresolved symbol: LhtStrCreate (code) from
/u05/app/oracle/product/8.1.6/lib/libwtc8.sl
/usr/lib/dld.sl: Unresolved symbol: LhtStrInsert (code) from
/u05/app/oracle/product/8.1.6/lib/libwtc8.sl
Can't load library
Generally, you receive these errors when working on HP.
Solution Description
--------------------
There are three possible solutions to correct this problem:
1. If you are loading the shared library on HP using a statement
similar
to:
shl_load("xxx.sl",BIND_IMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH,
0);
use BIND_DEFFERED instead of BIND_IMMEDIATE.
Explanation:
Using the BIND_DEFFERED flag instead of BIND_IMMEDIATE allows
resolution
of symbols when they actually get referenced, instead of when the
library
gets loaded.
If you are using OCI calls in the library, then these calls never
use
symbols similar to LhtStrCreate or LhtStrInsert, and hence the
problem
is resolved.
2. If you cannot use BIND_DEFFERED, then define the following macro
in
demo_rdbms.mk:
build_sl: $(LIBCLNTSH) $(OBJS)
echo $(LIBEXTP)
$(LD) $(SHARED_LDFLAG) $(SHARED_LIBNAME) $(OBJS)
$(OCISHAREDLIBS) \
-l:librt.sl -lpthread -l:libnss_dns.1 -l:libdld.sl
$(LIBEXTP) \
$(LIBCLNTSH) -l:libagtsh.sl
$(ORACLE_HOME)/rdbms/lib/homts.o
Then, make the shared library as follows:
make -f demo_rdbms.mk build_sl SHARED_LIBNAME=xxx.sl
OBJS=xxx.o
Explanation:
The target 'extproc_callback' used to create the shared library
is not
sufficient itself. It is provided to build an extproc shared
library
which then gets loaded by the 'extproc' executable which has been
linked
with 'libagtsh.sl'. So, to resolve the undefined symbol, you
need to use
the new target 'build_sl' which provides a link to libagtsh.sl
and also
with $(ORACLE_HOME)/rdbms/lib/homts.o.
3. The additional linking of two libraries is only required for the
HP platform
due to different behavior of the HP linker. Therefore, if you do
not want
to link with these two libraries to be consistent on all the
platforms in
the Oracle provided makefile or in your own makefile, then follow
the steps
below to recreate libclntsh:
a. Edit the file '$ORACLE_HOME/rdbms/admin/shrept.lst'.
b. Locate the line containing: rdbms : lmxsrt.
c. Add the following 2 lines under above line:
rdbms : LhtStrCreate
rdbms : LhtStrInsert
d. Rebuild libclntsh (use the original genclntsh script)
To be safe relink all products (rdbms, sqlplus, network etc.)
afterwards.
Note: Build_sl in demo_rdbms.mk needs to be changed to:
build_sl: $(LIBCLNTSH) $(OBJS)
$(LD) $(SHARED_LDFLAG) $(SHARED_LIBNAME) $(OBJS) \
-l:libclntsh.sl \
-l:librt.sl -lpthread -l:libnss_dns.1 -l:libdld.sl \
$(OCISHAREDLIBS)
Reference
---------
[BUG:1189459] NOT ABLE TO USE DEMO_RDBMS.MK TO CREATE SHARED
LIBRARY FOR
OCI APPLICATION
.
******************************************************************************************
Wesley STROOP wrote:
>
> Hi all,
>
> I m still struggling with a big problem with installing DBD::Oracle on
> Hp unix.
>
> environment-----------------------------------------------------------------------
>
> OS : HP-UX 11
> Oracle : 8.1.6.1
> Perl : 5.6.0
> C-compiler: B3901BA B.11.01.06 HP C/ANSI C Developer's Bundle for
> HP-UX 11.00 (S800)
> DBD::Oracle 1.06
> DBI 1.16
>
> installation------------------------------------------------------------------------
>
> I installed everthing following these rules in the link below:
>
> http://www.mail-archive.com/[email protected]/msg15638.html
>
> error--------------------------------------------------------------------------------
>
> Every test went fine, until I "make test" of the DBD::Oracle
>
> I encountered the following error several times:
>
> /usr/lib/dld.sl: Can't shl_load() a library containing Thread Local
> Storage:
> /u1/app/oracle/product/8.1.6/JRE/lib/PA_RISC/native_threads/libjava.sl
>
> Thanks,
>
> Wez:wq