Operating System - HP-UX
1822982 Members
3752 Online
109645 Solutions
New Discussion юеВ

HP UX11i : cc complier error : How can we force cc copiler to use archive libraries as well

 
amit_19
Occasional Contributor

HP UX11i : cc complier error : How can we force cc copiler to use archive libraries as well

We are using ANSI Compliant cc compiler on HP UX 11i. When we try to compile one program which uses an .a (archive) library it gives us error for the symbols defined in this library. The error is probably because one can not use .a libraries on HP UX 11i and we do not have a .sl (shared ) library in this case. Is there any way to force cc compiler to use .a libraries as well? Any pointers will be great help.
TIA,
Amit
4 REPLIES 4
Jerome Baron
Respected Contributor

Re: HP UX11i : cc complier error : How can we force cc copiler to use archive libraries as well

Hi,

In man ld(1) you can show :
-lx Search a library libx.a or libx.sl, where x is one or more characters. The current state of the -a option determines whether the archive (.a) or shared (.sl) version of a library is searched. Because a library is searched when its name is encountered, the placement of a -l is significant. By default, 32-bit libraries are located in /usr/lib and /usr/ccs/lib. 64-bit libraries are located /usr/lib/pa20_64. If the environment variable LPATH is present in the user's environment, it should contain a colon-separated list of directories to search. These directories are searched instead of the default directories, but -L options can still be used. If a program uses shared libraries, the dynamic loader /usr/lib/dld.sl for 32-bit or /usr/lib/pa20_64/dld.sl for 64-bit will attempt to load each library from the same directory in which it was found at link time (see the +s and +b options).

This option can be used with cc(1). Does this option hel us ?

Regards,
Jerome
Adam J Markiewicz
Trusted Contributor

Re: HP UX11i : cc complier error : How can we force cc copiler to use archive libraries as well

It seems to me that you did generate program with the library, but the library itself uses another one. If you couldn't use the archive library the comment would be different.

You have to link with something more.

Good luck

P.S.: If you want more precise help give more precise description.
I do everything perfectly, except from my mistakes
rick jones
Honored Contributor

Re: HP UX11i : cc complier error : How can we force cc copiler to use archive libraries as well

It would indeed help to see some of the command lines and error messages involved.

Also, if you are using the swithc to tell the compiler to do everything archived, indeed, there are some libraries that only ship .sl and not .a, which means that if you end-up with a dependency on such a library, you can at best do archive_shared rather than strictly archived.

Also, on what revision of HP-UX is the .a library's sources compiled?
there is no rest for the wicked yet the virtuous have no pillows
sshp
Advisor

Re: HP UX11i : cc complier error : How can we force cc copiler to use archive libraries as well

I think if you give the following options to cc it will compile
-L -l

Probably you are already doing this