version 1.6, 2017/12/30 01:26:56
|
version 1.12, 2018/01/04 20:37:58
|
Line 10 be converted into historical design rati
|
Line 10 be converted into historical design rati
|
freely takes content from extensive mailinglist discussions, and |
freely takes content from extensive mailinglist discussions, and |
attempts to follow the rough consensus that has emerged. |
attempts to follow the rough consensus that has emerged. |
|
|
## Base system gcc vs pkgsrc gcc |
# Base system gcc vs pkgsrc gcc |
|
|
Systems using gcc (e.g. NetBSD) have a compiler as /usr/bin/gcc, and |
Systems using gcc (e.g. NetBSD) have a compiler as /usr/bin/gcc, and |
this is usable by pkgsrc without any bootstrapping activity. One can |
this is usable by pkgsrc without any bootstrapping activity. One can |
Line 18 build gcc versions (typically newer vers
|
Line 18 build gcc versions (typically newer vers
|
in a compiler within ${PREFIX}, e.g. /usr/pkg/gcc6/bin/gcc. This |
in a compiler within ${PREFIX}, e.g. /usr/pkg/gcc6/bin/gcc. This |
compiler can then be used to compile other packages. |
compiler can then be used to compile other packages. |
|
|
The Issue with using base system gcc is typically that it is too old, |
The issue with using base system gcc is typically that it is too old, |
such as gcc 4.5 with NetBSD 6, which cannot compile c++11. Another |
such as gcc 4.5 with NetBSD 6, which cannot compile c++11. Another |
example is gcc 4.8 with NetBSD 7. While this can compile most c++11 |
example is gcc 4.8 with NetBSD 7. While this can compile most c++11 |
programs, it cannot be used for firefox or glibmm (and therefore any |
programs, it cannot be used for firefox or glibmm (and therefore any |
Line 26 package that links against glibmm).
|
Line 26 package that links against glibmm).
|
|
|
Issues when using pkgsrc gcc are that |
Issues when using pkgsrc gcc are that |
|
|
|
- on some platforms, pkgsrc gcc does not build and work |
- it must be bootstrapped, requiring compiling a number of packages |
- it must be bootstrapped, requiring compiling a number of packages |
with the system compiler |
with the system compiler |
- C++ packages that are linked together should be built with the |
- C++ packages that are linked together should be built with the |
Line 35 Issues when using pkgsrc gcc are that
|
Line 36 Issues when using pkgsrc gcc are that
|
should be linked with the higher version because the support |
should be linked with the higher version because the support |
library is backwards compatible but not forward compatible. |
library is backwards compatible but not forward compatible. |
|
|
## Specific constraints and requirements |
# Specific constraints and requirements |
|
|
This section attempts to gather all the requirements. |
This section attempts to gather all the requirements. |
|
|
Line 65 This section attempts to gather all the
|
Line 66 This section attempts to gather all the
|
clang, when set to use GCC, at least as well as the current |
clang, when set to use GCC, at least as well as the current |
scheme. It is desirable for this logic to work on NetBSD 5. |
scheme. It is desirable for this logic to work on NetBSD 5. |
|
|
|
- All systems should work at least as well as they do before |
|
implementation of new compiler selection logic. |
|
|
- The compiler selection logic should be understandable and not brittle. |
- The compiler selection logic should be understandable and not brittle. |
|
|
## Design |
# Design |
|
|
The above requirements could in theory be satisfied in many ways, but |
The above requirements could in theory be satisfied in many ways, but |
most of them are too complicated. We present a design that aims to be |
most of them are too complicated. We present a design that aims to be |
Line 84 sound while mimimizing complexity.
|
Line 88 sound while mimimizing complexity.
|
4.9. |
4.9. |
|
|
- A user-settable variable PKGSRC_GCC_VERSION will declare the |
- A user-settable variable PKGSRC_GCC_VERSION will declare the |
version of gcc to be used for C programs, with an OS- and |
version of gcc to be used for C programs, with an OS-, |
version--specific default. |
version- and architeture- specific default. |
|
|
- A user-settable variable PKGSRC_GXX_VERSION will declare the |
- A user-settable variable PKGSRC_GXX_VERSION will declare the |
version of gcc to be used for all C++ programs, again with an OS- |
version of gcc to be used for all C++ programs, again with an OS-, |
and version-specific default. It must be at least |
version- and architeture-specific default. It must be at least |
PKGSRC_GCC_VERSION. |
PKGSRC_GCC_VERSION. |
|
|
|
- If PKGSRC_GCC_VERSION and PKGSRC_GXX_VERSION are not set, the |
|
system will behave much as before. As a possible exception, |
|
builds may still fail if the required version is greater than the |
|
base system version. So far the only known reason to avoid |
|
setting these variable is if pkgsrc gcc cannot be built. |
|
|
- Each of c99, c++, c++11, and c++14 will be associated with a |
- Each of c99, c++, c++11, and c++14 will be associated with a |
minimum gcc version, such that almost all programs declaring that |
minimum gcc version, such that almost all programs declaring that |
language can be built with that version. (This avoids issues of |
language can be built with that version. (This avoids issues of |
Line 132 sound while mimimizing complexity.
|
Line 142 sound while mimimizing complexity.
|
approach is possible inconsistency with gcc's dependencies being |
approach is possible inconsistency with gcc's dependencies being |
built with the base compiler and used later. |
built with the base compiler and used later. |
|
|
|
As an alternative, we store lists of bootstrap packages in a |
|
variable, because it will vary with OS and version, and with |
|
PREFER_PKGSRC settings. |
|
|
|
As a third alternative, we pass a GCC_BOOTSTRAPPING variable |
|
recursively. This is easier but less consistent. |
|
|
- We hope that the chosen version can be built using the base system |
- We hope that the chosen version can be built using the base system |
version, and hope to avoid multi-stage bootstrapping. |
version, and hope to avoid multi-stage bootstrapping. |
|
|
Line 139 sound while mimimizing complexity.
|
Line 156 sound while mimimizing complexity.
|
linking with a C++ compiler. This is not a change from the |
linking with a C++ compiler. This is not a change from the |
current situation. |
current situation. |
|
|
## Remaining issues |
# Remaining issues |
|
|
### gcc dependencies introduction |
## gcc dependencies introduction |
|
|
Because gcc can have dependencies, there could be packages built with |
Because gcc can have dependencies, there could be packages built with |
the system compiler that are then later used with the chosen version. |
the system compiler that are then later used with the chosen version. |
Line 149 For now, we defer worrying about these p
|
Line 166 For now, we defer worrying about these p
|
will be less serious than the current situation where all c++11 |
will be less serious than the current situation where all c++11 |
programs fail to build on NetBSD 6). |
programs fail to build on NetBSD 6). |
|
|
\todo: Change gcc 4.8 and 4.9 to enable gcc-inplace-math by default. |
\todo: Perhaps change gcc 4.8 and 4.9 to enable gcc-inplace-math by |
|
default. Perhaps decide that if we want to build gcc, we want to |
|
build 5 or 6, and 4.9 is no longer of interest as a bootstrap target. |
|
|
\todo: Analyze what build-time and install-time dependencies actually |
\todo: Analyze what build-time and install-time dependencies actually |
exist. Include old GNU/Linux in this analysis. |
exist. Include old GNU/Linux in this analysis. |
Line 157 exist. Include old GNU/Linux in this an
|
Line 176 exist. Include old GNU/Linux in this an
|
\todo: Consider if dropping nls would help. (On NetBSD, it seems that |
\todo: Consider if dropping nls would help. (On NetBSD, it seems that |
base system libraries are used, so it would not help.) |
base system libraries are used, so it would not help.) |
|
|
### managing gcc dependencies |
\todo: Consider failing if optins that we want one way are another, |
|
when bootstrapping. |
|
|
|
## managing gcc dependencies |
|
|
There are multiple paths forward. |
There are multiple paths forward. |
|
|
\todo Choose one. Straw proposal is "Don't worry" and recursive |
\todo Choose one. Straw proposal is "Don't worry" and recursive |
variable for the initial implementation. |
variable for the initial implementation. |
|
|
#### Separate prefix |
### Separate prefix |
|
|
Build compilers in a separate prefix, or a subprefix, so that the |
Build compilers in a separate prefix, or a subprefix, so that the |
compiler and the packages needed to build it will not be used by any |
compiler and the packages needed to build it will not be used by any |
Line 172 normal packages. This completely avoids
|
Line 194 normal packages. This completely avoids
|
package one way in bootstrap and another not in bootstrap, at the cost |
package one way in bootstrap and another not in bootstrap, at the cost |
of two builds and writing the separate-prefix code. |
of two builds and writing the separate-prefix code. |
|
|
#### Don't worry |
### Don't worry |
|
|
Don't worry that packages used to bootstrap the needed compiler are |
Don't worry that packages used to bootstrap the needed compiler are |
compiled with an older compiler. Don't worry that they might be |
compiled with an older compiler. Don't worry that they might be |
Line 180 different depending on build order. If
|
Line 202 different depending on build order. If
|
deal with it. This requires choosing an approach to omit compiler |
deal with it. This requires choosing an approach to omit compiler |
selection logic when building the compiler: |
selection logic when building the compiler: |
|
|
##### Mark bootstrap packages |
#### Mark bootstrap packages |
|
|
Mark packages used to build gcc as PKGSRC_GCC_BOOTSTRAP=yes. |
Mark packages used to build gcc as PKGSRC_GCC_BOOTSTRAP=yes. |
Conditionalize this on OPSYS if necessary. Don't force the compiler |
Conditionalize this on OPSYS if necessary. Don't force the compiler |
if this is set. |
if this is set. |
|
|
##### Pass a recursive variable |
Alternatively, manage a per-OS list of packages in a central mk file. |
|
|
|
#### Pass a recursive variable |
|
|
As above, but set PKGSRC_GCC_BOOTSTRAP=yes in the evniroment of the |
As above, but set PKGSRC_GCC_BOOTSTRAP=yes in the evniroment of the |
call to build the compiler, so that all dependencies inherit |
call to build the compiler, so that all dependencies inherit |
permission to skip compiler selection logic. (Alternatively, use some |
permission to skip compiler selection logic. (Alternatively, use some |
other mechanism such as passing a make variable explicitly.) |
other mechanism such as passing a make variable explicitly.) |
|
|
### Differing GCC and GXX versions |
## Differing GCC and GXX versions |
|
|
Perhaps it is a mistake to allow the chosen GCC and GXX versions to |
Perhaps it is a mistake to allow the chosen GCC and GXX versions to |
differ. If we require them to be the same, then essentially all |
differ. If we require them to be the same, then essentially all |
Line 201 systems with a base system compiler olde
|
Line 225 systems with a base system compiler olde
|
bootstrap the compiler. For now, we allow them to differ and will |
bootstrap the compiler. For now, we allow them to differ and will |
permit the defaults to differ. |
permit the defaults to differ. |
|
|
### gcc versions and number of buildable packages |
## gcc versions and number of buildable packages |
|
|
A gcc version that is too old will not build a number of packages. |
A gcc version that is too old will not build a number of packages. |
Anything older than 4.8 fails for c++11. 4.8 fails on some c++11 |
Anything older than 4.8 fails for c++11. 4.8 fails on some c++11 |
packages, such as firefox and glibmm. |
packages, such as firefox and glibmm. |
|
|
A version that is too new also fails to build packages. Analyses |
A version that is too new also fails to build packages. Jason Bacon |
posted to tech-pkg indicate that 5 is close to 4.9 in the number of |
posted counts to tech-pkg indicate that 5 is close to 4.8 in the |
packages built, and that moving to 6 causes hundreds of additional |
number of packages built, and that moving to 6 causes hundreds of |
failures. |
additional failures. (Keep in mind that currently, building with 4.8 |
|
will build 4.9 for firefox, but in the future will not.) |
|
|
|
www/pkgsrc/packages/sharedapps/pkg-2017Q3/RHEL6-gcc48/All 16461 |
|
www/pkgsrc/packages/sharedapps/pkg-2017Q3/RHEL6-gcc6/All 15849 |
|
|
|
www/pkgsrc/packages/sharedapps/pkg-2017Q3/RHEL7-gcc48/All 16414 |
|
www/pkgsrc/packages/sharedapps/pkg-2017Q3/RHEL7-gcc5/All 16338 |
|
|
Therefore, the current answer to "What is the best version to use" is |
Therefore, the current answer to "What is the best version to use" is |
5. |
5. |
|
|
\todo Check this with Jason Bacon. |
## Default versions for various systems |
|
|
### Default versions for various systems |
|
|
|
Note that if for any particular system's set of installed packages (or |
Note that if for any particular system's set of installed packages (or |
bulk build), a newer gcc has to be built, it does not hurt to have |
bulk build), a newer gcc has to be built, it does not hurt to have |
Line 226 built it earlier.
|
Line 255 built it earlier.
|
When the base system is old (e.g., gcc 4.5 in NetBSD 6, or 4.1, in |
When the base system is old (e.g., gcc 4.5 in NetBSD 6, or 4.1, in |
NetBSD 5), then it is clear that a newer version must be built. For |
NetBSD 5), then it is clear that a newer version must be built. For |
these, PKGSRC_GXX_VERSION should default to a newish gcc, avoiding |
these, PKGSRC_GXX_VERSION should default to a newish gcc, avoiding |
being so new as to cause building issues. Currently, gcc5 is probably |
being so new as to cause building issues. PKGSRC_GCC_VERSION should |
a good choice, with gcc6 compiling significantly but not vastly fewer |
probably default to the system version if it can build all C99 |
packages. PKGSRC_GCC_VERSION should probably default to the system |
programs, or match PKGSRC_GXX_VERSION, if the system version is too |
version if it can build all C99 programs, or match PKGSRC_GXX_VERSION, |
old. Perhaps gcc 4.5 would be used, but 4.1 not used. \todo Discuss. |
if the system version is too old. Perhaps gcc 4.5 would be used, but |
|
4.1 not used. \todo Discuss. |
|
|
|
When the base system is almost new enough, the decision about the |
When the base system is almost new enough, the decision about the |
default is more complicated. A key example is gcc 4.8, found in |
default is more complicated. A key example is gcc 4.8, found in |
Line 240 need a newer version. One options is to
|
Line 267 need a newer version. One options is to
|
firefox failing, as well as all c++14 programs. Another is to choose |
firefox failing, as well as all c++14 programs. Another is to choose |
4.9, but this makes little sense because c++14 programs will still |
4.9, but this makes little sense because c++14 programs will still |
fail, and the general rule of moving to the most recent |
fail, and the general rule of moving to the most recent |
generally-acceptable version applies, which currently leads to gcc6. |
generally-acceptable version applies, which currently leads to gcc5. |
This is in effect a declaration that "almost new enough" does not |
This is in effect a declaration that "almost new enough" does not |
count as new enough. Thus the plan for NetBSD 7 is to set |
count as new enough. Thus the plan for NetBSD 7 is to set |
PKGSRC_GCC_VERSION to 4.8 and PKGSRC_GXX_VERSION to 5. |
PKGSRC_GCC_VERSION to 4.8 and PKGSRC_GXX_VERSION to 5. |
Line 251 pkgsrc fail to build with it (because it
|
Line 278 pkgsrc fail to build with it (because it
|
that it supports (almost all) C++14 programs. Our current definiton |
that it supports (almost all) C++14 programs. Our current definiton |
of new enough is gcc 5. |
of new enough is gcc 5. |
|
|
### Limited mixed versions |
## Limited mixed versions |
|
|
One approach would be to allow limited mixed versions, where |
One approach would be to allow limited mixed versions, where |
individual programs could force a specific version to be bootstrapped |
individual programs could force a specific version to be bootstrapped |
Line 263 unsound with a library rather than an en
|
Line 290 unsound with a library rather than an en
|
too much complexity for avoiding building a newer compiler in limited |
too much complexity for avoiding building a newer compiler in limited |
situations. |
situations. |
|
|
### Fortran |
## Fortran |
|
|
Fortran support is currently somewhat troubled.. It seems obvious to |
Fortran support is currently somewhat troubled.. It seems obvious to |
extend to PGKSRC_GFORTRAN_VERSION, and have that match |
extend to PGKSRC_GFORTRAN_VERSION, and have that match |
Line 275 fortran, we should require a single vers
|
Line 302 fortran, we should require a single vers
|
|
|
\todo Discuss. |
\todo Discuss. |
|
|
### C++ programs used by C programs |
## C++ libraries used by C programs |
|
|
The choice of one version for C++ and one for C (e.g. 5, 4.8 on |
The choice of one version for C++ and one for C (e.g. 5, 4.8 on |
netbsd-7) breaks down if a C program links against a library that is |
netbsd-7) breaks down if a C program links against a library that is |
Line 287 which will not add c++ to USE_LANGUAGES
|
Line 314 which will not add c++ to USE_LANGUAGES
|
PKGSRC_GXX_VERSION to be used. Or decide that this is a good reason |
PKGSRC_GXX_VERSION to be used. Or decide that this is a good reason |
to really just have one compiler version. |
to really just have one compiler version. |
|
|
## Path forward |
# Path forward |
|
|
|
(This assumes per-package marking of bootstrap packages, but is |
|
reasonably obviously extended to the other schemes.) |
|
|
- Modify all gcc packages to have minimal dependencies, and to add |
- Modify all gcc packages to have minimal dependencies, and to add |
PKGSRC_GCC_BOOTSTRAP. |
PKGSRC_GCC_BOOTSTRAP. |
Line 298 to really just have one compiler version
|
Line 328 to really just have one compiler version
|
- Modify the compiler selection logic for LANGUAGES= to fail if |
- Modify the compiler selection logic for LANGUAGES= to fail if |
PKGSRC_GCC_VERSION/PKGSRC_GXX_VERSION is not new enough. |
PKGSRC_GCC_VERSION/PKGSRC_GXX_VERSION is not new enough. |
|
|
- Modify the compiler selection logic for GCC_REQD to fail if the |
- Modify the compiler selection logic for GCC_REQD to fail if |
version of GCC/GXX is not new enough. |
PKGSRC_GCC_VERSION/PKGSRC_GXX_VERSION is not new enough. |
|
|
- Decide on defaults. The straw proposal is that PKGSRC_GCC_VERSION |
- Decide on defaults. The straw proposal is that PKGSRC_GCC_VERSION |
is the base system version if >= 4.5 (or 4.4?), and otherwise 5, |
is the base system version if >= 4.5 (or 4.4?), and otherwise 5, |
and that PKGSRC_GXX_VERSION is the base system version if >= 5, and |
and that PKGSRC_GXX_VERSION is the base system version if >= 5, and |
otherwise 5. |
otherwise 5. Implement these in platform.mk as they are tested. |
|
|
|
## Later steps |
|
|
|
- Address fortran. Probably add PKGSRC_GFORTRAN_VERSION, after |
|
determining how Fortran, C and C++ interact with library ABI |
|
compatibility. |
|
|
|
# Data |
|
|
|
This section has data points that are relevant to the discussion. |
|
|
|
## amd64/i386 |
|
|
|
It is believed that pkgsrc gcc generally builds on these systems. |
|
gcc6 builds on netbsd-5/i386. |
|
|
### Later steps |
## macppc |
|
|
- Address fortran. |
On macppc, [lang/gcc5 fails on netsbd-6 and netbsd-7, but succeeds on |
|
netbsd-8](https://mail-index.netbsd.org/tech-pkg/2018/01/03/msg019260.html). |