Operating System - Linux
1753936 Members
9840 Online
108811 Solutions
New Discussion юеВ

Re: 64-bit custom C-lib doesn't work on HP-UX (but does on AIX)

 
SOLVED
Go to solution
Simon Verzijl_1
Occasional Contributor

64-bit custom C-lib doesn't work on HP-UX (but does on AIX)

I'm not a C expert, but as there's no other resources available on the team I've been tasked with recompiling a small custom C library (that is called from PeopleSoft).
We used to run 32-bit, but as of recently PeopleSoft is delivering 64bit code on HP-UX.

I've been able to compile/link the lib succesfully without any errors using GCC 4.2 (gcc-hppa64-4.2.0) but when PeopleSoft is loading the lib it returns this error :

--
shl_load in libpscompat failed for libsmpsftagent.sl
/usr/lib/pa20_64/dld.sl: Unsatisfied code symbol '_Jv_RegisterClasses'
--

I've looked for this symbol and found that is was present in libgcc_s.sl :

crm9@choh1210:/opt/hp-gcc64/lib# readelf -a libgcc_s.sl :
..
Symbol table '.dynsym' contains 144 entries:
Num: Value Size Type Bind Vis Ndx Name
84: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _Jv_RegisterClasses
..

This lib is in SHLIB_PATH/LD_LIBRARY_PATH and can be found according to ldd -d :

crm9@choh1210:/appl/psoft/crm90/bin# ldd -d libsmpsftagent.sl
libsmagentapi.sl => /appl/psoft/crm90/bin/libsmagentapi.sl
libgcc_s.sl => /opt/hp-gcc64-4.2.0/lib/gcc/hppa64-hp-hpux11.11/4.2.0/../../../libgcc_s.sl
libsmerrlog.sl => /appl/psoft/crm90/bin/libsmerrlog.sl
libCsup.2 => /usr/lib/pa20_64/libCsup.2
libstd.2 => /usr/lib/pa20_64/libstd.2
libstream.2 => /usr/lib/pa20_64/libstream.2
libm.2 => /usr/lib/pa20_64/libm.2
libc.2 => /usr/lib/pa20_64/libc.2
libsmcommonutil.sl => /appl/psoft/crm90/bin/libsmcommonutil.sl
libnsl.1 => /usr/lib/pa20_64/libnsl.1
libpthread.1 => /usr/lib/pa20_64/libpthread.1
libdl.1 => /usr/lib/pa20_64/libdl.1
libxti.2 => /usr/lib/pa20_64/libxti.2


However, ldd -s shows the same error as when actually loading the lib by PeopleSoft (and showing more missing symbols than just the _Jv_RegisterClasses) :

crm9@choh1210:/appl/psoft/crm90/bin# ldd -r libsmpsftagent.sl
libsmagentapi.sl => /appl/psoft/crm90/bin/libsmagentapi.sl
libgcc_s.sl => /opt/hp-gcc64-4.2.0/lib/gcc/hppa64-hp-hpux11.11/4.2.0/../../../libgcc_s.sl
libsmerrlog.sl => /appl/psoft/crm90/bin/libsmerrlog.sl
libCsup.2 => /usr/lib/pa20_64/libCsup.2
libstd.2 => /usr/lib/pa20_64/libstd.2
libstream.2 => /usr/lib/pa20_64/libstream.2
libm.2 => /usr/lib/pa20_64/libm.2
libc.2 => /usr/lib/pa20_64/libc.2
libsmcommonutil.sl => /appl/psoft/crm90/bin/libsmcommonutil.sl
libnsl.1 => /usr/lib/pa20_64/libnsl.1
libpthread.1 => /usr/lib/pa20_64/libpthread.1
libdl.1 => /usr/lib/pa20_64/libdl.1
libxti.2 => /usr/lib/pa20_64/libxti.2
symbol not found: _Jv_RegisterClasses (/appl/psoft/crm90/bin/libsmpsftagent.sl)
symbol not found: __cxa_finalize (/appl/psoft/crm90/bin/libsmpsftagent.sl)
symbol not found: _Jv_RegisterClasses (/opt/hp-gcc64-4.2.0/lib/gcc/hppa64-hp-hpux11.11/4.2.0/../../../libgcc_s.sl)
symbol not found: __cxa_finalize (/opt/hp-gcc64-4.2.0/lib/gcc/hppa64-hp-hpux11.11/4.2.0/../../../libgcc_s.sl)
symbol not found: U_update_state_vector (/usr/lib/pa20_64/libCsup.2)
symbol not found: U_get_my_context (/usr/lib/pa20_64/libCsup.2)
symbol not found: U_get_shLib_unw_tbl (/usr/lib/pa20_64/libCsup.2)
symbol not found: U_get_unwind_entry (/usr/lib/pa20_64/libCsup.2)
symbol not found: U_resume_execution (/usr/lib/pa20_64/libCsup.2)
symbol not found: U_get_previous_frame (/usr/lib/pa20_64/libCsup.2)
symbol not found: U_get_unwind_table (/usr/lib/pa20_64/libCsup.2)
symbol not found: U_get_shLib_text_addr (/usr/lib/pa20_64/libCsup.2)
symbol not found: U_copy_frame_info (/usr/lib/pa20_64/libCsup.2)
symbol not found: U_prep_frame_rec_for_unwind (/usr/lib/pa20_64/libCsup.2)
symbol not found: main (/usr/lib/pa20_64/libc.2)



What can be causing this issue ?

PS: on AIX the same code compiles/runs fine in 64bit with GCC 64bit.
2 REPLIES 2
Dennis Handly
Acclaimed Contributor
Solution

Re: 64-bit custom C lib doesn't work on HP-UX (but does on AIX)

>I've looked for this symbol and found that is was present in libgcc_s.sl:
# readelf -a libgcc_s.sl:
Symbol table '.dynsym' contains 144 entries:
Num: Value                   Size Type     Bind       Vis             Ndx   Name
84: 0000000000000000 0 FUNC GLOBAL DEFAULT UND _Jv_RegisterClasses

With a size of 0, that doesn't look like a definition?

You should not be using a foreign devil tool. The correct tool is elfdump:
$ elfdump -n .dynsym -s libgcc_s.sl

Also, it appears that libgcc_s.sl is a g++ shared lib not C. You can't mix g++ with aC++. You need to compile C source.

Why are you linking your C lib libsmpsftagent.sl, with aC++ runtime?
libCsup.2 libstd.2 libstream.2

>__cxa_finalize __cxa_finalize

While these are valid IPF runtime symbols for aC++, they indicate they are g++ runtime for PA.

>U_update_state_vector ...

These are in libcl, which must be linked to the executable.

Simon Verzijl_1
Occasional Contributor

Re: 64-bit custom C-lib doesn't work on HP-UX (but does on AIX)

Thanks Dennis, I've now linked against libcl and it works now.