Operating System - HP-UX
1753781 Members
7345 Online
108799 Solutions
New Discussion

Re: GNU libiconv for HP-UX

 
maxime2
Occasional Contributor

GNU libiconv for HP-UX

Hi

I use the gnu compiler on a HP integrity server (HP-UX 11i v2).

When I use the function iconv() defined in iconv.h, I need to add '-liconv' option in the compile command line.
I also had to install the GNU libiconv portage from here: http://hpux.connect.org.uk/hppd/hpux/Development/Libraries/libiconv-1.14/

In the past, I compiled the same program using the IBM compiler and I did not need to add this option nor to add any additional library (I noticed there is already libiconv installed on the system when I run '/usr/sbin/swlist -l product': Libiconv 1.6.1.13       Libiconv - Character set conversion library).

Now if I execute the 'ldd' command on the binary of my program, I can see that it has a dependency to libiconv:

    /usr/local/lib/hpux32/libiconv.a (libiconv.so.2)


It seems like a static librairy cause it's a '.a' file but it behaves like a shared library. I mean my program is dependent of the libiconv.

My questions: Why libiconv from GNU is a shared library whereas it is a static librairy which is embedded in the binaries of the program when compiling with the IBM compiler ? Is there a way to also use libiconv as a static librairy when compiling with GNU ?

PS: I also compiled the same program on linux with gcc and I did not need to add the '-liconv' option in the compile command line. It seems like a problem specific to HP-UX.

Please don't hesitate to ask for any additional information.

Thank you in advance.

3 REPLIES 3
Dennis Handly
Acclaimed Contributor

Re: GNU libiconv for HP-UX

>I noticed there is already libiconv installed on the system when I run '/usr/sbin/swlist -l product': Libiconv 1.6.1.13       Libiconv - Character set conversion library).

 

This is probably only for /opt/gnome/.

 

>It seems like a static library cause it's a '.a' file but it behaves like a shared library.

 

Somebody pulled a fast one.  ldd(1) will only show shlibs.  And file(1) will tell you it's a shlib.

 

> Is there a way to also use libiconv as a static library when compiling with GNU?

 

You may have to build it yourself:

http://hpux.connect.org.uk/hppd/hpux/Development/Libraries/libiconv-1.14/


>It seems like a problem specific to HP-UX.

 

Using archive system libs is frowned upon on HP-UX.  libc, etc only come in shared flavor.

Perhaps GNU agreed with that when porting to HP-UX?

maxime1
Visitor

Re: GNU libiconv for HP-UX

Thank you for your answer.

 

>Somebody pulled a fast one.  ldd(1) will only show shlibs.  And file(1) will tell you it's a shlib.

 

"shlibs" stands for "shared librairies", right?

 

 

But I am still not sure if these info tell me whether the library is shared or static.

 

> You may have to build it yourself:

http://hpux.connect.org.uk/hppd/hpux/Development/Libraries/libiconv-1.14/

 

Ah yes, this is the link I posted in my first post. But it doesn't include the sources. However I think I can build from here:

 ftp://ftp.mirrorservice.org/pub/gnu/libiconv/

I will give it a try.

 

I still don't get why I did not need this library when compiling with the IBM compiler and I need it when compiling with GCC...

 

EDIT: I am very sorry to post from a different account. I lost my password, so I asked for an email to recreate it but nothing came in my mailbox. Then I recreated an account with the same email (I was said the email is free so I thought my old account may have been deleted). Now when I connect using my email it brings me to my old account.. very strange..

Dennis Handly
Acclaimed Contributor

Re: GNU libiconv for HP-UX

>I am still not sure if these info tell me whether the library is shared or archive.

 

I've told you two ways to confirm that it is a shlib.  ldd(1) and file(1).  And you can also use elfdump(1).

 

>it doesn't include the sources.

 

Huh?  At the bottom of the page is: Tarred/Gzipped Source Code

 

>I still don't get why I did not need this library when compiling with the IBM compiler and I need it when compiling with GCC...

 

There is nothing to get, that's just the way the compiler tool chain and run time architecture works on both machines.  Perhaps it is included in libc on IBM?