Languages and Scripting

64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

 
jay11
Occasional Advisor

64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

I have a 64 bit HP-UX B.11.31 system. My application uses iconv for encoding. Everything works fine if I build 32 bit application and link it with /usr/local/lib/libiconv.a.

However, this is a 32 bit archive and not 64 bit.Hence, when I try to build 64 bit application, I get an error:-

"ld: Mismatched ABI (not an ELF file) for /usr/local/lib/libiconv.a"

My understanding was HP-UX shipped native 32/64 bit iconv. But, if I do not link to /usr/local/lib/libiconv.a for 32/64 build, I get

"undefined sysmbol - iconv_open(), iconv_close()".

Hence, I link with /usr/local/lib/libiconv.a.

Do I have to download iconv source and build it with 64 bit options? If yes, I need some help on HPUX 64 bit flags required for building iconv. If no, how do I link to 64 bit iconv?
12 REPLIES 12
Michael Steele_2
Honored Contributor

Re: 64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

See application system hardware and software requirements for HP-UX from the manufacturer of the application.

At this point you are at the code level and code is not the responsibility of the SA.
Support Fatherhood - Stop Family Law
jay11
Occasional Advisor

Re: 64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

Michael, Thanks for the reply..

I am the owner of the application which I am trying to link with libiconv.
Steven Schweda
Honored Contributor

Re: 64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

> I have a 64 bit HP-UX B.11.31 system.

You may think that that's a useful
description, but it's not. Useful would be
actual output from, say:

uname -a

> My understanding was HP-UX shipped native
> 32/64 bit iconv. [...]

Then why are you trying to link with stuff
from "/usr/local"?

> [...] But, if I do not link to
> /usr/local/lib/libiconv.a for 32/64 build,
> I get [...]

You get that from what, exactly?

As usual, showing actual commands with their
actual output might be more helpful than
vague descriptions or interpretations.

man 3C iconv

[...]
WARNINGS
If you use iconv() and compile/link your application archive on PA-
RISC systems, note that iconv() has a dependency on libdld.sl that
will require a change to the compile/link command:
[...]

If I knew which kind of "64 bit HP-UX B.11.31
system" you were using, then I might know if
this warning was relevant. But I don't.


If you supplied a simple test case, and the
commands you use to compile and link, then a
reader who is too lazy to write his own (and
guess how you're building yours) might be
able to run an experiment more easily. Just
a thought.
Steven Schweda
Honored Contributor

Re: 64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

> I am the owner of the application [...]

From "My application", and the fact that you
were trying to link the thing, that much was
obvious to some of us. (Other things were
less so.)
jay11
Occasional Advisor

Re: 64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

Steven..Apologies for not making myself clear.

1) uname -a
Output:- HP-UX hpuxsys B.11.31 U 9000/800 1774488355

2) Makefile:-
gcc -Wall -fPIC -DHPUX_64 -D_PSTAT64 -DOS_HPUX -D_V2 -o sampleApp sampleApp.o $(LIB) -lstdc++ -lm -lnsl -lintl -L/lib /usr/local/lib/libiconv.a

where LIB=-L./ -L/usr/local/lib64 ---> 64 bit make

LIB=-L/lib -L/usr/local/lib -L/usr/lib ---> 32 bit make

Now, if I do not use "/usr/local/lib/libiconv.a", I get below error:-

"undefined symbol - libiconv_open, libiconv_close"

However, makefile works for 32 bit, but does not work for 64 bit.

3) I did a search for libiconv.a under /usr and can see only 1 entry:-

/usr/local/lib/libiconv.a ---> 321 bit


4) Stripped down sample test code:-

#include
void convert()
{
char *current = NULL;
current = nl_langinfo(CODESET);
string from;
from.assign(current);
string to("UTF-8");
iconv_t converter = iconv_open(to.c_str(),from.c_str());
...////iconv() stuff
iconv_close(converter);
}
Steven Schweda
Honored Contributor

Re: 64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

> 1) uname -a
> Output:- HP-UX hpuxsys B.11.31 U 9000/800 1774488355

Ok. So, PA-RISC, yes?

> man 3C iconv
>
> [...]
> WARNINGS
> If you use iconv() and compile/link your application archive on PA-
> RISC systems, note that iconv() has a dependency on libdld.sl that
> will require a change to the compile/link command:
> [...]

Did you read that? Did you try any of it?

> If you supplied a simple test case, [...]

> 4) Stripped down sample test code:-

You can compile and link that? My idea of a
test case and yours seem to differ.

> Now, if I do not use
> "/usr/local/lib/libiconv.a", I get below
> error:-

I understand that you have trouble when you
don't use the library from "/usr/local". But
you don't seem to have a 64-bit version of
that library. If you want to use the HP
iconv() stuff, then don't use the
"/usr/local" stuff. If you want to use the
"/usr/local" stuff, then get a more complete
set of iconv() stuff there.
jay11
Occasional Advisor

Re: 64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

Steven..Thanks for your help on this.

1) Yes, its a PA-RISC system

2) Sample code compiles and links for 32 bit version , but fails for 64 bit version.

3) I am more than willing to use HP's iconv() stuff. But, again I doubt if it supports iconv_open() and iconv_close() calls.

iconv() requires iconv_t converter - which is obtained through iconv_open().

That means HP's native iconv() should have .a/.sl (archive/shared object) file somewhere - which I am unable to find inside /usr.

4) I will investigate on native iconv's dependency on libsdl - but that is secondary as I do not know where HP's native iconv shared object resides?
Steven Schweda
Honored Contributor

Re: 64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

> That means [...]

Or it's in the normal C RTL stuff, or its
name is different from that of the GNU iconv
stuff, or ...

> But, again I doubt [...]

man iconv
man iconv_open

Or do I need to fire up my HP-UX system
again?
Rajesh K Chaurasia
Valued Contributor

Re: 64 bit iconv - mismatched ABI /usr/local/lib/libiconv.a

You need to build 64-bit libiconv from sources yourself. libiconv is 32-bit only package.

Regards
-Rajesh