Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Compile everything as static?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Nitro
Bodhisattva
Bodhisattva


Joined: 08 Apr 2002
Posts: 661
Location: San Francisco

PostPosted: Wed May 08, 2002 2:11 am    Post subject: Compile everything as static? Reply with quote

I noticed that there is a "static" USE flag for portage in /usr/portage/profiles/use.desc. This leads to me to think... Would compiling stuff like X, Mozilla, Enlightenement, and galeon run faster? It wouldn't have to load the libraries at run time right?
_________________
- Kyle Manna

Please, please SEARCH before posting.

There are three kinds of people in the world: those who can count, and those who can't.
Back to top
View user's profile Send private message
slik
n00b
n00b


Joined: 18 Apr 2002
Posts: 48
Location: Alberta, Canada

PostPosted: Wed May 08, 2002 3:32 am    Post subject: Re: Compile everything as static? Reply with quote

Nitro wrote:
Would ... run faster?

It would have to load the extra functions statically linked into the binary, so the binaries would be larger. You wouldn't save on load time if a library is already in memory. Static binaries would run slightly faster, everthing else being equil.

Static binaries would be more reliable however, in that they won't break if an underlying library is removed/upgraded (libpng).
Back to top
View user's profile Send private message
AnimalMachine
Tux's lil' helper
Tux's lil' helper


Joined: 27 Apr 2002
Posts: 106
Location: Milwaukee, WI USA

PostPosted: Wed May 08, 2002 2:03 pm    Post subject: Reply with quote

In addition to what slik pointed out, here are some negatives (I'm naturally pessimistic :)):

#1 You also wouldn't be able to fix bugs in the libraries by upgrading the library package. Think of the zlib security bug that was found a little bit ago.

#2 The size of the binary would also increase, and if this is done as a system-wide policy, a substantial amount of space could be wasted. Of course, this probably only matters on space-constrained system ... not such a big deal when installing on a 20+ gb ext3 partition.

For me, #1 is probably the biggest reason to use dynamic libraries. But then again, you could just say that the potential to create bugs balances out the potential to fix bugs. :wink:
Back to top
View user's profile Send private message
UTRules
n00b
n00b


Joined: 11 May 2002
Posts: 10

PostPosted: Sat May 11, 2002 10:56 pm    Post subject: Reply with quote

FWIW, on Redhat 7.2 both galeon and mozilla are static binaries.

I tend to agree with slik - the best reason for compiling statically is to keep your executable from breaking when system libraries get upgraded. Speed seems to be an issue in Linux with large C++ libraries like KDE has to deal with - hence the objprelink hack. The other edge of the static compiling sword is that you're going to have more copies of the same code loaded into memory, which is a less efficient use of resources than shared libraries.
Back to top
View user's profile Send private message
Nitro
Bodhisattva
Bodhisattva


Joined: 08 Apr 2002
Posts: 661
Location: San Francisco

PostPosted: Sun May 12, 2002 1:05 am    Post subject: Reply with quote

Well, and statically compiled binaries are easier to throw in to a chroot.
_________________
- Kyle Manna

Please, please SEARCH before posting.

There are three kinds of people in the world: those who can count, and those who can't.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum