public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: gcc static library issue -- libdl
       [not found] <016101c16285$44e81f40$50c80ac0@acer>
@ 2001-10-31  9:07 ` Kevin Sindhu
  0 siblings, 0 replies; only message in thread
From: Kevin Sindhu @ 2001-10-31  9:07 UTC (permalink / raw)
  To: Bin Zhou
  Cc: gcc-help, gcc, crossgcc, crossgcc, binzhou, Rod Thomson, Stephen Rasku

Hello,

On Wed, Oct 31, 2001 at 07:28:26PM -0800, Bin Zhou so wrote:

> I am using gcc2.95.2 on Solaris2.8 on Intelx86.

> I use the option "-static" at the linkage phase, in order to link to
> gcc libraries staticly (get rid of dynamic libraries such as
> libstdc++.so at running time). 

[...]

> Since my source code references to system functions such as
> "dlclose" and "dlsym" etc, so the "libdl" is required for static
> linkage. Therefore, I also added "-ldl" for linkage. The problem is
> that the linker reports an error saying that "can not find -ldl".

Sun does not ship with a statically linked libdl and does not usually
want people to ship statically linked programs. There are many
reasons to this and primarily they are be summed up here:

http://marc.theaimsgroup.com/?l=openssh-unix-dev&m=98563522332517&w=2

> I checked /usr/lib and /usr/local/lib, I can only see
> libdl.so/libdl.so.1, but could not find libdl.a

There is none.

> However, Redhat have both the libdl.a and libdl.so.

Of course.

> Where can I get the libdl.a for Solaris2.8 on Intelx86 or there is
> an altnative library I can link to.

You have two alternatives:

1) Get the Solaris 2.8 source code and compile it. However due to
strict licensing restrictions, this will not apply when we ship the
product.

2) ^BETTER^ alternative.

See attached dlstubs.c file (derived from /usr/include/dlfcn.h and
thanks to Hal <hal@deer-run.com>). 

Compile the attached file with gcc such as:

gcc -c 02 -g dlstubs.o dlstubs.c

Then use this object file with your target and compile it with static
flag. For example,

    gcc -static -o bar foo.o dlstubs.o -l{yourlibs}

> Thanks a lot for any comments,

Hope that helps.

Regards

-- 
Kevin Sindhu 			    <kevin at tgivan dot com> 
Systems Engineer
TGI Technologies Inc.
107 E 3rd Avenue        	Tel: (604) 872-6676 Ext 321
British Columbia V5T 1C7	Fax: (604) 872-6601 
Canada.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-10-31  9:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <016101c16285$44e81f40$50c80ac0@acer>
2001-10-31  9:07 ` gcc static library issue -- libdl Kevin Sindhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).