Operating System - Linux
1748289 Members
3233 Online
108761 Solutions
New Discussion юеВ

Mozialla Build LDAP SDK: Getting hard links with shared libraries

 
Steve_The_King
Frequent Advisor

Mozialla Build LDAP SDK: Getting hard links with shared libraries

Mozialla Build LDAP SDK: Getting hard links with shared libraries

Hi,
I am building Mozialla LDAP SDK on HP-UX platform. The problem is that when i do ldd to the build shared libraries(on libobfreebl_pure32_3.sl and others also),
it shows the complete path to its dependencies on other mozialla build shared objects.

ldd ./HP-UXB.11.11_OPT.OBJ/libobfreebl_pure32_3.sl
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/lib/freebl/../../../../dist/HP-UXB.11.11_OPT.OBJ/lib//libobnspr4.sl => /scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/lib/freebl/../../../../dist/HP-UXB.11.11_OPT.OBJ/lib//libobnspr4.sl
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libm.2 => /usr/lib/libm.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/librt.2 => /usr/lib/librt.2
/usr/lib/libpthread.1 => /usr/lib/libpthread.1



I tried moving ibobnspr4.sl to some other location and setting my SHLIB_PATH to the moved directory, but still libobfreebl_pure32_3.sl is refering to the earlier link /scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/lib/freebl/../../../../dist/HP-UXB.11.11_OPT.OBJ/lib//libobnspr4.sl


I am using ANSI "cc" compiler for building the mozialla LDAP sdk.
The linker command for "libobfreebl_pure32_3.sl" is

d -b +h libobfreebl_pure32_3.sl +k +vshlibunsats -u FREEBL_GetVector +e FREEBL_GetVector -o HP-UXB.11.11_OPT.OBJ/libobfreebl_pure32_3.sl HP-UXB.11.11_OPT.OBJ/ldvector.o HP-UXB.11.11_OPT.OBJ/prng_fips1861.o HP-UXB.11.11_OPT.OBJ/sysrand.o HP-UXB.11.11_OPT.OBJ/sha_fast.o HP-UXB.11.11_OPT.OBJ/md2.o HP-UXB.11.11_OPT.OBJ/md5.o HP-UXB.11.11_OPT.OBJ/alg2268.o HP-UXB.11.11_OPT.OBJ/arcfour.o HP-UXB.11.11_OPT.OBJ/arcfive.o HP-UXB.11.11_OPT.OBJ/desblapi.o HP-UXB.11.11_OPT.OBJ/des.o HP-UXB.11.11_OPT.OBJ/rijndael.o HP-UXB.11.11_OPT.OBJ/dh.o HP-UXB.11.11_OPT.OBJ/pqg.o HP-UXB.11.11_OPT.OBJ/dsa.o HP-UXB.11.11_OPT.OBJ/rsa.o HP-UXB.11.11_OPT.OBJ/mpprime.o HP-UXB.11.11_OPT.OBJ/mpmontg.o HP-UXB.11.11_OPT.OBJ/mplogic.o HP-UXB.11.11_OPT.OBJ/mpi.o /scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/lib/freebl/../../../../dist/HP-UXB.11.11_OPT.OBJ/lib/libsecutil.a -L/scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/lib/freebl/../../../../dist/HP-UXB.11.11_OPT.OBJ/lib/ -lobplc4 -lobplds4 -lobnspr4 -lc

I also tried ld with "+s" and "+b" option but it didn't help much.

Thanks
3 REPLIES 3
Dennis Handly
Acclaimed Contributor

Re: Mozilla Build LDAP SDK: Getting hard links with shared libraries

(Darn, I answered this already and the original thread seems to have disappeared??)

Basically don't use ldd on shlibs, use it on your executable that is linked with this shlib.
Or you can use chatr(1).

>I also tried ld with "+s" and "+b" option but it didn't help much.

You'll need to use one or more of those to make ldd work when when you use ldd on the executable.

Steve_The_King
Frequent Advisor

Re: Mozialla Build LDAP SDK: Getting hard links with shared libraries

Hi Dennis,
Thanks for the reply.
Actually we are writing a plugin for a webserver which is a shared library(its not an executable). Our plugin(.sl library) gets linked to these built mozilla ldap sdk shared libraries.

Moreover "+s" option is not always working. In some cases it doesn't give the desired result.

Step 1
ld +s -b +h libobplds4.sl -o libobplds4.sl ./plarena.o ./plhash.o ./plvrsion.o -L/scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/../../dist/HP-UXB.11.11_OPT.OBJ/lib -lobnspr4

Step 2
copy the newly build libobplds4.sl to /scratch/Ranjan/Mozialla_HP
set SHLIB_PATH to /scratch/Ranjan/Mozialla_HP
This directory has libobnspr4.sl

Rename /scratch/Ranjan/LDAP_SDK5_Source to some other directory.

Step 3
[/scratch/Ranjan/Mozialla_HP]$ ldd libobplds4.sl
/scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/../../dist/HP-UXB.11.11_OPT.OBJ/lib/libobnspr4.sl => /scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/../../dist/HP-UXB.11.11_OPT.OBJ/lib/libobnspr4.sl
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/libc.2 => /usr/lib/libc.2
/usr/lib/libm.2 => /usr/lib/libm.2
/usr/lib/libdld.2 => /usr/lib/libdld.2
/usr/lib/librt.2 => /usr/lib/librt.2
/usr/lib/libpthread.1 => /usr/lib/libpthread.1



Its should have referred to the libobnspr4 present in /scratch/Ranjan/Mozialla_HP directory rather than the other one which is now moved.
If I don't set the SHLIB_PATH then ldd command says

/usr/lib/dld.sl: Can't open shared library: /scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/../../dist/HP-UXB.11.11_OPT.OBJ/lib/libobnspr4.sl
/usr/lib/dld.sl: No such file or directory

Dont know why its behaving like this.

Dennis Handly
Acclaimed Contributor

Re: Mozilla Build LDAP SDK: Getting hard links with shared libraries

>Moreover "+s" option is not always working. In some cases it doesn't give the desired result.

How do you know? You are trusting in the ldd output rather than something tried and true like tusc.

>It should have referred to the libobnspr4 present in /scratch/Ranjan/Mozialla_HP directory rather than the other one which is now moved.

It probably did but printed the wrong lib. It can't point to the moved one because nobody but you knows where that went. What dld/linker patch do you have?

Running tusc would prove which shlib is being used.

>If I don't set the SHLIB_PATH then ldd command says
dld.sl: Can't open shared library: /scratch/Ranjan/LDAP_SDK5_Source/mozilla/security/nss/../../dist/HP-UX B.11.11_OPT.O
BJ/lib/libobnspr4.sl

This seems to imply SHLIB_PATH is working but ldd is printing the wrong thing.
I thought I've seen a bug like that.