Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
need info about -static-libs
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
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1413

PostPosted: Sat Sep 10, 2011 7:23 pm    Post subject: need info about -static-libs Reply with quote

Ever more ebuilds have this use flag "static-libs".

Why is it now to introduce this flag?
What policy has changed?
Has this implications to things like:
- lafilefixer
- revdep-rebuild
- @preserved-rebuild of portage-alpha

If using +static-libs that obsoletes revdep-rebuild?
If using +static-libs prelinking is obsolete?
If using +static-libs there are security aspects?
Does it need more RAM-memory to use +static-libs ?
_________________
ultra left enrich
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15609

PostPosted: Sat Sep 10, 2011 8:33 pm    Post subject: Reply with quote

Previously, packages installed their static libraries unconditionally or controlled it with USE=static, which was wrong. Now, they have USE=static-libs to control it.

It has implications for lafilefixer: you may need to make more use of it than usual until you get all your packages cleaned up.

It should have no implications for @preserved-rebuild.

Do not use +static-libs unless you can explain why you need it. Dynamic libraries are a better choice in the vast majority of cases.

Using +static-libs does not obsolete revdep-rebuild.

Using +static-libs is not relevant to prelink.

Using +static-libs could make security maintenance harder, since using it makes it easier for other packages to link statically to libraries. After you upgrade the package that provides the library, you must also find and rebuild any packages which linked to its static library.

Yes, you might use more RAM if you USE=static-libs.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7428

PostPosted: Sat Sep 10, 2011 9:20 pm    Post subject: Re: need info about -static-libs Reply with quote

ulenrich wrote:
Ever more ebuilds have this use flag "static-libs".

Why is it now to introduce this flag?
Cause the dev could and it gave user something gentoo always try to gave him: choice
Sometimes devs doesn't gave users something then change their mind (it's also the case for some other things, like at first devs were enforcing mplayer cflags, now devs allow user to bypass that completly to build even a non working mplayer if he wish), and static-libs have an usage, even if it's not for most users.

ulenrich wrote:

Has this implications to things like:
- lafilefixer
- revdep-rebuild
- @preserved-rebuild of portage-alpha

They are tools because when you update a library you might lost the older version and programs links against the older version are now broken. If you use static, the library will be tied to the program and no update will come until you rebuild the program itself, so the tools are mosly useless then (mostly because i don't think you could build a full system static, not it's not doable, but not a whole generic system, and certainly not a whole gentoo, but doable for a specific system where needs are known and programs that will run on it too)

ulenrich wrote:

If using +static-libs there are security aspects?

static version gave more security as a flaw in a lib affect only that program while a flaw in a shared libs will affect any programs that use that bad lib.
but finding a flaw in a shared lib and correcting it mean every programs that use that shared lib are now secure too. While the static version even if you correct the flaw, you need to correct it in every program, this mean as a bare minimum rebuild any program that was link against it, but it generally also mean you'll have to check every programs to see what lib version they are using.

ulenrich wrote:

Does it need more RAM-memory to use +static-libs ?

no and yes (and should be yes all time).
no because the lib is just link to the program, so you'll eat as much as before.
and yes, because if 2 programs are using the same lib, their static version will use 2xtime the same library, so you will eat more ram.
But people "normally" have an idea behind the wish to static link them, it would be dumb to link 2 programs staticaly against glibc and better to use the glibc shared version for them. But it is better if instead of doing that you link them staticaly with another libc that is smaller (dietlibc, uclibc...), this time you could endup with your program running smaller (and this is a need for restrict environement/ressource, like embedding system, cars, fridge...)

And the real answer would be, don't use static-libs if you don't know why, and a better point of view than mine would be -> http://blog.flameeyes.eu/2011/08/29/useless-flag-static-libs

edit: lol i'm slow, like Hu said then
Back to top
View user's profile Send private message
Spidey
Apprentice
Apprentice


Joined: 07 Sep 2006
Posts: 269

PostPosted: Sun Sep 11, 2011 1:56 am    Post subject: Reply with quote

What is the difference now between +static and +static-libs USE flag?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15609

PostPosted: Sun Sep 11, 2011 3:31 am    Post subject: Reply with quote

According to the output from equery use, one causes binaries to be statically linked. The other causes the creation of static libraries.
Back to top
View user's profile Send private message
Spidey
Apprentice
Apprentice


Joined: 07 Sep 2006
Posts: 269

PostPosted: Sun Sep 11, 2011 11:49 pm    Post subject: Reply with quote

Pardon my ignorance, but shared and static libraries aren't the same? I mean, doesn't the difference lie in the software that uses these libraries?

In my ignorant understanding, when I compile software S, I can include library L inside of the binary /bin/S or I can include code to search and link, dynamically, to library L inside of /bin/S.
Or libraries meant to be dynamically linked are different than those meant to be statically linked? Or are we talking about libraries with statically linked dependencies?
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1413

PostPosted: Mon Sep 12, 2011 12:32 am    Post subject: Reply with quote

@krinn, yes flaymees blog shows nobody of us normal users ever need "static-libs"
_________________
ultra left enrich
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 15609

PostPosted: Mon Sep 12, 2011 2:37 am    Post subject: Reply with quote

Spidey: no, they are not the same. They are named differently on the filesystem, are compiled differently, are used in similar but distinct ways, and serve different purposes. See static library, shared libraries, and dynamic linker.
Back to top
View user's profile Send private message
gary987
n00b
n00b


Joined: 07 Oct 2006
Posts: 15

PostPosted: Sat Apr 05, 2014 5:44 pm    Post subject: Reply with quote

I know that some are not in favour of static libs... but I enjoy that handbrake always works, and works properly.

Nothing worse than a boot program borking..because of a dyanimc library.. . ie e4rat and libboost.

But in general, no static libs is better.
Back to top
View user's profile Send private message
maxim.251
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jul 2012
Posts: 91

PostPosted: Sat Jun 20, 2020 9:27 am    Post subject: Static libs for whole system Reply with quote

I did test on my system, I upgraded whole system including static-libs.
I have some problems with other flags, but for gentoo that's normal.
Compiling system with that flag was not so problematic, its recompile almost all. But what I notice, is
when compiling static lib which is depended to another static lib, compile is not successful. Starts to complain that link to specifik lib is not in the system, even if I have that lib recompiled and is exist in that file. Static lib of lib A is removing link which other libs whant to use it.
Removing static lib for lib B compile it without problem.

Next problem is with for example biblioteck EFL from enlightenment. Efl wit static lib recompile without any problem, but when I restarted enlightenment, EFL do not want could connect to Xserver, and connection breaks.
LXDE what I am using as second window manager for fixing my system, was working, that means that xorg was ok.
Recompiling and removing static-libs from efl helps and windowmanager efl start to work.

Some programs like steam for games also didn't want to start up.

Recompiling whole system back to normal without static-libs makes also problems, library after updates changed number for example
[*]linreadline.so.7 to [*]libreadline.so.8, this makes big problem because many libs and programs are using that lib in compiling stage, but link to 7 version was not exist anymore, and it was problem to link to 8 version, library's was complaining that they cant find [*]libreadline.so.7, I needed manually cheat that problem copying lib from 8 version and rename it ass 7 version.
Compilation start working with success.
Also trying compile [*]readline-7.0."something" was not possible because of problem looking for library previously compiled.

I notice that for most libs static-libs don't hurt them, I could use some tools even if that tools needed library to work if that library was not existed in system. That's big plus. Especially when system need to be fix.

But ass everybody says about static libs, and I did tested that, is not advice to use static-libs system wide. Better is decide what importand programs or tools You have and recompiled that separately.
I thing sudo program could be good example. Revdep-rebuild could be rebuild also with static-lib, but not whole system.

Greatings.
Ps, it takes me almost 5 days to fixt and updatet whole system.
Back to top
View user's profile Send private message
charles17
Advocate
Advocate


Joined: 02 Mar 2008
Posts: 3431

PostPosted: Sat Jun 20, 2020 9:57 am    Post subject: Reply with quote

ulenrich wrote:
@krinn, yes flaymees blog shows nobody of us normal users ever need "static-libs"

As from my /etc/portage/package.use
Code:
# required by sys-power/suspend-1.0_p20150810::gentoo[lzo]
>=dev-libs/lzo-2.09 static-libs
# required by sys-power/suspend-1.0_p20150810::gentoo[crypt]
>=dev-libs/libgpg-error-1.27-r1 static-libs
>=dev-libs/libgcrypt-1.7.8 static-libs

Am I doing something wrong?
Back to top
View user's profile Send private message
mv
Watchman
Watchman


Joined: 20 Apr 2005
Posts: 6356

PostPosted: Sat Jun 20, 2020 10:58 am    Post subject: Reply with quote

charles17 wrote:
ulenrich wrote:
@krinn, yes flaymees blog shows nobody of us normal users ever need "static-libs"

As from my /etc/portage/package.use
Code:
# required by sys-power/suspend-1.0_p20150810::gentoo[lzo]
>=dev-libs/lzo-2.09 static-libs
# required by sys-power/suspend-1.0_p20150810::gentoo[crypt]
>=dev-libs/libgpg-error-1.27-r1 static-libs
>=dev-libs/libgcrypt-1.7.8 static-libs

Am I doing something wrong?

No, you are doing it exactly right: Depending on your installed applications, a few might require static libs. (suspend is a very natural example where all is needed in a single binary for a specific reason.)
Enabling static-libs for those packages for which you have such a dedicated reason is completely fine. Enabling static-libs globally instead would be calling for problems and security issues. (Yes, also the latter, because portage does not guarantee to recompile all dependencies after a recompile of a static lib - in some cases this even needs repeated emerging of the same package (in different orders), in the worst case you have a quadratic emerge number.)
Back to top
View user's profile Send private message
Juippisi
Developer
Developer


Joined: 30 Sep 2005
Posts: 475
Location: /home

PostPosted: Mon Jun 22, 2020 6:01 am    Post subject: Re: need info about -static-libs Reply with quote

ulenrich wrote:
Ever more ebuilds have this use flag "static-libs".

Why is it now to introduce this flag?
What policy has changed?


The original post was made in 2011, but wanted to say there's an updated policy that static-libs shouldn't be enabled unless they are needed by some reverse dependency.
https://projects.gentoo.org/qa/policy-guide/installed-files.html#pg0302
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