tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Using a replacement linker with pkgsrc



* On 2020-06-26 at 17:27 BST, Brook Milligan wrote:

> I’m not entirely sure if it is possible to build everything in
> pkgsrc with a single compiler; thus, there may always be some sort
> of magic like GCC_REQD.  However, if it is (or if it mostly is), I
> agree that an up-front, known-good configuration is much preferable
> to inpenetrable magic that almost works but often doesn't.

It is entirely possible, but does require a few changes to ensure that
any packages that are in the bootstrap path to the compiler you have
selected do not end up depending on it, as this will cause circular
dependencies.

First, point any tool dependencies to external versions:

  https://github.com/joyent/pkgbuild/blob/master/include/exttools.mk

Then set GCC_REQD to the version that you've selected (for example
we're currently using 9.3.0, and we try to stay ahead of any newer
GCC_REQD requirements) and enable USE_PKGSRC_GCC=yes, except for any
packages in the dependency path:

  https://github.com/joyent/pkgbuild/blob/master/include/pkgsrc-gcc.mk

Finally, if you wish to distribute your packages, you need to ensure
that they have the correct dependency on the gcc*-libs package for
your chosen compiler, so that they simply depend on the smaller
package that provides the runtime libraries instead of needing to pull
in the entire GCC package:

  https://github.com/joyent/pkgbuild/blob/master/include/gcc-libs.mk

We've used this setup for many many years at Joyent to provide our
binary package sets, and it works great, but as it may differ between
OS and user environments it isn't something that is integrated into
pkgsrc yet.  Hence requiring the user do some up-front work first.

> To aid “not thinking in advance”, would it be feasible to define a
> better set of hooks for selecting a specific compile and also
> provide some, perhaps platform/version-specific, defaults?  It would
> be really helpful to be able to say, I want to use compiler X
> throughout, and have pkgsrc do the right thing.

This is definitely a goal, but I think it will in practise be very
tricky to get right, which is why until now I've always simply pointed
people to our working implementation so that they can copy and
customise as required, as e.g. Jason Bacon has done on CentOS.

Doing the same thing for clang would be very similar, it just needs to
have an equivalent to USE_PKGSRC_GCC_RUNTIME.

Cheers,

-- 
Jonathan Perkin  -  Joyent, Inc.  -  www.joyent.com


Home | Main Index | Thread Index | Old Index