Diff for /wikisrc/pkgsrc/gcc.mdwn between versions 1.11 and 1.12

version 1.11, 2018/01/01 23:27:13 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 36  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 71  This section attempts to gather all the  Line 71  This section attempts to gather all the 
   
   - 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 156  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 179  base system libraries are used, so it wo Line 179  base system libraries are used, so it wo
 \todo: Consider failing if optins that we want one way are another,  \todo: Consider failing if optins that we want one way are another,
 when bootstrapping.  when bootstrapping.
   
 ### managing gcc dependencies  ## 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 194  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 202  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
Line 210  if this is set. Line 210  if this is set.
   
 Alternatively, manage a per-OS list of packages in a central mk file.  Alternatively, manage a per-OS list of packages in a central mk file.
   
 ##### Pass a recursive variable  #### 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 225  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
Line 246  will build 4.9 for firefox, but in the f Line 246  will build 4.9 for firefox, but in the f
 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.
   
 ### 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 278  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 290  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 302  fortran, we should require a single vers Line 302  fortran, we should require a single vers
   
 \todo Discuss.  \todo Discuss.
   
 ### C++ libraries 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 314  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  (This assumes per-package marking of bootstrap packages, but is
 reasonably obviously extended to the other schemes.)  reasonably obviously extended to the other schemes.)
Line 336  reasonably obviously extended to the oth Line 336  reasonably obviously extended to the oth
    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.  Implement these in platform.mk as they are tested.     otherwise 5.  Implement these in platform.mk as they are tested.
   
 ### Later steps  ## Later steps
   
  - Address fortran.  Probably add PKGSRC_GFORTRAN_VERSION, after   - Address fortran.  Probably add PKGSRC_GFORTRAN_VERSION, after
    determining how Fortran, C and C++ interact with library ABI     determining how Fortran, C and C++ interact with library ABI
    compatibility.     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.
   
   ## macppc
   
   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).

Removed from v.1.11  
changed lines
  Added in v.1.12


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb