🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #3502

Re: How to eliminate unnecessary shared libraries from binary?

#3502
From: Paul Pluzhnikov
Date: Mon, 31 Jan 2005 04:50
39 lines
2293 bytes
"Dennis" <rwlin@avamax.com> writes:

>             LFLAGS= -lpthread -lm -ljpeg
...
>     The executable is always linked with the 3 shared libraries 

This is "as designed".

> even if they are not necessary 

The linker can't know that. Maybe they appear to be unnecessary now,
but are required by something else that the executable will load
later.

> which produces the runtime loading error.

Huh? If at least one of your exes requires all 3 libraries, and if
that exe runs, then all the other exes should run just as well.

> Is it possible for ld smart enough to check the real dependency
> and linked with them only?

Such a linker would be "thinking for you" and doing what it thinks
is right, not what you told it to do.

There is no worse frustration then fighting tools that think they
are smarter then you.

If you don't want extra dependencies, write a correct Makefile.

GNU make (and Sun make, IIRC) has 'target-specific variable values':

   This feature allows you to define different values for the same
   variable, based on the target that `make' is currently building.

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Technical Details
Message-ID: <m3wttudwxj.fsf@salmon.parasoft.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!cyclone.bc.net!newsfeed.telusplanet.net!newsfeed.telus.net!hwmnpeer01.phx!hwmedia!hw-poster!fe06.lga.POSTED!53ab2750!not-for-mail
References: <ctkccr$sqg$1@netnews.hinet.net>

Show Full Headers
Complete Article Headers
X-Google-Thread: fc89c,64066ebea43813ab
X-Google-Thread: 11318c,64066ebea43813ab
X-Google-Attributes: gidfc89c,gid11318c,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!cyclone.bc.net!newsfeed.telusplanet.net!newsfeed.telus.net!hwmnpeer01.phx!hwmedia!hw-poster!fe06.lga.POSTED!53ab2750!not-for-mail
Sender: paul@salmon.parasoft.com
Newsgroups: comp.unix.programmer,gnu.gcc.help
Subject: Re: How to eliminate unnecessary shared libraries from binary?
References: <ctkccr$sqg$1@netnews.hinet.net>
From: Paul Pluzhnikov <ppluzhnikov-nsp@charter.net>
Message-ID: <m3wttudwxj.fsf@salmon.parasoft.com>
Lines: 39
User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: dkoicekneficefklkdpnhlnpmgajhpgaahhagjidnffdohekihmechmncmkmkhojdadgkklcjammigjeakngmmneimggmmdkiimdmednjibjlbjiojpnlfelmcoaoldclhnb��
NNTP-Posting-Date: Sun, 30 Jan 2005 21:53:50 MST
Date: 30 Jan 2005 20:50:16 -0800