Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Feb 2018 10:57:53 -0800
From:      John Baldwin <jhb@freebsd.org>
To:        freebsd-current@freebsd.org, cem@freebsd.org
Cc:        Ronald Klop <ronald-lists@klop.ws>
Subject:   Re: pkg does not recognize correct kernel version
Message-ID:  <20287587.l4BUZnE1AB@ralph.baldwin.cx>
In-Reply-To: <CAG6CVpW9O%2BXkbMe7seSCmvGXmUuOuYJGfAqiFOS2EQxEfpbB0A@mail.gmail.com>
References:  <op.zeo60hflkndu52@klop.ws> <op.zepfusvakndu52@klop.ws> <CAG6CVpW9O%2BXkbMe7seSCmvGXmUuOuYJGfAqiFOS2EQxEfpbB0A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tuesday, February 20, 2018 10:19:02 AM Conrad Meyer wrote:
> On Mon, Feb 19, 2018 at 2:38 PM, Ronald Klop <ronald-lists@klop.ws> wrote:
> > On Mon, 19 Feb 2018 22:05:51 +0100, Konstantin Belousov
> > <kostikbel@gmail.com> wrote:
> >
> >> Look at the man page.  pkg reads version from the /bin/sh ELF FreeBSD
> >
> >
> > Which man page? I can't find it in pkg help update or pkg help upgrade or
> > man pkg.
> 
> I had to dig for quite a while to find a reference (pkg.conf(5)):
> 
>      ABI: string      The ABI of the package you want to install.  Default:
>                       derived from the ABI of the /bin/sh binary.
> 
> >> version note:
> >> orion% file /bin/ls
> >> /bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD),
> >> dynamically linked, interpreter /libexec/ld-elf.so.1, for FreeBSD 11.1
> >> (1101506), FreeBSD-style, stripped
> >>
> >> Update world past the __FreeBSD_version which is reported for the
> >> repository.
> >
> >
> > Does this mean I always have to do a *clean* buildworld after every version
> > bump? This takes ages.
> 
> You could also do a -DNO_CLEAN buildworld.
> 
> Or you can continue to override with "-o OSVERSION=foo", although that
> may eventually result in broken packages.  In general the OSVERSION is
> bumped conservatively (more often than will actually result in
> breakage), so you can get away with the easy workaround for a while
> between buildworlds.

NO_CLEAN=yes doesn't work.  A clean buildworld is required.  The reason is that
the __FreeBSD_version embedded in binaries is stored in /usr/lib/crt*.o, but
that the dependency rules in lib/csu/Makefile do not rebuild these .o files
everytime <sys/param.h> changes (so a NO_CLEAN=yes buildworld won't rebuild them
leaving them with a stale version).  Furthermore, when binaries and shared
libraries are built, our Makefiles do not specify that the relevant
/usr/lib/crt*.o files are dependencies, so even if we fixed the missing
<sys/param.h> dependency, no binaries would relink to pick up the updated
__FreeBSD_version file unless some other input to the binary changed.  This
one could perhaps be mostly mitigated by forcing libc to depend on the
relevant crt*.o files explicitly (or even having it depend on <sys/param.h>
to force relinking of everything when <sys/param.h> changes).

This matters for more than just pkg as the kernel also looks at the embedded
__FreeBSD_version in binaries to make decisions about compat shims to enable
(grep for P_OSREL in sys/).

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20287587.l4BUZnE1AB>