gcc5 dependency challenges

Dewayne Geraghty dewaynegeraghty at gmail.com
Mon Oct 17 03:56:35 UTC 2016

On 14 October 2016 at 21:22, Kubilay Kocak <koobs at freebsd.org> wrote:

> On 14/10/2016 6:48 PM, Dewayne Geraghty wrote:
> > After some rudimentary performance testing I note that we get up
> > around 3% improvement in application performance when we use gcc5 for
> > our package builds.
> >
> > However building ports with gcc results in gcc5 being a dependency.
> > Examining ldd, we find that rarely does anything require gcc5's
> > shared libs for their execution.  Even simple things like ftp/wget
> > and devel/ccache depend on gcc5 for building but NOT runtime.  As we
> > aren't allowed to install compilers onto production systems, what is
> > the best course of action to address? (We could just install gcc5 and
> > then remove it but then of course, the base pkg wants to remove
> > everything (600+ packages) that depends on gcc5!)
> >
> > So the question is - how should we build our packages or install them
> > so that gcc5 is not (unnecessarily) installed?
> >
> > We've added to our /etc/make.conf USE_GCC=  5 but I wonder if there's
> > something like a build_depends mechanism?
> >
> >
> > Background: Our FreeBSD 10.3 Stable uses pkg 1.8.3; whereas ports
> > uses 1.8.7_3, minor point.
> >
> > Why gcc5? Well most ports use clang 3.4.1 to compile, some ports do
> > use gcc 4.8.5; and if we move to FreeBSD11 then we also need to add
> > llvm3.6 into the build/migrating equation.  So to aid our migration
> > effort we "think" choosing gcc5 now is a good idea; particularly as
> > /usr/ports/base/gcc uses gcc 5.4.0 (rather than /usr/ports/lang/gcc
> > which is 4.8.5)
> >
> > All production systems use local package repositories (as heimdal is
> > widely used as are  non-default options).
> >
> > Kind regards, Dewayne
> This (in progress thing) may help:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211154
> See dependent Bugzilla issue:
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=211079
> ./koobs

Thank-you very much for the pointers.

I have appended the following to /usr/ports/Mk/bsd.port.mk
.if defined(PRODUCTION_USE)    # defined in make.conf :)
which has achieved the desired goal.

So I've gone from a virgin system without gcc or binutils where:

b1# pkg-static add /root/build/i386/portconf-1.6_1.txz
[b1.hs] Installing portconf-1.6_1...
[b1.hs] `-- Installing gcc5-5.4.0...
[b1.hs] |   `-- Installing binutils-2.27_4,1...
[b1.hs] |   | `-- Installing gcc5-5.4.0...
[b1.hs] |   |   `-- Installing binutils-2.27_4,1...
b2# pkg-static add /root/build/amd64/portconf-1.6_1.txz
[b2.hs] Installing portconf-1.6_1...
[b2.hs] Extracting portconf-1.6_1: 100%
(Note that portconf is a text script!)

I agree with you.  I have been using a similar approach for many years on
our production boxes, essentially repackaging our packages to achieve the
purpose that you require.  (Note though I also use pkg 1.6.4 to install as
the 1.8 series didn't work as it tried to do something to directories that
didn't exist (I vaguely recall man page directories)).

This is the kludge of excluded files to be repackaged by tar:
cat << EOM > $EXCL

Then walk through your packages and
 tar -cJp -X $EXCL  --options='xz:compression-level=6' -f
/packages-reduced/$P @${P}
where P is the package (eg wget-1.18.txz)

Kind regards, Dewayne.

More information about the freebsd-ports mailing list