Diff for /wikisrc/pkgsrc/gcc.mdwn between versions 1.2 and 1.6

version 1.2, 2017/11/26 01:20:23 version 1.6, 2017/12/30 01:26:56
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.
   
 Issues with using base system gcc are 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.  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
   programs, it cannot be used for firefox or glibmm (and therefore any
   package that links against glibmm).
   
 Issues when using pkgsrc gcc are that  Issues when using pkgsrc gcc are that
   
Line 47  This section attempts to gather all the  Line 50  This section attempts to gather all the 
     version used in any included library.      version used in any included library.
   
   - All packages that use C++ should be built with the same compiler    - All packages that use C++ should be built with the same compiler
     version.  Because these typically also include C, the version used      version.  Because these in the general case may include C, the
     for C++ must be at least as new as the version used for any used C      version used for C++ must be at least as new as the version used
     package.      for any used C package.
   
   - pkgsrc should avoid building gcc unless it is more or less    - pkgsrc should avoid building gcc unless it is more or less
     necessary to build packges.  (As an example, if the base system      necessary to build packges.  (As an example, if the base system
Line 84  sound while mimimizing complexity. Line 87  sound while mimimizing complexity.
     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- and
     version--specific default.      version--specific default.
   
   - A user-settable variable PKGSRC_GXX_VERSION will declare the version of gcc to    - A user-settable variable PKGSRC_GXX_VERSION will declare the
     be used for all C++ programs, again with an OS- and      version of gcc to be used for all C++ programs, again with an OS-
     version-specific default.  It must be at least PKGSRC_GCC_VERSION.      and version-specific default.  It must be at least
       PKGSRC_GCC_VERSION.
   
   - 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
Line 102  sound while mimimizing complexity. Line 106  sound while mimimizing complexity.
     package building will fail.  We call the resulting      package building will fail.  We call the resulting
     PKGSRC_GCC_VERSION or PKGSRC_GXX_VERSION the chosen version.      PKGSRC_GCC_VERSION or PKGSRC_GXX_VERSION the chosen version.
   
   - When building a program using C or C++, the chosen version is not    - When building a program using C or C++, if the chosen version is
     provided by the base system, and the chosen version is not      not provided by the base system, and the chosen version is not
     installed via pkgsrc, then it (and its dependencies) will be built      installed via pkgsrc, then it (and its dependencies) will be built
     from pkgsrc in a special bootstrap mode.  When building in      from pkgsrc in a special bootstrap mode.  When building in
     bootstrap mode, the version selection logic is ignored and the      bootstrap mode, the version selection logic is ignored and the
Line 137  sound while mimimizing complexity. Line 141  sound while mimimizing complexity.
   
 ## Remaining issues  ## Remaining issues
   
 ### gcc dependencies  ### 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 145  For now, we defer worrying about these p Line 149  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: Analyze what build-time and install-time dependencies actually  \todo: Analyze what build-time and install-time dependencies actually
 exist.  exist.  Include old GNU/Linux in this analysis.
   
   \todo: Consider if dropping nls would help.  (On NetBSD, it seems that
   base system libraries are used, so it would not help.)
   
   ### managing gcc dependencies
   
   There are multiple paths forward.
   
   \todo Choose one.  Straw proposal is "Don't worry" and recursive
   variable for the initial implementation.
   
   #### Separate prefix
   
   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
   normal packages.  This completely avoids the issue of building a
   package one way in bootstrap and another not in bootstrap, at the cost
   of two builds and writing the separate-prefix code.
   
   #### Don't worry
   
   Don't worry that packages used to bootstrap the needed compiler are
   compiled with an older compiler.  Don't worry that they might be
   different depending on build order.  If we have an actual problem,
   deal with it.  This requires choosing an approach to omit compiler
   selection logic when building the compiler:
   
   ##### Mark bootstrap packages
   
   Mark packages used to build gcc as PKGSRC_GCC_BOOTSTRAP=yes.
   Conditionalize this on OPSYS if necessary.  Don't force the compiler
   if this is set.
   
   ##### Pass a recursive variable
   
   As above, but set PKGSRC_GCC_BOOTSTRAP=yes in the evniroment of the
   call to build the compiler, so that all dependencies inherit
   permission to skip compiler selection logic.  (Alternatively, use some
   other mechanism such as passing a make variable explicitly.)
   
 \todo: Discuss adjusting options to minimize dependencies, including  ### Differing GCC and GXX versions
 gcc-inplace-math and nls.  
   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
   systems with a base system compiler older than gcc 5 will have to
   bootstrap the compiler.  For now, we allow them to differ and will
   permit the defaults to differ.
   
   ### gcc versions and number of buildable 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
   packages, such as firefox and glibmm.
   
   A version that is too new also fails to build packages.  Analyses
   posted to tech-pkg indicate that 5 is close to 4.9 in the number of
   packages built, and that moving to 6 causes hundreds of additional
   failures.
   
   Therefore, the current answer to "What is the best version to use" is
   5.
   
   \todo Check this with Jason Bacon.
   
 ### Default versions for various systems  ### Default versions for various systems
   
 Note that if any particular system (or bulk build), a newer gcc has to  Note that if for any particular system's set of installed packages (or
 be built, it does not hurt incrementally to have built it earlier.  bulk build), a newer gcc has to be built, it does not hurt to have
   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, gcc6 is probably  being so new as to cause building issues.  Currently, gcc5 is probably
 a good choice.  PKGSRC_GCC_VERSION should probably default to the  a good choice, with gcc6 compiling significantly but not vastly fewer
 system version if it can build C99, or match PKGSRC_GXX_VERSION, if  packages.  PKGSRC_GCC_VERSION should probably default to the system
 the system version is too old.  Perhaps gcc 4.5 would be used, but 4.1  version if it can build all C99 programs, or match PKGSRC_GXX_VERSION,
 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 175  fail, and the general rule of moving to  Line 243  fail, and the general rule of moving to 
 generally-acceptable version applies, which currently leads to gcc6.  generally-acceptable version applies, which currently leads to gcc6.
 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 6.  PKGSRC_GCC_VERSION to 4.8 and PKGSRC_GXX_VERSION to 5.
   
 When the base system is new, e.g. gcc 5 or gcc 6 it should simply be  When the base system is new enough, e.g. gcc 5, 6 or 7 it should
 used.  By "new enough", we mean that almost no programs in pkgsrc fail  simply be used.  By "new enough", we mean that almost no programs in
 to build with it, which implies that it supports (almost all) C++14  pkgsrc fail to build with it (because it is too old), which implies
 programs.   Our current definiton of new enough is gcc 5.  that it supports (almost all) C++14 programs.  Our current definiton
   of new enough is gcc 5.
   
 ### Limited mixed versions  ### Limited mixed versions
   
Line 199  situations. Line 268  situations.
 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
 PKGSRC_GCC_VERSION or PKGSRC_GXX_VERSION, but the Fortran situation is  PKGSRC_GCC_VERSION or PKGSRC_GXX_VERSION, but the Fortran situation is
 not worsened by the above design.  \todo Discuss.  not worsened by the above design.
   
   When building a gcc version, we get gfortran.  Perhaps, because of
   fortran, we should require a single version, vs a C and a C++ version.
   
   \todo Discuss.
   
   ### C++ programs used by C programs
   
   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
   written in C++ but provides a C API, because we still need the C++
   version's stdlib.
   
   \todo Define a variable for such packages to have in their buildlink3,
   which will not add c++ to USE_LANGUAGES but will force
   PKGSRC_GXX_VERSION to be used.  Or decide that this is a good reason
   to really just have one compiler version.
   
 ## Path forward  ## Path forward
   
Line 216  not worsened by the above design.  \todo Line 302  not worsened by the above design.  \todo
    version of GCC/GXX is not new enough.     version of GCC/GXX 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 6,     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 6.     otherwise 5.
   
   ### Later steps
   
    - Address fortran.

Removed from v.1.2  
changed lines
  Added in v.1.6


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