[gentoo-user] Building static libraries
Hi everyone! I need to build a static binary of a program I wrote. The problem is that most packages only install dynamic version of the libraries. There are the static and static-libs USE flags, but only a tiny fraction of packages support them. Modifying every relevant ebuild is not really a viable solution since the list of packages is quite long and could change later. So what can I do if I'd like to avoid compiling every package manually? Cheers, Renat -- Probleme kann man niemals mit derselben Denkweise loesen, durch die sie entstanden sind. (Einstein) signature.asc Description: PGP signature
Re: [gentoo-user] Building static libraries
On Sun, 2009-12-13 at 20:18 +0100, Renat Golubchyk wrote: Hi everyone! I need to build a static binary of a program I wrote. The problem is that most packages only install dynamic version of the libraries. There are the static and static-libs USE flags, but only a tiny fraction of packages support them. Modifying every relevant ebuild is not really a viable solution since the list of packages is quite long and could change later. So what can I do if I'd like to avoid compiling every package manually? There is no easy answer to your question. I think because, with a lot of programs it just depends. Some packages already include static libraries (e.g. python and it doesn't make sense to compile the python package statically because it will break a great many things). Some programs just weren't designed to be static (e.g. imagemagick or apache). GTK+, i believe, can't be built statically as it uses dynload for themes, input methods, etc etc. Even most proprietary gtk-based software that I know of (e.g. Adobe Flash and VMWare) either are distributed with GTK+ linked dynamically or they provide their own GTK libs). You can apply -static to CFLAGS, but make sure you have a binpkg built first, as there is a chance you may break something. You can also try passing --enable-static to EXTRA_ECONF. That's probably safer than the former, but the same caveat applies. Most of the things where static is useful and safe already have a static flag though or provide static libs by default. I think the only exception I've encountered was e2fsprogs. For that I usually compile my own static executables. HTH, -a
Re: [gentoo-user] Building static libraries
On Sun, 13 Dec 2009 15:40:34 -0500 Albert Hopkins mar...@letterboxes.org wrote: GTK+, i believe, can't be built statically as it uses dynload for themes, input methods, etc etc. Even most proprietary gtk-based software that I know of (e.g. Adobe Flash and VMWare) either are distributed with GTK+ linked dynamically or they provide their own GTK libs). Hmm, I'll test that because I use GTK+ although it is not a GUI app. You can apply -static to CFLAGS, but make sure you have a binpkg built first, as there is a chance you may break something. You can also try passing --enable-static to EXTRA_ECONF. That's probably safer than the former, but the same caveat applies. Ah, in all the years using Gentoo I have never needed EXTRA_ECONF, although I've heard a lot about it on this list. It is, of course, listed in make.conf man page, but since everything works here I usually do not need to look at it. Anyway, thanks for the pointer. I'm testing it right now, and it seems to work so far. I'll report back when emerge is finished. Cheers, Renat -- Probleme kann man niemals mit derselben Denkweise loesen, durch die sie entstanden sind. (Einstein) signature.asc Description: PGP signature