Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX (1103 Views)
Reply
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 1 of 23 (1,103 Views)
Accepted Solution

Having trouble with archive libraries in 64-bit 11.11 HP-UX

I'm trying to compile openldap in 64-bit mode on HPUX 11.11, and whenever I try to link in an archive library, I get an ABI mismatch, or a Cannot load symbol table--but I've checked the object files and they are definitely ELF 64-bit,and nm lists the symbol tables just fine. Has anyone else had trouble with this, and how did you change the linking?
Here is a sample command and output...
/bin/sh ../..//libtool --mode=link cc -static +DD64 -L/usr/local/lib -
L/usr/local/BerkeleyDB.4.3/lib -o dtest dtest.o liblber.la ../../libraries/lib
lutil/liblutil.a
cc +DD64 -o dtest dtest.o -L/usr/local/lib -L/usr/local/BerkeleyDB.4.3/lib ./.l
ibs/liblber.a ../../libraries/liblutil/liblutil.a
ld: (Warning) Cannot load library symbol table in ./.libs/liblber.a, it might be
missing or corrupted. Skipping library ./.libs/liblber.a.
ld: (Warning) Cannot load library symbol table in ../../libraries/liblutil/liblu
til.a, it might be missing or corrupted. Skipping library ../../libraries/liblut
il/liblutil.a.

Thanks for any help!
c*
Honored Contributor
Arunvijai_4
Posts: 4,194
Registered: ‎04-07-2005
Message 2 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Hello,

Just to make sure, have you installed all the dependancies like BerkeleyDB, etc.. in 64 bit ?

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 3 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Oh yes, and had trouble with each and every dependency! Even the binaries from the software porting sites that say they are 2.0 Risc are all 32-bit, and so I've had to compile everything from scratch.
Thanks for asking.
c*
Acclaimed Contributor
Dennis Handly
Posts: 25,190
Registered: ‎03-06-2006
Message 4 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Typically if you get "Cannot load library symbol table" it means the archive wasn't created with HP's ar.

You can "fix" this by: ar -rs foo.a
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 5 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Thanks, I did rebuild the symbol table with ar, but I got the same message afterwards...Weird, huh?
c*
Acclaimed Contributor
Dennis Handly
Posts: 25,190
Registered: ‎03-06-2006
Message 6 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

>I did rebuild the symbol table with ar

You used the following?
/usr/ccs/bin/ar -rs foo.a
Honored Contributor
Sandman!
Posts: 2,220
Registered: ‎01-13-2005
Message 7 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Have you checked if the archive libraries you are trying to link with are all 64-bit. Do an ldd -v on the executable to find out the shared dependencies and post the output.

cheers!
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 8 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Why, yes:
frank3 /usr/local4/openldap-2.3.19 $ cd libraries/liblutil
frank3 /usr/local4/openldap-2.3.19/libraries/liblutil $ file liblutil.a
liblutil.a: archive file
frank3 /usr/local4/openldap-2.3.19/libraries/liblutil $ /usr/ccs/bin/ar -rs liblutil.a
frank3 /usr/local4/openldap-2.3.19/libraries/liblutil $ file *.o
avl.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
base64.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
csn.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
detach.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
entropy.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
fetch.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
getpass.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
getpeereid.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
hash.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
ldif.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
lockf.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
md5.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
passfile.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
passwd.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
sasl.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
setproctitle.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
sha1.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
signal.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
sockpair.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
tavl.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
testavl.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
utils.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
uuid.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)
version.o: ELF-64 relocatable object file - PA-RISC 2.0 (LP64)

Then, running make again:
Entering subdirectory liblutil

Entering subdirectory liblber
cc +DD64 -I../../include -I../../include -I/usr/local/include -I/usr/local/BerkeleyDB.4.3/include -c etest.c
/bin/sh ../..//libtool --mode=link cc -static +DD64 -L/usr/local/lib -L/usr/local/BerkeleyDB.4.3/lib -o etest etest.o liblber.la ../../libraries/liblutil/liblutil.a
cc +DD64 -o etest etest.o -L/usr/local/lib -L/usr/local/BerkeleyDB.4.3/lib ./.libs/liblber.a ../../libraries/liblutil/liblutil.a
ld: (Warning) Cannot load library symbol table in ./.libs/liblber.a, it might be missing or corrupted. Skipping library ./.libs/liblber.a.
ld: (Warning) Cannot load library symbol table in ../../libraries/liblutil/liblutil.a, it might be missing or corrupted. Skipping library ../../libraries/liblutil/liblutil.a.


Same error.
Acclaimed Contributor
Dennis Handly
Posts: 25,190
Registered: ‎03-06-2006
Message 9 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Can you provide either liblber.a & liblutil.a, whichever is smaller?
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 10 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Sure--liblutil.a is attached
Honored Contributor
Sandman!
Posts: 2,220
Registered: ‎01-13-2005
Message 11 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Hi Connie,

Typically the mismatched ABI is related to mixing 32/64-bit modes in the same compilation. You checked all your .o (object files) but have you verified with elfdump that all the .a (archive libs) files that you're loading into your executable are indeed 64-bit.

