--- wikisrc/pkgsrc/gcc.mdwn 2017/11/26 01:20:23 1.2 +++ wikisrc/pkgsrc/gcc.mdwn 2017/11/26 15:37:02 1.4 @@ -18,7 +18,7 @@ build gcc versions (typically newer vers in a compiler within ${PREFIX}, e.g. /usr/pkg/gcc6/bin/gcc. This 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. Issues when using pkgsrc gcc are that @@ -47,9 +47,9 @@ This section attempts to gather all the version used in any included library. - All packages that use C++ should be built with the same compiler - version. Because these typically also include C, the version used - for C++ must be at least as new as the version used for any used C - package. + version. Because these in the general case may include C, the + version used for C++ must be at least as new as the version used + for any used C package. - pkgsrc should avoid building gcc unless it is more or less necessary to build packges. (As an example, if the base system @@ -102,8 +102,8 @@ sound while mimimizing complexity. package building will fail. We call the resulting PKGSRC_GCC_VERSION or PKGSRC_GXX_VERSION the chosen version. - - When building a program using C or C++, the chosen version is not - provided by the base system, and the chosen version is not + - When building a program using C or C++, if the chosen version is + not provided by the base system, and the chosen version is not installed via pkgsrc, then it (and its dependencies) will be built from pkgsrc in a special bootstrap mode. When building in bootstrap mode, the version selection logic is ignored and the @@ -151,19 +151,29 @@ exist. \todo: Discuss adjusting options to minimize dependencies, including gcc-inplace-math and nls. +### Differing GCC and GXX versions + +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. + ### Default versions for various systems -Note that if any particular system (or bulk build), a newer gcc has to -be built, it does not hurt incrementally to have built it earlier. +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 +built it earlier. 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 these, PKGSRC_GXX_VERSION should default to a newish gcc, avoiding -being so new as to cause building issues. Currently, gcc6 is probably -a good choice. PKGSRC_GCC_VERSION should probably default to the -system version if it can build C99, or match PKGSRC_GXX_VERSION, if -the system version is too old. Perhaps gcc 4.5 would be used, but 4.1 -not used. \todo Discuss. +being so new as to cause building issues. Currently, gcc5 is probably +a good choice, with gcc6 compiling significantly but not vastly fewer +packages. PKGSRC_GCC_VERSION should probably default to the system +version if it can build all C99 programs, or match PKGSRC_GXX_VERSION, +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 default is more complicated. A key example is gcc 4.8, found in @@ -175,12 +185,12 @@ fail, and the general rule of moving to generally-acceptable version applies, which currently leads to gcc6. 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 -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 -used. By "new enough", we mean that almost no programs in pkgsrc fail -to build with it, which implies that it supports (almost all) C++14 -programs. Our current definiton of new enough is gcc 5. +When the base system is new enough, e.g. gcc 5, 6 or 7 it should +simply be used. By "new enough", we mean that almost no programs in +pkgsrc fail to build with it, which implies that it supports (almost +all) C++14 programs. Our current definiton of new enough is gcc 5. ### Limited mixed versions @@ -219,3 +229,7 @@ not worsened by the above design. \todo is the base system version if >= 4.5 (or 4.4?), and otherwise 6, and that PKGSRC_GXX_VERSION is the base system version if >= 5, and otherwise 6. + +### Later steps + + - Address fortran.