Operating System - Linux
1748264 Members
3952 Online
108760 Solutions
New Discussion юеВ

option to have gcc look for xxxx.sl instead of xxxx.so?

 
SOLVED
Go to solution
Steve Post
Trusted Contributor

option to have gcc look for xxxx.sl instead of xxxx.so?

I see lots of spots in the forums where people say "/usr/ccs/bin/ld: Unsatisfied symbols:
XML_Parse (first referenced in /var/tmp//ccu5uXWb.o) (code)
at dld.sl

I know symbol XML_Parse is defined in /usr/local/lib/libexpat.sl. I THINK gcc is looking for it at /usr/local/lib/libexpat.so, instead of /usr/local/lib/libexpat.sl.

MY QUESTION: Is there an option when compiling with gcc to tell it the shared libraries have an .sl extension instead of .so?

I did have a way around this. But I bet there is a better way. I ran my gcc compile this way:
LDOPTS="-L/usr/local/lib -l:libiconv.sl"
export LDOPTS
gcc ./elements.c

Apparently the "-L" tells the linker part of gcc to look in directory /usr/local/lib. And the "-l:" tells the linker part of gcc to look at file libiconv.sl. I would have rather had gcc look for any files with .sl or .so in them under /usr/local/lib.
6 REPLIES 6
Kenan Erdey
Honored Contributor

Re: option to have gcc look for xxxx.sl instead of xxxx.so?

hi;

you can create link. if there is np libexpat.so in your system :

ln -s /usr/local/lib/libexpat.sl /usr/local/lib/libexpat.so

i.e. supporting to older versions is usually done in this way.

Computers have lots of memory but no imagination
A. Clay Stephenson
Acclaimed Contributor

Re: option to have gcc look for xxxx.sl instead of xxxx.so?

I don't use gcc on HP-UX but it has been my experience that the Gnu linker always looks for .so externsions since they are, by far, a more common externsion that .sl (HP-UX). Your make files should be able to use HP's ld command which will look for .sl so that for example -liconv will look for either libiconv.sl or libiconv.a in whatener list of direvtories are specified by the most recent -L argument. Typically (and this depends your makefile dependenies definitions, you can specify whatever linker you like by LD=/xxx/yyy/ld but if you do this there is a non-zero proability that the Gnu version of ld and HP's version of ld will have diferent options so some of your linker options may have to change.
If it ain't broke, I can fix that.
Arunvijai_4
Honored Contributor

Re: option to have gcc look for xxxx.sl instead of xxxx.so?

HI Steve,

MY QUESTION: Is there an option when compiling with gcc to tell it the shared libraries have an .sl extension instead of .so?

You can hard code the library into Makefile. Are you trying to compile in 11.11 or 11.23 ? In 11.11, .sl is the default extension of a shared library.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Steve Post
Trusted Contributor

Re: option to have gcc look for xxxx.sl instead of xxxx.so?

Hey wait a second. That was my question first. The answer from these guys is to mess around with the make file, or make symbolic links.

The actual option for gcc to know it's supposed to use .sl instead of .so? I don't know either.

I was going to dig into make files. Assuming I can't figure it out (I'm a pessimist), I would:

1. cd /usr/local/lib
2. grep -iEl ./*
3. from the list of files I get,
ln -s ./file.sl ./file.so
4. then try compiling/linking again.

Am I compiling in 11.11 or 11.23?
The answer is: a bit of both.
I would be compiling on 11.11 sometime in the near future. I am currently compiling on 11.23 but it is PA-RISC2.0, NOT itanium.

steve
Steve Ellcey
Valued Contributor
Solution

Re: option to have gcc look for xxxx.sl instead of xxxx.so?

There is no GCC option for specifying the library extension. GCC uses the HP linker for linking and it is the linker that decides where and how to look for libraries. The HP linker is going to use .sl suffixes on PA systems and .so suffixes on IPF systems. Trying to change that behaviour will probably just get you into trouble.
Steve Post
Trusted Contributor

Re: option to have gcc look for xxxx.sl instead of xxxx.so?

Ah ha. So really the answer was in my own question. I just didn't know it.
Use LDOPTS. And run "man ld".

Ok. Thank you.