cheers!
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 12 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

I never thought of that, because the table was built only from the object files listed, and that is the one being complained of that it cannot load the symbol table. Which option to elfdump tells you if it is a 64-bit archive library?
Acclaimed Contributor
Dennis Handly
Posts: 25,190
Registered: ‎03-06-2006
Message 13 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Looking at your archive indicates no symbol table at all. (elfdump -f -g)
Were you using -q to create or add to it?

My suggestion about using ar -rs doesn't seem to work.

You need to use ar -qs, or use ranlib(1) to fix your archive.
Honored Contributor
Kent Ostby
Posts: 1,836
Registered: ‎09-26-2000
Message 14 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

This RCEN will give you the syntax you are looking for:

http://www1.itrc.hp.com/service/cki/search.do?category=c0&&mode=id&searchCrit=allwords&docType=Engin...
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 15 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Well, now I'm really confused, cause when I run elfdump it is fine...
elfdump -a liblutil.a

liblutil.a:

*** Archive Header ***

Date Uid Gid Mode Size Member Name

liblutil.a[base64.o]:
Mar 14 16:10 2006 105 201 304370 0x2070 base64.o

liblutil.a[csn.o]:
Mar 14 16:10 2006 105 201 304370 0xb78 csn.o

liblutil.a[entropy.o]:
Mar 14 16:10 2006 105 201 304370 0xaf0 entropy.o

liblutil.a[sasl.o]:
Mar 14 16:10 2006 105 201 304370 0x588 sasl.o

liblutil.a[signal.o]:
Mar 14 16:10 2006 105 201 304370 0x838 signal.o



etc..

and
elfdump -f -g liblutil.a
liblutil.a:

liblutil.a[base64.o]:

*** ELF Header ***

Class: ELF-64
Data: Big-endian
OS: HP-UX
ABI Version: 1
Type: REL
Machine: PA-RISC
Version: 1
Entry Addr: 0x0
Program Hdr Offset: 0x0
Section Hdr Offset: 0x1c30
Flags: Wide-mode
Flags: PA2.0
Elf Hdr Size: 0x40
Program Hdr Size: 0x38
Program Hdr Number: 0
Section Hdr Size: 0x40
Section Hdr Number: 17
Section Hdr String Idx: 16

liblutil.a[csn.o]:
... etc...

So, why when you looked at it was it not?
c*
Acclaimed Contributor
Dennis Handly
Posts: 25,190
Registered: ‎03-06-2006
Message 16 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

>now I'm really confused, cause when I run elfdump it is fine...

Basically you are seeing the -a and -f output which is useless for ld. You need to look for the -g output. Use ranlib and you'll see the extra global symbol table.
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 17 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

I just ran elfdump -g liblutil.a on the file before and after running ranlib, and I get the same output (none!)
frank3 /usr/local4/openldap-2.3.19/libraries/liblutil $ elfdump -g liblutil.a

liblutil.a:
Acclaimed Contributor
Dennis Handly
Posts: 25,190
Registered: ‎03-06-2006
Message 18 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

>I just ran elfdump -g liblutil.a on the file before and after running ranlib, and I get the same output (none!)

I get -g output on your test .a whether I use /usr/ccs/bin/ranlib or /usr/ccs/bin/ar -qs.
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 19 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Different than just the name of the archive file, like I posted?
Acclaimed Contributor
Dennis Handly
Posts: 25,190
Registered: ‎03-06-2006
Message 20 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

>Different than just the name of the archive file, like I posted?

Yes, massive amounts of output:
copy.a:
*** Archive Symbol Table ***
1618 lutil_b64_ntop
...
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 21 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

OKay, it turns out that when I played with it, I used /usr/ccs/bin/ar or /usr/ccs/bin/ranlib, but when I ran the Makefile, it deleted and recreated with ar or ranlib, which are both links to those files, but they DO NOT work the same:
frank3:[/usr/local4/openldap-2.3.19] # ll /bin/ranlib
lr-xr-xr-t 1 root sys 19 Dec 22 2004 /bin/ranlib -> /usr/ccs/bin/ranlib
frank3:[/usr/local4/openldap-2.3.19] # ll /usr/ccs/bin/ranlib
-r-xr-xr-x 1 bin bin 854 Sep 9 2004 /usr/ccs/bin/ranlib

When I switched libtool to use the full path, now it works. Thanks for all of your help!!! Never would have found something that picky myself...
Regular Advisor
MTSU_SAN
Posts: 102
Registered: ‎11-14-1996
Message 22 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

Forgot to close when I posted the solution!
Acclaimed Contributor
Dennis Handly
Posts: 25,190
Registered: ‎03-06-2006
Message 23 of 23 (1,103 Views)

Re: Having trouble with archive libraries in 64-bit 11.11 HP-UX

>it deleted and recreated with ar or ranlib, which are both links to those files, but they DO NOT work the same:

This is not likely, the softlinks should work exactly the same. If you are using a "real" shell, what does whence ranlib or whence ar show?

It will likely show the wrong /usr/local/bin/ version?

So you should make sure that /usr/bin comes before /usr/local/bin/.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.